1 /* 2 * Copyright (c) 2024-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_CLONE_BUNDLE_INFO_H 17 #define BASE_NOTIFICATION_DISTRIBUTED_NOTIFICATION_SERVICE_SERVICES_ANS_INCLUDE_NOTIFICATION_CLONE_BUNDLE_INFO_H 18 19 #include "notification_clone_template.h" 20 21 #include "ffrt.h" 22 #include "notification_constant.h" 23 #include "notification_bundle_option.h" 24 #include "notification_do_not_disturb_profile.h" 25 #include "notification_constant.h" 26 27 namespace OHOS { 28 namespace Notification { 29 class NotificationCloneBundleInfo { 30 public: 31 class SlotInfo { 32 public: 33 std::string Dump() const; 34 NotificationConstant::SlotType slotType_; 35 bool enable_; 36 bool isForceControl_; 37 }; 38 NotificationCloneBundleInfo() = default; 39 ~NotificationCloneBundleInfo() = default; 40 41 void SetBundleName(const std::string &name); 42 std::string GetBundleName() const; 43 44 void SetAppIndex(const int32_t &appIndex); 45 int32_t GetAppIndex() const; 46 47 void SetSlotFlags(const uint32_t &slotFlags); 48 uint32_t GetSlotFlags() const; 49 50 void SetUid(const int32_t &uid); 51 int32_t GetUid() const; 52 53 void SetIsShowBadge(const bool &isShowBadge); 54 bool GetIsShowBadge() const; 55 56 void SetEnableNotification(const NotificationConstant::SWITCH_STATE &state); 57 NotificationConstant::SWITCH_STATE GetEnableNotification() const; 58 59 void SetSilentReminderEnabled(const NotificationConstant::SWITCH_STATE &silentReminderEnabled); 60 NotificationConstant::SWITCH_STATE GetSilentReminderEnabled() const; 61 62 void AddSlotInfo(const SlotInfo &slotInfo); 63 std::vector<SlotInfo> GetSlotInfo() const; 64 65 void ToJson(nlohmann::json &jsonObject) const; 66 void FromJson(const nlohmann::json &root); 67 void SlotsFromJson(const nlohmann::json &jsonObject); 68 std::string Dump() const; 69 70 private: 71 std::string bundleName_; 72 int32_t appIndex_ = -1; 73 int32_t uid_ = -1; 74 uint32_t slotFlags_ = 0; 75 bool isShowBadge_ = false; 76 NotificationConstant::SWITCH_STATE isEnabledNotification_ = NotificationConstant::SWITCH_STATE::SYSTEM_DEFAULT_OFF; 77 std::vector<SlotInfo> slotsInfo_; 78 NotificationConstant::SWITCH_STATE silentReminderEnabled_; 79 }; 80 } // namespace Notification 81 } // namespace OHOS 82 #endif // BASE_NOTIFICATION_DISTRIBUTED_NOTIFICATION_SERVICE_SERVICES_ANS_INCLUDE_NOTIFICATION_CLONE_BUNDLE_INFO_H 83