/* * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef BASE_NOTIFICATION_DISTRIBUTED_NOTIFICATION_SERVICE_FRAMEWORKS_JS_NAPI_INCLUDE_DISTRIBUTED_H #define BASE_NOTIFICATION_DISTRIBUTED_NOTIFICATION_SERVICE_FRAMEWORKS_JS_NAPI_INCLUDE_DISTRIBUTED_H #include "common.h" namespace OHOS { namespace NotificationNapi { using namespace OHOS::Notification; struct AsyncCallbackInfoIsEnabled { napi_env env = nullptr; napi_async_work asyncWork = nullptr; CallbackPromiseInfo info; bool enable = false; }; struct EnabledParams { napi_ref callback = nullptr; bool enable = false; }; struct AsyncCallbackInfoEnabled { napi_env env = nullptr; napi_async_work asyncWork = nullptr; CallbackPromiseInfo info; EnabledParams params; }; struct EnabledByBundleParams { NotificationBundleOption option; napi_ref callback = nullptr; bool enable = false; }; struct AsyncCallbackInfoEnabledByBundle { napi_env env = nullptr; napi_async_work asyncWork = nullptr; CallbackPromiseInfo info; EnabledByBundleParams params; }; struct IsEnabledByBundleParams { NotificationBundleOption option; napi_ref callback = nullptr; std::string deviceType; bool hasDeviceType = false; }; struct AsyncCallbackInfoIsEnabledByBundle { napi_env env = nullptr; napi_async_work asyncWork = nullptr; CallbackPromiseInfo info; IsEnabledByBundleParams params; bool enable = false; }; struct AsyncCallbackInfoGetRemindType { napi_env env = nullptr; napi_async_work asyncWork = nullptr; CallbackPromiseInfo info; NotificationConstant::RemindType remindType = NotificationConstant::RemindType::NONE; }; struct EnabledWithoutAppParams { int32_t userId = SUBSCRIBE_USER_INIT; bool enable = false; napi_ref callback = nullptr; }; struct AsyncCallbackInfoEnabledWithoutApp { napi_env env = nullptr; napi_async_work asyncWork = nullptr; CallbackPromiseInfo info; EnabledWithoutAppParams params; }; struct GetEnabledWithoutAppParams { int32_t userId = SUBSCRIBE_USER_INIT; napi_ref callback = nullptr; }; struct AsyncCallbackInfoGetEnabledWithoutApp { napi_env env = nullptr; napi_async_work asyncWork = nullptr; CallbackPromiseInfo info; GetEnabledWithoutAppParams params; bool enable = false; }; napi_value IsDistributedEnabled(napi_env env, napi_callback_info info); napi_value EnableDistributed(napi_env env, napi_callback_info info); napi_value EnableDistributedByBundle(napi_env env, napi_callback_info info); napi_value EnableDistributedSelf(napi_env env, napi_callback_info info); napi_value IsDistributedEnableByBundle(napi_env env, napi_callback_info info); napi_value GetDeviceRemindType(napi_env env, napi_callback_info info); napi_value SetSyncNotificationEnabledWithoutApp(napi_env env, napi_callback_info info); napi_value GetSyncNotificationEnabledWithoutApp(napi_env env, napi_callback_info info); napi_value ParseParameters(const napi_env &env, const napi_callback_info &info, EnabledParams ¶ms); napi_value ParseParameters(const napi_env &env, const napi_callback_info &info, EnabledByBundleParams ¶ms); napi_value ParseParameters(const napi_env &env, const napi_callback_info &info, IsEnabledByBundleParams ¶ms); napi_value ParseParameters(const napi_env &env, const napi_callback_info &info, EnabledWithoutAppParams ¶ms); napi_value ParseParameters(const napi_env &env, const napi_callback_info &info, GetEnabledWithoutAppParams ¶ms); } // namespace NotificationNapi } // namespace OHOS #endif // BASE_NOTIFICATION_DISTRIBUTED_NOTIFICATION_SERVICE_FRAMEWORKS_JS_NAPI_INCLUDE_DISTRIBUTED_H