diff --git a/frameworks/ans/native/src/notification_slot.cpp b/frameworks/ans/native/src/notification_slot.cpp index 3ff67a5aa076fe586489cf65d7b7ec870c5f094c..a54224d445285c056ed89c3ae28a7350e5306f7b 100644 --- a/frameworks/ans/native/src/notification_slot.cpp +++ b/frameworks/ans/native/src/notification_slot.cpp @@ -14,8 +14,8 @@ */ #include "notification_slot.h" -#include "ans_log_wrapper.h" #include "ans_const_define.h" +#include "ans_log_wrapper.h" namespace OHOS { namespace Notification { diff --git a/frameworks/ans/test/moduletest/ans_fw_module_test.cpp b/frameworks/ans/test/moduletest/ans_fw_module_test.cpp index b9db0989a1fe075b404dc48474155ecb5b302af3..9b2b77064a9fdd8b002e193cd2ed56fc6b9cf057 100644 --- a/frameworks/ans/test/moduletest/ans_fw_module_test.cpp +++ b/frameworks/ans/test/moduletest/ans_fw_module_test.cpp @@ -464,7 +464,7 @@ public: return onCanceledWithSortingMapSor_; } - std::vector GetOnCanceledWithSortingMapDelRea() + std::vector GetOnCanceledWithSortingMapDelRea() const { return onCanceledWithSortingMapDelRea_; } diff --git a/frameworks/ans/test/moduletest/ans_innerkits_module_slot_test.cpp b/frameworks/ans/test/moduletest/ans_innerkits_module_slot_test.cpp index 91ab5d60ceca7edb086af6ba1c6ba31ec2843922..caef96a20b5bd4d49f18a39dc6965fc63069ecaa 100644 --- a/frameworks/ans/test/moduletest/ans_innerkits_module_slot_test.cpp +++ b/frameworks/ans/test/moduletest/ans_innerkits_module_slot_test.cpp @@ -15,15 +15,15 @@ #include #include +#include "advanced_notification_service.h" #include "ans_const_define.h" #include "ans_inner_errors.h" #include "ans_manager_proxy.h" -#include "advanced_notification_service.h" #include "if_system_ability_manager.h" #include "iservice_registry.h" -#include "notification_helper.h" #include "mock_bundle_manager.h" #include "mock_ipc_skeleton.h" +#include "notification_helper.h" #include "system_ability_definition.h" using namespace testing::ext; @@ -363,7 +363,7 @@ HWTEST_F(AnsInterfaceModuleSlotTest, ANS_Interface_MT_NotificationSlot_00800, Fu EXPECT_EQ(NotificationConstant::VisiblenessType::SECRET, slot.GetLockScreenVisibleness()); EXPECT_EQ("", slot.GetSound().ToString()); EXPECT_FALSE(slot.CanVibrate()); - EXPECT_EQ(0, slot.GetVibrationStyle().size()); + EXPECT_EQ(0U, slot.GetVibrationStyle().size()); EXPECT_EQ(NotificationSlot::NotificationLevel::LEVEL_LOW, slot.GetLevel()); } @@ -380,7 +380,7 @@ HWTEST_F(AnsInterfaceModuleSlotTest, ANS_Interface_MT_NotificationSlot_00900, Fu EXPECT_EQ(NotificationConstant::VisiblenessType::SECRET, slot.GetLockScreenVisibleness()); EXPECT_EQ("", slot.GetSound().ToString()); EXPECT_FALSE(slot.CanVibrate()); - EXPECT_EQ(0, slot.GetVibrationStyle().size()); + EXPECT_EQ(0U, slot.GetVibrationStyle().size()); EXPECT_EQ(NotificationSlot::NotificationLevel::LEVEL_MIN, slot.GetLevel()); } diff --git a/interfaces/kits/napi/ans/src/cancel.cpp b/interfaces/kits/napi/ans/src/cancel.cpp index 3edad374cdd696399dc61f060ec73c866f6a9249..0ba7a4461ef82bc3778b57b7c09e77591c6fc485 100644 --- a/interfaces/kits/napi/ans/src/cancel.cpp +++ b/interfaces/kits/napi/ans/src/cancel.cpp @@ -17,9 +17,7 @@ namespace OHOS { namespace NotificationNapi { - const int CANCEL_MAX_PARA = 3; -const int CANCEL_ALL_MAX_PARA = 1; const int CANCEL_GROUP_MAX_PARA = 2; const int CANCEL_GROUP_MIN_PARA = 1; @@ -91,25 +89,6 @@ napi_value ParseParameters(const napi_env &env, const napi_callback_info &info, return Common::NapiGetNull(env); } -napi_value ParseParameters(const napi_env &env, const napi_callback_info &info, napi_ref &callback) -{ - ANS_LOGI("enter"); - - size_t argc = CANCEL_ALL_MAX_PARA; - napi_value argv[CANCEL_ALL_MAX_PARA] = {nullptr}; - napi_value thisVar = nullptr; - NAPI_CALL(env, napi_get_cb_info(env, info, &argc, argv, &thisVar, NULL)); - - if (argc >= CANCEL_ALL_MAX_PARA) { - napi_valuetype valuetype = napi_undefined; - // argv[0]:callback - NAPI_CALL(env, napi_typeof(env, argv[0], &valuetype)); - NAPI_ASSERT(env, valuetype == napi_function, "Wrong argument type. Function expected."); - napi_create_reference(env, argv[0], 1, &callback); - } - return Common::NapiGetNull(env); -} - napi_value ParseParameters(const napi_env &env, const napi_callback_info &info, ParametersInfoCancelGroup ¶s) { ANS_LOGI("enter"); @@ -202,7 +181,7 @@ napi_value CancelAll(napi_env env, napi_callback_info info) ANS_LOGI("enter"); napi_ref callback = nullptr; - if (ParseParameters(env, info, callback) == nullptr) { + if (Common::ParseParaOnlyCallback(env, info, callback) == nullptr) { return Common::NapiGetUndefined(env); } @@ -257,7 +236,7 @@ napi_value CancelGroup(napi_env env, napi_callback_info info) { ANS_LOGI("enter"); - ParametersInfoCancelGroup params; + ParametersInfoCancelGroup params {}; if (ParseParameters(env, info, params) == nullptr) { return Common::NapiGetUndefined(env); } diff --git a/interfaces/kits/napi/ans/src/get_active.cpp b/interfaces/kits/napi/ans/src/get_active.cpp index c424913327036a505782518472a41873d6b89c78..f924d7f8fab40f1f46069a824d92fb8a447a2b96 100644 --- a/interfaces/kits/napi/ans/src/get_active.cpp +++ b/interfaces/kits/napi/ans/src/get_active.cpp @@ -17,9 +17,6 @@ namespace OHOS { namespace NotificationNapi { -const int ALL_ACTIVE_MAX_PARA = 1; -const int ACTIVE_OR_NUMS_MAX_PARA = 1; - struct AsyncCallbackInfoActive { napi_env env = nullptr; napi_async_work asyncWork = nullptr; @@ -29,46 +26,6 @@ struct AsyncCallbackInfoActive { int32_t num = 0; }; -napi_value ParseParametersByAllActive(const napi_env &env, const napi_callback_info &info, napi_ref &callback) -{ - ANS_LOGI("enter"); - - size_t argc = ALL_ACTIVE_MAX_PARA; - napi_value argv[ALL_ACTIVE_MAX_PARA] = {nullptr}; - napi_value thisVar = nullptr; - NAPI_CALL(env, napi_get_cb_info(env, info, &argc, argv, &thisVar, NULL)); - - if (argc >= ALL_ACTIVE_MAX_PARA) { - napi_valuetype valuetype = napi_undefined; - // argv[0]:callback - NAPI_CALL(env, napi_typeof(env, argv[0], &valuetype)); - NAPI_ASSERT(env, valuetype == napi_function, "Wrong argument type. Function expected."); - napi_create_reference(env, argv[0], 1, &callback); - } - - return Common::NapiGetNull(env); -} - -napi_value ParseParametersByGetActive(const napi_env &env, const napi_callback_info &info, napi_ref &callback) -{ - ANS_LOGI("enter"); - - size_t argc = ACTIVE_OR_NUMS_MAX_PARA; - napi_value argv[ACTIVE_OR_NUMS_MAX_PARA] = {nullptr}; - napi_value thisVar = nullptr; - NAPI_CALL(env, napi_get_cb_info(env, info, &argc, argv, &thisVar, NULL)); - - if (argc >= ACTIVE_OR_NUMS_MAX_PARA) { - napi_valuetype valuetype = napi_undefined; - // argv[0]:callback - NAPI_CALL(env, napi_typeof(env, argv[0], &valuetype)); - NAPI_ASSERT(env, valuetype == napi_function, "Wrong argument type. Function expected."); - napi_create_reference(env, argv[0], 1, &callback); - } - - return Common::NapiGetNull(env); -} - void AsyncCompleteCallbackGetAllActiveNotifications(napi_env env, napi_status status, void *data) { ANS_LOGI("GetAllActiveNotifications napi_create_async_work end"); @@ -78,7 +35,7 @@ void AsyncCompleteCallbackGetAllActiveNotifications(napi_env env, napi_status st return; } - AsyncCallbackInfoActive *asynccallbackinfo = (AsyncCallbackInfoActive *)data; + auto asynccallbackinfo = (AsyncCallbackInfoActive *)data; napi_value result = nullptr; if (asynccallbackinfo->info.errorCode != ERR_OK) { result = Common::NapiGetNull(env); @@ -126,7 +83,7 @@ napi_value GetAllActiveNotifications(napi_env env, napi_callback_info info) ANS_LOGI("enter"); napi_ref callback = nullptr; - if (ParseParametersByAllActive(env, info, callback) == nullptr) { + if (Common::ParseParaOnlyCallback(env, info, callback) == nullptr) { return Common::NapiGetUndefined(env); } @@ -147,7 +104,7 @@ napi_value GetAllActiveNotifications(napi_env env, napi_callback_info info) resourceName, [](napi_env env, void *data) { ANS_LOGI("GetAllActiveNotifications napi_create_async_work start"); - AsyncCallbackInfoActive *asynccallbackinfo = (AsyncCallbackInfoActive *)data; + auto asynccallbackinfo = (AsyncCallbackInfoActive *)data; asynccallbackinfo->info.errorCode = NotificationHelper::GetAllActiveNotifications(asynccallbackinfo->notifications); @@ -174,7 +131,7 @@ void AsyncCompleteCallbackGetActiveNotifications(napi_env env, napi_status statu return; } - AsyncCallbackInfoActive *asynccallbackinfo = (AsyncCallbackInfoActive *)data; + auto asynccallbackinfo = (AsyncCallbackInfoActive *)data; napi_value result = nullptr; if (asynccallbackinfo->info.errorCode != ERR_OK) { result = Common::NapiGetNull(env); @@ -221,7 +178,7 @@ napi_value GetActiveNotifications(napi_env env, napi_callback_info info) ANS_LOGI("enter"); napi_ref callback = nullptr; - if (ParseParametersByGetActive(env, info, callback) == nullptr) { + if (Common::ParseParaOnlyCallback(env, info, callback) == nullptr) { return Common::NapiGetUndefined(env); } @@ -242,7 +199,7 @@ napi_value GetActiveNotifications(napi_env env, napi_callback_info info) resourceName, [](napi_env env, void *data) { ANS_LOGI("GetActiveNotifications napi_create_async_work start"); - AsyncCallbackInfoActive *asynccallbackinfo = (AsyncCallbackInfoActive *)data; + auto asynccallbackinfo = (AsyncCallbackInfoActive *)data; asynccallbackinfo->info.errorCode = NotificationHelper::GetActiveNotifications(asynccallbackinfo->requests); @@ -269,7 +226,7 @@ void AsyncCompleteCallbackGetActiveNotificationCount(napi_env env, napi_status s return; } - AsyncCallbackInfoActive *asynccallbackinfo = (AsyncCallbackInfoActive *)data; + auto asynccallbackinfo = (AsyncCallbackInfoActive *)data; napi_value result = nullptr; if (asynccallbackinfo->info.errorCode != ERR_OK) { result = Common::NapiGetNull(env); @@ -295,7 +252,7 @@ napi_value GetActiveNotificationCount(napi_env env, napi_callback_info info) ANS_LOGI("enter"); napi_ref callback = nullptr; - if (ParseParametersByGetActive(env, info, callback) == nullptr) { + if (Common::ParseParaOnlyCallback(env, info, callback) == nullptr) { return Common::NapiGetUndefined(env); } @@ -316,7 +273,7 @@ napi_value GetActiveNotificationCount(napi_env env, napi_callback_info info) resourceName, [](napi_env env, void *data) { ANS_LOGI("GetActiveNotificationCount napi_create_async_work start"); - AsyncCallbackInfoActive *asynccallbackinfo = (AsyncCallbackInfoActive *)data; + auto asynccallbackinfo = (AsyncCallbackInfoActive *)data; asynccallbackinfo->info.errorCode = NotificationHelper::GetActiveNotificationNums(asynccallbackinfo->num); ANS_LOGI("GetActiveNotificationCount count = %{public}d", asynccallbackinfo->num); diff --git a/interfaces/kits/napi/ans/src/slot.cpp b/interfaces/kits/napi/ans/src/slot.cpp index 4590c92ee27caa823d333eaee768b71750995188..faa723f516217330d13a1622121faf4eebd69af3 100644 --- a/interfaces/kits/napi/ans/src/slot.cpp +++ b/interfaces/kits/napi/ans/src/slot.cpp @@ -22,10 +22,8 @@ const int ADD_SLOTS_MAX_PARA = 2; const int SET_SLOT_AS_BUNDLE_MAX_PARA = 3; const int GET_SLOT_MAX_PARA = 2; const int GET_SLOT_NUM_AS_BUNDLE_MAX_PARA = 2; -const int GET_SLOTS_MAX_PARA = 1; const int GET_SLOTS_AS_BUNDLE_MAX_PARA = 2; const int REMOVE_SLOT_MAX_PARA = 2; -const int REMOVE_ALL_SLOTS_MAX_PARA = 1; struct ParametersInfoAddSlot { NotificationSlot slot; @@ -316,24 +314,6 @@ napi_value ParseParametersGetSlotNumByBundle( return Common::NapiGetNull(env); } -napi_value ParseParametersByGetSlots(const napi_env &env, const napi_callback_info &info, napi_ref &callback) -{ - ANS_LOGI("enter"); - size_t argc = GET_SLOTS_MAX_PARA; - napi_value argv[GET_SLOTS_MAX_PARA] = {nullptr}; - napi_value thisVar = nullptr; - NAPI_CALL(env, napi_get_cb_info(env, info, &argc, argv, &thisVar, NULL)); - - // argv[0]:callback - napi_valuetype valuetype = napi_undefined; - if (argc >= GET_SLOTS_MAX_PARA) { - NAPI_CALL(env, napi_typeof(env, argv[0], &valuetype)); - NAPI_ASSERT(env, valuetype == napi_function, "Wrong argument type. Function expected."); - napi_create_reference(env, argv[0], 1, &callback); - } - return Common::NapiGetNull(env); -} - napi_value ParseParametersGetSlotsByBundle( const napi_env &env, const napi_callback_info &info, ParametersInfoGetSlotsByBundle ¶ms) { @@ -394,24 +374,6 @@ napi_value ParseParametersByRemoveSlot( return Common::NapiGetNull(env); } -napi_value ParseParametersByRemoveAllSlots(const napi_env &env, const napi_callback_info &info, napi_ref &callback) -{ - ANS_LOGI("enter"); - size_t argc = REMOVE_ALL_SLOTS_MAX_PARA; - napi_value argv[REMOVE_ALL_SLOTS_MAX_PARA] = {nullptr}; - napi_value thisVar = nullptr; - NAPI_CALL(env, napi_get_cb_info(env, info, &argc, argv, &thisVar, NULL)); - - if (argc >= REMOVE_ALL_SLOTS_MAX_PARA) { - napi_valuetype valuetype = napi_undefined; - // argv[0]:callback - NAPI_CALL(env, napi_typeof(env, argv[0], &valuetype)); - NAPI_ASSERT(env, valuetype == napi_function, "Wrong argument type. Function expected."); - napi_create_reference(env, argv[0], 1, &callback); - } - return Common::NapiGetNull(env); -} - napi_value AddSlot(napi_env env, napi_callback_info info) { ANS_LOGI("enter"); @@ -442,7 +404,7 @@ napi_value AddSlot(napi_env env, napi_callback_info info) resourceName, [](napi_env env, void *data) { ANS_LOGI("AddSlot napi_create_async_work start"); - AsyncCallbackInfoAddSlot *asynccallbackinfo = (AsyncCallbackInfoAddSlot *)data; + auto asynccallbackinfo = (AsyncCallbackInfoAddSlot *)data; if (asynccallbackinfo->isAddSlotByType) { asynccallbackinfo->info.errorCode = NotificationHelper::AddSlotByType(asynccallbackinfo->inType); } else { @@ -451,7 +413,7 @@ napi_value AddSlot(napi_env env, napi_callback_info info) }, [](napi_env env, napi_status status, void *data) { ANS_LOGI("AddSlot napi_create_async_work end"); - AsyncCallbackInfoAddSlot *asynccallbackinfo = (AsyncCallbackInfoAddSlot *)data; + auto asynccallbackinfo = (AsyncCallbackInfoAddSlot *)data; Common::ReturnCallbackPromise(env, asynccallbackinfo->info, Common::NapiGetNull(env)); @@ -502,12 +464,12 @@ napi_value AddSlots(napi_env env, napi_callback_info info) resourceName, [](napi_env env, void *data) { ANS_LOGI("AddSlots napi_create_async_work start"); - AsyncCallbackInfoAddSlots *asynccallbackinfo = (AsyncCallbackInfoAddSlots *)data; + auto asynccallbackinfo = (AsyncCallbackInfoAddSlots *)data; asynccallbackinfo->info.errorCode = NotificationHelper::AddNotificationSlots(asynccallbackinfo->slots); }, [](napi_env env, napi_status status, void *data) { ANS_LOGI("AddSlots napi_create_async_work end"); - AsyncCallbackInfoAddSlots *asynccallbackinfo = (AsyncCallbackInfoAddSlots *)data; + auto asynccallbackinfo = (AsyncCallbackInfoAddSlots *)data; Common::ReturnCallbackPromise(env, asynccallbackinfo->info, Common::NapiGetNull(env)); @@ -558,7 +520,7 @@ napi_value SetSlotByBundle(napi_env env, napi_callback_info info) resourceName, [](napi_env env, void *data) { ANS_LOGI("SetSlotByBundle napi_create_async_work start"); - AsyncCallbackInfoSetSlotByBundle *asynccallbackinfo = (AsyncCallbackInfoSetSlotByBundle *)data; + auto asynccallbackinfo = (AsyncCallbackInfoSetSlotByBundle *)data; NotificationBundleOption bundleOption; bundleOption.SetBundleName(asynccallbackinfo->params.option.bundle); @@ -568,7 +530,7 @@ napi_value SetSlotByBundle(napi_env env, napi_callback_info info) }, [](napi_env env, napi_status status, void *data) { ANS_LOGI("SetSlotByBundle napi_create_async_work end"); - AsyncCallbackInfoSetSlotByBundle *asynccallbackinfo = (AsyncCallbackInfoSetSlotByBundle *)data; + auto asynccallbackinfo = (AsyncCallbackInfoSetSlotByBundle *)data; Common::ReturnCallbackPromise(env, asynccallbackinfo->info, Common::NapiGetNull(env)); @@ -604,7 +566,7 @@ void AsyncCompleteCallbackGetSlot(napi_env env, napi_status status, void *data) return; } - AsyncCallbackInfoGetSlot *asynccallbackinfo = (AsyncCallbackInfoGetSlot *)data; + auto asynccallbackinfo = (AsyncCallbackInfoGetSlot *)data; napi_value result = Common::NapiGetNull(env); if (asynccallbackinfo->info.errorCode == ERR_OK) { if (asynccallbackinfo->slot == nullptr) { @@ -655,7 +617,7 @@ napi_value GetSlot(napi_env env, napi_callback_info info) resourceName, [](napi_env env, void *data) { ANS_LOGI("GetSlot napi_create_async_work start"); - AsyncCallbackInfoGetSlot *asynccallbackinfo = (AsyncCallbackInfoGetSlot *)data; + auto asynccallbackinfo = (AsyncCallbackInfoGetSlot *)data; asynccallbackinfo->info.errorCode = NotificationHelper::GetNotificationSlot(asynccallbackinfo->outType, asynccallbackinfo->slot); @@ -698,18 +660,17 @@ napi_value GetSlotNumByBundle(napi_env env, napi_callback_info info) resourceName, [](napi_env env, void *data) { ANS_LOGI("GetSlotNumByBundle napi_create_async_work start"); - AsyncCallbackInfoGetSlotNumByBundle *asynccallbackinfo = (AsyncCallbackInfoGetSlotNumByBundle *)data; + auto asynccallbackinfo = (AsyncCallbackInfoGetSlotNumByBundle *)data; NotificationBundleOption bundleOption; bundleOption.SetBundleName(asynccallbackinfo->params.option.bundle); bundleOption.SetUid(asynccallbackinfo->params.option.uid); asynccallbackinfo->info.errorCode = NotificationHelper::GetNotificationSlotNumAsBundle(bundleOption, asynccallbackinfo->num); - }, [](napi_env env, napi_status status, void *data) { ANS_LOGI("GetSlotNumByBundle napi_create_async_work end"); - AsyncCallbackInfoGetSlotNumByBundle *asynccallbackinfo = (AsyncCallbackInfoGetSlotNumByBundle *)data; + auto asynccallbackinfo = (AsyncCallbackInfoGetSlotNumByBundle *)data; napi_value result = nullptr; napi_create_int32(env, asynccallbackinfo->num, &result); Common::ReturnCallbackPromise(env, asynccallbackinfo->info, result); @@ -741,7 +702,7 @@ napi_value GetSlots(napi_env env, napi_callback_info info) ANS_LOGI("enter"); napi_ref callback = nullptr; - if (ParseParametersByGetSlots(env, info, callback) == nullptr) { + if (Common::ParseParaOnlyCallback(env, info, callback) == nullptr) { return Common::NapiGetUndefined(env); } @@ -761,12 +722,12 @@ napi_value GetSlots(napi_env env, napi_callback_info info) resourceName, [](napi_env env, void *data) { ANS_LOGI("GetSlots napi_create_async_work start"); - AsyncCallbackInfoGetSlots *asynccallbackinfo = (AsyncCallbackInfoGetSlots *)data; + auto asynccallbackinfo = (AsyncCallbackInfoGetSlots *)data; asynccallbackinfo->info.errorCode = NotificationHelper::GetNotificationSlots(asynccallbackinfo->slots); }, [](napi_env env, napi_status status, void *data) { ANS_LOGI("GetSlots napi_create_async_work end"); - AsyncCallbackInfoGetSlots *asynccallbackinfo = (AsyncCallbackInfoGetSlots *)data; + auto asynccallbackinfo = (AsyncCallbackInfoGetSlots *)data; napi_value result = nullptr; if (asynccallbackinfo->info.errorCode != ERR_OK) { result = Common::NapiGetNull(env); @@ -843,7 +804,7 @@ napi_value GetSlotsByBundle(napi_env env, napi_callback_info info) resourceName, [](napi_env env, void *data) { ANS_LOGI("GetSlotsByBundle napi_create_async_work start"); - AsyncCallbackInfoGetSlotsByBundle *asynccallbackinfo = (AsyncCallbackInfoGetSlotsByBundle *)data; + auto asynccallbackinfo = (AsyncCallbackInfoGetSlotsByBundle *)data; NotificationBundleOption bundleOption; bundleOption.SetBundleName(asynccallbackinfo->params.option.bundle); @@ -853,7 +814,7 @@ napi_value GetSlotsByBundle(napi_env env, napi_callback_info info) }, [](napi_env env, napi_status status, void *data) { ANS_LOGI("GetSlotsByBundle napi_create_async_work end"); - AsyncCallbackInfoGetSlotsByBundle *asynccallbackinfo = (AsyncCallbackInfoGetSlotsByBundle *)data; + auto asynccallbackinfo = (AsyncCallbackInfoGetSlotsByBundle *)data; napi_value result = nullptr; if (asynccallbackinfo->info.errorCode != ERR_OK) { @@ -931,12 +892,12 @@ napi_value RemoveSlot(napi_env env, napi_callback_info info) resourceName, [](napi_env env, void *data) { ANS_LOGI("removeSlot napi_create_async_work start"); - AsyncCallbackInfoRemoveSlot *asynccallbackinfo = (AsyncCallbackInfoRemoveSlot *)data; + auto asynccallbackinfo = (AsyncCallbackInfoRemoveSlot *)data; asynccallbackinfo->info.errorCode = NotificationHelper::RemoveNotificationSlot(asynccallbackinfo->outType); }, [](napi_env env, napi_status status, void *data) { ANS_LOGI("removeSlot napi_create_async_work end"); - AsyncCallbackInfoRemoveSlot *asynccallbackinfo = (AsyncCallbackInfoRemoveSlot *)data; + auto asynccallbackinfo = (AsyncCallbackInfoRemoveSlot *)data; Common::ReturnCallbackPromise(env, asynccallbackinfo->info, Common::NapiGetNull(env)); @@ -967,7 +928,7 @@ napi_value RemoveAllSlots(napi_env env, napi_callback_info info) ANS_LOGI("enter"); napi_ref callback = nullptr; - if (ParseParametersByRemoveAllSlots(env, info, callback) == nullptr) { + if (Common::ParseParaOnlyCallback(env, info, callback) == nullptr) { return Common::NapiGetUndefined(env); } @@ -987,12 +948,12 @@ napi_value RemoveAllSlots(napi_env env, napi_callback_info info) resourceName, [](napi_env env, void *data) { ANS_LOGI("RemoveAllSlots napi_create_async_work start"); - AsyncCallbackInfoRemoveAllSlots *asynccallbackinfo = (AsyncCallbackInfoRemoveAllSlots *)data; + auto asynccallbackinfo = (AsyncCallbackInfoRemoveAllSlots *)data; asynccallbackinfo->info.errorCode = NotificationHelper::RemoveAllSlots(); }, [](napi_env env, napi_status status, void *data) { ANS_LOGI("RemoveAllSlots napi_create_async_work end"); - AsyncCallbackInfoRemoveAllSlots *asynccallbackinfo = (AsyncCallbackInfoRemoveAllSlots *)data; + auto asynccallbackinfo = (AsyncCallbackInfoRemoveAllSlots *)data; Common::ReturnCallbackPromise(env, asynccallbackinfo->info, Common::NapiGetNull(env));