1 /* 2 * Copyright (c) 2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef BASE_NOTIFICATION_DISTRIBUTED_NOTIFICATION_SERVICE_FRAMEWORKS_JS_NAPI_DISTRIBUTED_ENABLE_H 17 #define BASE_NOTIFICATION_DISTRIBUTED_NOTIFICATION_SERVICE_FRAMEWORKS_JS_NAPI_DISTRIBUTED_ENABLE_H 18 19 #include "common.h" 20 #include <string> 21 22 namespace OHOS { 23 namespace NotificationNapi { 24 using namespace OHOS::Notification; 25 struct DistributedEnableParams { 26 NotificationBundleOption option; 27 std::string deviceType; 28 bool enable = false; 29 }; 30 31 struct DistributedBundleOptionParams { 32 std::vector<DistributedBundleOption> bundles; 33 std::string deviceType; 34 }; 35 36 struct AsyncCallbackDistributedEnable { 37 napi_env env = nullptr; 38 napi_async_work asyncWork = nullptr; 39 DistributedEnableParams params; 40 CallbackPromiseInfo info; 41 }; 42 43 struct AsyncCallbackDistributedBundleOption { 44 napi_env env = nullptr; 45 napi_async_work asyncWork = nullptr; 46 DistributedBundleOptionParams params; 47 CallbackPromiseInfo info; 48 }; 49 50 struct SmartReminderEnabledParams { 51 std::string deviceType; 52 bool enable = false; 53 }; 54 55 struct AsyncCallbackSmartReminderEnabled { 56 napi_env env = nullptr; 57 napi_async_work asyncWork = nullptr; 58 SmartReminderEnabledParams params; 59 CallbackPromiseInfo info; 60 }; 61 62 struct DistributedEnableBySlotParams { 63 NotificationConstant::SlotType slot; 64 std::string deviceType; 65 bool enable = false; 66 }; 67 68 struct AsyncCallbackDistributedEnableBySlot { 69 napi_env env = nullptr; 70 napi_async_work asyncWork = nullptr; 71 DistributedEnableBySlotParams params; 72 CallbackPromiseInfo info; 73 }; 74 napi_value NapiSetDistributedEnabledByBundle(napi_env env, napi_callback_info info); 75 napi_value NapiSetDistributedBundleOption(napi_env env, napi_callback_info info); 76 napi_value NapiSetSmartReminderEnabled(napi_env env, napi_callback_info info); 77 napi_value NapiIsSmartReminderEnabled(napi_env env, napi_callback_info info); 78 napi_value NapiSetDistributedEnabledBySlot(napi_env env, napi_callback_info info); 79 napi_value NapiIsDistributedEnabledBySlot(napi_env env, napi_callback_info info); 80 } // namespace NotificationNapi 81 } // namespace OHOS 82 83 #endif // BASE_NOTIFICATION_DISTRIBUTED_NOTIFICATION_SERVICE_FRAMEWORKS_JS_NAPI_DISTRIBUTED_ENABLE_H 84