1 /* 2 * Copyright (c) 2024 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_SERVICES_ANS_INCLUDE_NOTIFICATION_EXT_H 17 #define BASE_NOTIFICATION_DISTRIBUTED_NOTIFICATION_SERVICE_SERVICES_ANS_INCLUDE_NOTIFICATION_EXT_H 18 19 #include <string> 20 21 #include "errors.h" 22 #include "nocopyable.h" 23 #include "notification.h" 24 #include "notification_request.h" 25 #include "notification_unified_group_Info.h" 26 #include "singleton.h" 27 #include "advanced_aggregation_data_roaming_observer.h" 28 29 namespace OHOS::Notification { 30 class ExtensionWrapper final { 31 DECLARE_DELAYED_SINGLETON(ExtensionWrapper); 32 public: 33 DISALLOW_COPY_AND_MOVE(ExtensionWrapper); 34 void InitExtentionWrapper(); 35 typedef ErrCode (*SYNC_ADDITION_CONFIG)(const std::string& key, const std::string& value); 36 typedef void (*UPDATE_BY_CANCEL)(const std::vector<sptr<Notification>>& notifications, int deleteType); 37 typedef ErrCode (*GET_UNIFIED_GROUP_INFO)(const sptr<NotificationRequest> &request); 38 typedef void (*UPDATE_GROUP_INFO)(const std::string &key, std::shared_ptr<NotificationUnifiedGroupInfo> &groupInfo); 39 typedef void (*INIT_SUMMARY)(UPDATE_GROUP_INFO func); 40 typedef void (*SET_LOCAL_SWITCH)(bool status); 41 typedef int32_t (*LOCAL_CONTROL)(const sptr<NotificationRequest> &request); 42 typedef void (*UPDATE_BY_BUNDLE)(const std::string bundleName, int deleteType); 43 typedef int32_t (*REMINDER_CONTROL)(const std::string &bundleName); 44 typedef int32_t (*BANNER_CONTROL)(const std::string &bundleName); 45 46 ErrCode SyncAdditionConfig(const std::string& key, const std::string& value); 47 void UpdateByCancel(const std::vector<sptr<Notification>>& notifications, int deleteReason); 48 ErrCode GetUnifiedGroupInfo(const sptr<NotificationRequest> &request); 49 void RegisterDataSettingObserver(); 50 void SetlocalSwitch(std::string &enable); 51 void CheckIfSetlocalSwitch(); 52 int32_t LocalControl(const sptr<NotificationRequest> &request); 53 void UpdateByBundle(const std::string bundleName, int deleteType); 54 int32_t ReminderControl(const std::string &bundleName); 55 int32_t BannerControl(const std::string &bundleName); 56 57 private: 58 static int32_t convertToDelType(int32_t deleteReason); 59 60 void* extensionWrapperHandle_ = nullptr; 61 SYNC_ADDITION_CONFIG syncAdditionConfig_ = nullptr; 62 UPDATE_BY_CANCEL updateByCancel_ = nullptr; 63 GET_UNIFIED_GROUP_INFO getUnifiedGroupInfo_ = nullptr; 64 INIT_SUMMARY initSummary_ = nullptr; 65 SET_LOCAL_SWITCH setLocalSwitch_ = nullptr; 66 LOCAL_CONTROL localControl_ = nullptr; 67 UPDATE_BY_BUNDLE updateByBundle_ = nullptr; 68 REMINDER_CONTROL reminderControl_ = nullptr; 69 BANNER_CONTROL bannerControl_ = nullptr; 70 bool isRegisterDataSettingObserver = false; 71 }; 72 73 #define EXTENTION_WRAPPER ::OHOS::DelayedSingleton<ExtensionWrapper>::GetInstance() 74 } // namespace OHOS::Notification 75 #endif // BASE_NOTIFICATION_DISTRIBUTED_NOTIFICATION_SERVICE_SERVICES_ANS_INCLUDE_NOTIFICATION_EXT_H 76