diff --git a/services/ans/include/event_report.h b/services/ans/include/event_report.h index cae2668f239adac8a203e4b54863f50585220d59..e46bbdca976e6046ef3205ded72407cb6aed65d5 100644 --- a/services/ans/include/event_report.h +++ b/services/ans/include/event_report.h @@ -26,20 +26,20 @@ namespace OHOS { namespace Notification { namespace { // event name -const std::string SUBSCRIBE_ERROR = "SUBSCRIBE_ERROR"; -const std::string ENABLE_NOTIFICATION_ERROR = "ENABLE_NOTIFICATION_ERROR"; -const std::string ENABLE_NOTIFICATION_SLOT_ERROR = "ENABLE_NOTIFICATION_SLOT_ERROR"; -const std::string PUBLISH_ERROR = "PUBLISH_ERROR"; -const std::string FLOW_CONTROL_OCCUR = "FLOW_CONTROL_OCCUR"; +constexpr char SUBSCRIBE_ERROR[] = "SUBSCRIBE_ERROR"; +constexpr char ENABLE_NOTIFICATION_ERROR[] = "ENABLE_NOTIFICATION_ERROR"; +constexpr char ENABLE_NOTIFICATION_SLOT_ERROR[] = "ENABLE_NOTIFICATION_SLOT_ERROR"; +constexpr char PUBLISH_ERROR[] = "PUBLISH_ERROR"; +constexpr char FLOW_CONTROL_OCCUR[] = "FLOW_CONTROL_OCCUR"; -const std::string SUBSCRIBE = "SUBSCRIBE"; -const std::string UNSUBSCRIBE = "UNSUBSCRIBE"; -const std::string ENABLE_NOTIFICATION = "ENABLE_NOTIFICATION"; -const std::string ENABLE_NOTIFICATION_SLOT = "ENABLE_NOTIFICATION_SLOT"; +constexpr char SUBSCRIBE[] = "SUBSCRIBE"; +constexpr char UNSUBSCRIBE[] = "UNSUBSCRIBE"; +constexpr char ENABLE_NOTIFICATION[] = "ENABLE_NOTIFICATION"; +constexpr char ENABLE_NOTIFICATION_SLOT[] = "ENABLE_NOTIFICATION_SLOT"; -const std::string PUBLISH = "PUBLISH"; -const std::string CANCEL = "CANCEL"; -const std::string REMOVE = "REMOVE"; +constexpr char PUBLISH[] = "PUBLISH"; +constexpr char CANCEL[] = "CANCEL"; +constexpr char REMOVE[] = "REMOVE"; } // namespace struct EventInfo { diff --git a/services/ans/include/preferences_constant.h b/services/ans/include/preferences_constant.h index 80434070058fdcf4b78cb3f1d8996ebcbc724e4a..c99d818fddb35296b8b324b8f66b4be0c186c92c 100644 --- a/services/ans/include/preferences_constant.h +++ b/services/ans/include/preferences_constant.h @@ -18,195 +18,15 @@ namespace OHOS { namespace Notification { -/** - * Indicates that disturbe key which do not disturbe type. - */ -const static std::string KEY_DO_NOT_DISTURB_TYPE = "ans_doNotDisturbType"; - -/** - * Indicates that disturbe key which do not disturbe begin date. - */ -const static std::string KEY_DO_NOT_DISTURB_BEGIN_DATE = "ans_doNotDisturbBeginDate"; - -/** - * Indicates that disturbe key which do not disturbe end date. - */ -const static std::string KEY_DO_NOT_DISTURB_END_DATE = "ans_doNotDisturbEndDate"; - -/** - * Indicates that disturbe key which enable all notification. - */ -const static std::string KEY_ENABLE_ALL_NOTIFICATION = "ans_notificationAll"; - -/** - * Indicates that disturbe key which bundle label. - */ -const static std::string KEY_BUNDLE_LABEL = "label_ans_bundle_"; - -/** - * Indicates that disturbe key which under line. - */ -const static std::string KEY_UNDER_LINE = "_"; - -/** - * Indicates that disturbe key which bundle begin key. - */ -const static std::string KEY_ANS_BUNDLE = "ans_bundle"; - -/** - * Indicates that disturbe key which bundle name. - */ -const static std::string KEY_BUNDLE_NAME = "name"; - -/** - * Indicates that disturbe key which bundle imortance. - */ -const static std::string KEY_BUNDLE_IMPORTANCE = "importance"; - -/** - * Indicates that disturbe key which bundle show badge. - */ -const static std::string KEY_BUNDLE_SHOW_BADGE = "showBadge"; - -/** - * Indicates that disturbe key which bundle total badge num. - */ -const static std::string KEY_BUNDLE_BADGE_TOTAL_NUM = "badgeTotalNum"; - -/** - * Indicates that disturbe key which bundle private allowed. - */ -const static std::string KEY_BUNDLE_PRIVATE_ALLOWED = "privateAllowed"; - -/** - * Indicates that disturbe key which bundle enable notification. - */ -const static std::string KEY_BUNDLE_ENABLE_NOTIFICATION = "enabledNotification"; - -/** - * Indicates that disturbe key which bundle popped dialog. - */ -const static std::string KEY_BUNDLE_POPPED_DIALOG = "poppedDialog"; - -/** - * Indicates that disturbe key which bundle uid. - */ -const static std::string KEY_BUNDLE_UID = "uid"; - -/** - * Indicates that disturbe key which group. - */ -const static std::string KEY_GROUP = "group"; - -/** - * Indicates that disturbe key which group id. - */ -const static std::string KEY_GROUP_ID = "id"; - -/** - * Indicates that disturbe key which group name. - */ -const static std::string KEY_GROUP_NAME = "name"; - -/** - * Indicates that disturbe key which group description. - */ -const static std::string KEY_GROUP_DESCRIPTION = "groupDescription"; - -/** - * Indicates that disturbe key which group is disable. - */ -const static std::string KEY_GROUP_DISABLE = "isDisable"; - -/** - * Indicates that disturbe key which slot. - */ -const static std::string KEY_SLOT = "slot"; - -/** - * Indicates that disturbe key which slot type. - */ -const static std::string KEY_SLOT_TYPE = "type"; - -/** - * Indicates that disturbe key which slot id. - */ -const static std::string KEY_SLOT_ID = "id"; - -/** - * Indicates that disturbe key which slot group id. - */ -const static std::string KEY_SLOT_GROUPID = "groupId"; - -/** - * Indicates that disturbe key which slot group name. - */ -const static std::string KEY_SLOT_NAME = "name"; - -/** - * Indicates that disturbe key which slot description. - */ -const static std::string KEY_SLOT_DESCRIPTION = "description"; - -/** - * Indicates that disturbe key which slot level. - */ -const static std::string KEY_SLOT_LEVEL = "level"; - -/** - * Indicates that disturbe key which slot show badge. - */ -const static std::string KEY_SLOT_SHOW_BADGE = "showBadge"; - -/** - * Indicates that disturbe key which slot enable light. - */ -const static std::string KEY_SLOT_ENABLE_LIGHT = "enableLight"; - -/** - * Indicates that disturbe key which slot enable vibration. - */ -const static std::string KEY_SLOT_ENABLE_VRBRATION = "enableVibration"; - -/** - * Indicates that disturbe key which slot led light color. - */ -const static std::string KEY_SLOT_LED_LIGHT_COLOR = "ledLightColor"; - -/** - * Indicates that disturbe key which slot lockscreen visibleness. - */ -const static std::string KEY_SLOT_LOCKSCREEN_VISIBLENESS = "lockscreenVisibleness"; - -/** - * Indicates that disturbe key which slot sound. - */ -const static std::string KEY_SLOT_SOUND = "sound"; - -/** - * Indicates that disturbe key which slot vibration style. - */ -const static std::string KEY_SLOT_VIBRATION_STYLE = "vibrationSytle"; - -/** - * Indicates that disturbe key which slot enable bypass end. - */ -const static std::string KEY_SLOT_ENABLE_BYPASS_DND = "enableBypassDnd"; - -/** - * Indicates whether the type of slot is enabled. - */ -const static std::string KEY_SLOT_ENABLED = "enabled"; - /** * Indicates distributed database app id. */ -const std::string APP_ID = "advanced_notification_service"; +constexpr char APP_ID[] = "advanced_notification_service"; /** * Indicates distributed database store id. */ -const std::string STORE_ID = "local_db"; +constexpr char STORE_ID[] = "local_db"; /** * Default params that bundle importance is LEVEL_DEFAULT. diff --git a/services/ans/src/notification_preferences_database.cpp b/services/ans/src/notification_preferences_database.cpp index f98f9d5df7ed4bdc27f9746234ede98ff10a0470..842216dbbea9c3e0cae10fecfa63f07b156401bd 100644 --- a/services/ans/src/notification_preferences_database.cpp +++ b/services/ans/src/notification_preferences_database.cpp @@ -23,6 +23,186 @@ #include "uri.h" namespace OHOS { namespace Notification { +/** + * Indicates that disturbe key which do not disturbe type. + */ +const static std::string KEY_DO_NOT_DISTURB_TYPE = "ans_doNotDisturbType"; + +/** + * Indicates that disturbe key which do not disturbe begin date. + */ +const static std::string KEY_DO_NOT_DISTURB_BEGIN_DATE = "ans_doNotDisturbBeginDate"; + +/** + * Indicates that disturbe key which do not disturbe end date. + */ +const static std::string KEY_DO_NOT_DISTURB_END_DATE = "ans_doNotDisturbEndDate"; + +/** + * Indicates that disturbe key which enable all notification. + */ +const static std::string KEY_ENABLE_ALL_NOTIFICATION = "ans_notificationAll"; + +/** + * Indicates that disturbe key which bundle label. + */ +const static std::string KEY_BUNDLE_LABEL = "label_ans_bundle_"; + +/** + * Indicates that disturbe key which under line. + */ +const static std::string KEY_UNDER_LINE = "_"; + +/** + * Indicates that disturbe key which bundle begin key. + */ +const static std::string KEY_ANS_BUNDLE = "ans_bundle"; + +/** + * Indicates that disturbe key which bundle name. + */ +const static std::string KEY_BUNDLE_NAME = "name"; + +/** + * Indicates that disturbe key which bundle imortance. + */ +const static std::string KEY_BUNDLE_IMPORTANCE = "importance"; + +/** + * Indicates that disturbe key which bundle show badge. + */ +const static std::string KEY_BUNDLE_SHOW_BADGE = "showBadge"; + +/** + * Indicates that disturbe key which bundle total badge num. + */ +const static std::string KEY_BUNDLE_BADGE_TOTAL_NUM = "badgeTotalNum"; + +/** + * Indicates that disturbe key which bundle private allowed. + */ +const static std::string KEY_BUNDLE_PRIVATE_ALLOWED = "privateAllowed"; + +/** + * Indicates that disturbe key which bundle enable notification. + */ +const static std::string KEY_BUNDLE_ENABLE_NOTIFICATION = "enabledNotification"; + +/** + * Indicates that disturbe key which bundle popped dialog. + */ +const static std::string KEY_BUNDLE_POPPED_DIALOG = "poppedDialog"; + +/** + * Indicates that disturbe key which bundle uid. + */ +const static std::string KEY_BUNDLE_UID = "uid"; + +/** + * Indicates that disturbe key which group. + */ +const static std::string KEY_GROUP = "group"; + +/** + * Indicates that disturbe key which group id. + */ +const static std::string KEY_GROUP_ID = "id"; + +/** + * Indicates that disturbe key which group name. + */ +const static std::string KEY_GROUP_NAME = "name"; + +/** + * Indicates that disturbe key which group description. + */ +const static std::string KEY_GROUP_DESCRIPTION = "groupDescription"; + +/** + * Indicates that disturbe key which group is disable. + */ +const static std::string KEY_GROUP_DISABLE = "isDisable"; + +/** + * Indicates that disturbe key which slot. + */ +const static std::string KEY_SLOT = "slot"; + +/** + * Indicates that disturbe key which slot type. + */ +const static std::string KEY_SLOT_TYPE = "type"; + +/** + * Indicates that disturbe key which slot id. + */ +const static std::string KEY_SLOT_ID = "id"; + +/** + * Indicates that disturbe key which slot group id. + */ +const static std::string KEY_SLOT_GROUPID = "groupId"; + +/** + * Indicates that disturbe key which slot group name. + */ +const static std::string KEY_SLOT_NAME = "name"; + +/** + * Indicates that disturbe key which slot description. + */ +const static std::string KEY_SLOT_DESCRIPTION = "description"; + +/** + * Indicates that disturbe key which slot level. + */ +const static std::string KEY_SLOT_LEVEL = "level"; + +/** + * Indicates that disturbe key which slot show badge. + */ +const static std::string KEY_SLOT_SHOW_BADGE = "showBadge"; + +/** + * Indicates that disturbe key which slot enable light. + */ +const static std::string KEY_SLOT_ENABLE_LIGHT = "enableLight"; + +/** + * Indicates that disturbe key which slot enable vibration. + */ +const static std::string KEY_SLOT_ENABLE_VRBRATION = "enableVibration"; + +/** + * Indicates that disturbe key which slot led light color. + */ +const static std::string KEY_SLOT_LED_LIGHT_COLOR = "ledLightColor"; + +/** + * Indicates that disturbe key which slot lockscreen visibleness. + */ +const static std::string KEY_SLOT_LOCKSCREEN_VISIBLENESS = "lockscreenVisibleness"; + +/** + * Indicates that disturbe key which slot sound. + */ +const static std::string KEY_SLOT_SOUND = "sound"; + +/** + * Indicates that disturbe key which slot vibration style. + */ +const static std::string KEY_SLOT_VIBRATION_STYLE = "vibrationSytle"; + +/** + * Indicates that disturbe key which slot enable bypass end. + */ +const static std::string KEY_SLOT_ENABLE_BYPASS_DND = "enableBypassDnd"; + +/** + * Indicates whether the type of slot is enabled. + */ +const static std::string KEY_SLOT_ENABLED = "enabled"; + const std::map &, std::string &)>> NotificationPreferencesDatabase::slotMap_ = {