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 26 namespace OHOS { 27 namespace Notification { 28 class NotificationCloneBundleInfo { 29 public: 30 class SlotInfo { 31 public: 32 std::string Dump() const; 33 NotificationConstant::SlotType slotType_; 34 bool enable_; 35 bool isForceControl_; 36 }; 37 NotificationCloneBundleInfo() = default; 38 ~NotificationCloneBundleInfo() = default; 39 40 void SetBundleName(const std::string &name); 41 std::string GetBundleName() const; 42 43 void SetAppIndex(const int32_t &appIndex); 44 int32_t GetAppIndex() const; 45 46 void SetSlotFlags(const uint32_t &slotFlags); 47 uint32_t GetSlotFlags() const; 48 49 void SetUid(const int32_t &uid); 50 int32_t GetUid() const; 51 52 void SetIsShowBadge(const bool &isShowBadge); 53 bool GetIsShowBadge() const; 54 55 void SetEnableNotification(const bool &enable); 56 bool GetEnableNotification() const; 57 58 void AddSlotInfo(const SlotInfo &slotInfo); 59 std::vector<SlotInfo> GetSlotInfo() const; 60 61 void ToJson(nlohmann::json &jsonObject) const; 62 void FromJson(const nlohmann::json &root); 63 void SlotsFromJson(const nlohmann::json &jsonObject); 64 std::string Dump() const; 65 66 private: 67 std::string bundleName_; 68 int32_t appIndex_ = -1; 69 int32_t uid_ = -1; 70 uint32_t slotFlags_ = 0; 71 bool isShowBadge_ = false; 72 bool isEnabledNotification_ = false; 73 std::vector<SlotInfo> slotsInfo_; 74 }; 75 } // namespace Notification 76 } // namespace OHOS 77 #endif // BASE_NOTIFICATION_DISTRIBUTED_NOTIFICATION_SERVICE_SERVICES_ANS_INCLUDE_NOTIFICATION_CLONE_BUNDLE_INFO_H 78