From 30567c1c048e64f267ede83c9be7469277c8c997 Mon Sep 17 00:00:00 2001 From: t00605578 Date: Mon, 19 Aug 2024 11:30:08 +0800 Subject: [PATCH] add all connect user prompt language Signed-off-by: t00605578 --- .../distributed_mission_manager.cpp | 36 ++++--------- .../distributed_mission_manager.h | 51 ++++++++++++++++--- 2 files changed, 53 insertions(+), 34 deletions(-) diff --git a/frameworks/js/napi/mission_manager/distributed_mission_manager.cpp b/frameworks/js/napi/mission_manager/distributed_mission_manager.cpp index 6ffb62340d..484f346665 100644 --- a/frameworks/js/napi/mission_manager/distributed_mission_manager.cpp +++ b/frameworks/js/napi/mission_manager/distributed_mission_manager.cpp @@ -101,11 +101,20 @@ static std::string ErrorMessageReturn(int32_t code) case OPERATION_DEVICE_NOT_INITIATOR_OR_TARGET: return std::string("The operation device must be the device where the " "application to be continued is currently located or the target device."); + case ERR_CONTINUE_ALREADY_IN_PROGRESS: case CONTINUE_ALREADY_IN_PROGRESS: return std::string("the local continuation task is already in progress."); case MISSION_FOR_CONTINUING_IS_NOT_ALIVE: return std::string("the mission for continuing is not alive, " "try again after restart this mission."); + case ERR_GET_MISSION_INFO_OF_BUNDLE_NAME: + return std::string("Failed to get the missionInfo of the specified bundle name."); + case ERR_BIND_REMOTE_HOTSPOT_ENABLE_STATE: + return std::string("bind error due to the remote device hotspot enable, try again after disable " + "the remote device hotspot."); + case ERR_BIND_REMOTE_IN_BUSY_LINK: + return std::string("the remote device has been linked with other devices, try again when " + "the remote device is idle."); default: return std::string("the system ability work abnormally."); }; @@ -965,11 +974,6 @@ napi_value NAPI_ContinueState(napi_env env) return continueState; } -void NAPIMissionContinue::SetEnv(const napi_env &env) -{ - env_ = env; -} - NAPIRemoteMissionListener::~NAPIRemoteMissionListener() { if (env_ == nullptr) { @@ -989,8 +993,6 @@ NAPIRemoteMissionListener::~NAPIRemoteMissionListener() } } -NAPIRemoteOnListener::~NAPIRemoteOnListener() {} - void NAPIRemoteMissionListener::SetEnv(const napi_env &env) { env_ = env; @@ -2133,26 +2135,6 @@ void NAPIMissionContinue::OnContinueDone(int32_t result) TAG_LOGI(AAFwkTag::MISSION, "end"); } -void NAPIMissionContinue::SetContinueAbilityEnv(const napi_env &env) -{ - env_ = env; -} - -void NAPIMissionContinue::SetContinueAbilityCBRef(const napi_ref &ref) -{ - onContinueDoneRef_ = ref; -} - -void NAPIMissionContinue::SetContinueAbilityHasBundleName(bool hasBundleName) -{ - onContinueDoneHasBundleName_ = hasBundleName; -} - -void NAPIMissionContinue::SetContinueAbilityPromiseRef(const napi_deferred &promiseDeferred) -{ - promiseDeferred_ = promiseDeferred; -} - napi_value DistributedMissionManagerExport(napi_env env, napi_value exports) { TAG_LOGI(AAFwkTag::MISSION, "called"); diff --git a/frameworks/js/napi/mission_manager/distributed_mission_manager.h b/frameworks/js/napi/mission_manager/distributed_mission_manager.h index 326428df0f..dc27541829 100644 --- a/frameworks/js/napi/mission_manager/distributed_mission_manager.h +++ b/frameworks/js/napi/mission_manager/distributed_mission_manager.h @@ -46,12 +46,31 @@ napi_value CreateInt32(napi_env &env, int32_t num, const std::string ¶mName) class NAPIMissionContinue : public MissionContinueStub { public: void OnContinueDone(int32_t result) override; - void SetContinueEnv(const napi_env &env); - void SetEnv(const napi_env &env); - void SetContinueAbilityEnv(const napi_env &env); - void SetContinueAbilityCBRef(const napi_ref &ref); - void SetContinueAbilityHasBundleName(bool hasBundleName); - void SetContinueAbilityPromiseRef(const napi_deferred &promiseDeferred); + + void SetEnv(const napi_env &env) + { + env_ = env; + } + + void SetContinueAbilityEnv(const napi_env &env) + { + env_ = env; + } + + void SetContinueAbilityCBRef(const napi_ref &ref) + { + onContinueDoneRef_ = ref; + } + + void SetContinueAbilityHasBundleName(bool hasBundleName) + { + onContinueDoneHasBundleName_ = hasBundleName; + } + + void SetContinueAbilityPromiseRef(const napi_deferred &promiseDeferred) + { + promiseDeferred_ = promiseDeferred; + } private: bool onContinueDoneHasBundleName_ = false; @@ -81,7 +100,7 @@ private: class NAPIRemoteOnListener : public AAFwk::RemoteOnListenerStub { public: - virtual ~NAPIRemoteOnListener(); + virtual ~NAPIRemoteOnListener() {}; void OnCallback(const uint32_t continueState, const std::string &srcDeviceId, const std::string &bundleName, const std::string &continueType = "", @@ -229,6 +248,24 @@ enum ErrorCode { * supported, try again with freeInstall flag. */ CONTINUE_WITHOUT_FREEINSTALL_FLAG = 16300504, + /** + * Result(16300506) throw to js for the local continuation task is already in progress. + */ + ERR_CONTINUE_ALREADY_IN_PROGRESS = 16300506, + /** + * Result(16300507) throw to js for Failed to get the missionInfo of the specified bundle name. + */ + ERR_GET_MISSION_INFO_OF_BUNDLE_NAME = 16300507, + /** + * Result(16300508) throw to js for bind error due to the remote device hotspot enable, try again after disable + * the remote device hotspot. + */ + ERR_BIND_REMOTE_HOTSPOT_ENABLE_STATE = 16300508, + /** + * Result(16300509) throw to js for the remote device has been linked with other devices, try again when + * the remote device is idle. + */ + ERR_BIND_REMOTE_IN_BUSY_LINK = 16300509, /** * Result(29360222) for the operation device must be the device where the application to be continued * is located or the target device to be continued.