diff --git a/frameworks/js/napi/src/subscribe.cpp b/frameworks/js/napi/src/subscribe.cpp index dfe646ee1b87aceb9c9d22d588720599dc301761..c3d9eef18fddadd8e79809ca04d1071e18d4341f 100644 --- a/frameworks/js/napi/src/subscribe.cpp +++ b/frameworks/js/napi/src/subscribe.cpp @@ -101,8 +101,8 @@ napi_value SetSubscribeCallbackData(const napi_env &env, // vibrationValues?: Array napi_value arr = nullptr; napi_create_array(env, &arr); - uint32_t count = 0; if (request->EnableVibrate()) { + uint32_t count = 0; for (auto vec : request->GetVibrationStyle()) { napi_value nVibrationValue = nullptr; napi_create_int64(env, vec, &nVibrationValue); diff --git a/services/ans/src/advanced_notification_service.cpp b/services/ans/src/advanced_notification_service.cpp index c6d9f465d54b8c469d4cd6f3813acfa71f661c66..0fc79793df4974d20fe4b8bc91bcaf049b2d5438 100644 --- a/services/ans/src/advanced_notification_service.cpp +++ b/services/ans/src/advanced_notification_service.cpp @@ -3687,7 +3687,7 @@ void AdvancedNotificationService::SendSubscribeHiSysEvent(int32_t pid, int32_t u eventInfo.userId = info->GetAppUserId(); std::vector appNames = info->GetAppNames(); eventInfo.bundleName = std::accumulate(appNames.begin(), appNames.end(), std::string(""), - [appNames](const std::string bundleName, const std::string &str) { + [appNames](const std::string &bundleName, const std::string &str) { return (str == appNames.front()) ? (bundleName + str) : (bundleName + "," + str); }); } @@ -3710,7 +3710,7 @@ void AdvancedNotificationService::SendUnSubscribeHiSysEvent(int32_t pid, int32_t eventInfo.userId = info->GetAppUserId(); std::vector appNames = info->GetAppNames(); eventInfo.bundleName = std::accumulate(appNames.begin(), appNames.end(), std::string(""), - [appNames](const std::string bundleName, const std::string &str) { + [appNames](const std::string &bundleName, const std::string &str) { return (str == appNames.front()) ? (bundleName + str) : (bundleName + "," + str); }); } diff --git a/tools/dump/src/notification_shell_command.cpp b/tools/dump/src/notification_shell_command.cpp index 0906e4684375359167dbf75cd086f383e234fccb..1d4b04f71e30f1beeadfbc67a961bb49344c0f5f 100644 --- a/tools/dump/src/notification_shell_command.cpp +++ b/tools/dump/src/notification_shell_command.cpp @@ -244,7 +244,6 @@ void NotificationShellCommand::CheckDumpOpt() ErrCode NotificationShellCommand::RunAsSettingCommand() { - std::vector infos; int option = getopt_long(argc_, argv_, SETTING_SHORT_OPTIONS, SETTING_LONG_OPTIONS, nullptr); if (option == '?') { if (optopt == 'c') { @@ -264,6 +263,7 @@ ErrCode NotificationShellCommand::RunAsSettingCommand() resultReceiver_.append(SETTING_HELP_MSG); return ERR_INVALID_VALUE; } + std::vector infos; std::string cmd = COMMAND_SET_RECENT_COUNT; cmd.append(" ").append(std::string(optarg)); return RunDumpCmd(cmd, "", SUBSCRIBE_USER_INIT, infos);