diff --git a/ext/input_pin_dialog/dialog_ui/js/pages/index/index.js b/ext/input_pin_dialog/dialog_ui/js/pages/index/index.js index 8a38e6188acbaa66a39bc57603c2a50ec94b7bee..597c288bfb1d48639368461cbc2bb97638ab77c3 100644 --- a/ext/input_pin_dialog/dialog_ui/js/pages/index/index.js +++ b/ext/input_pin_dialog/dialog_ui/js/pages/index/index.js @@ -17,9 +17,13 @@ export default { console.info('pincode: ' + pincode); if (input == pincode){ console.info('pincode: = input'); + console.info('input: ' + input); + console.info('pincode: ' + pincode); callNativeHandler(input, "0"); } else { console.info('pincode: != input'); + console.info('input: ' + input); + console.info('pincode: ' + pincode); //刷新页面,提示输入错误 } } else { diff --git a/ext/pin_auth/include/pin_auth.h b/ext/pin_auth/include/pin_auth.h index b2636e0afdd1ce1906183fe10649debb1a3825ea..dca2e7e7f9e12b4679d778c7d4a9b893f46c129d 100644 --- a/ext/pin_auth/include/pin_auth.h +++ b/ext/pin_auth/include/pin_auth.h @@ -30,7 +30,7 @@ class PinAuth : public IAuthentication { public: PinAuth(); ~PinAuth(); - int32_t ShowAuthInfo(int32_t code) override; + int32_t ShowAuthInfo(int32_t code, std::shared_ptr authManager) override; int32_t StartAuth(int32_t code, std::shared_ptr authManager) override; int32_t VerifyAuthentication(std::string pinToken, int32_t code, const std::string &authParam) override; diff --git a/ext/pin_auth/include/pin_auth_ui.h b/ext/pin_auth/include/pin_auth_ui.h index 61575797f893e15ade0b58883a0820823fbe6fb8..5ff26c3e1634b9bfb1ae370b8349b8c0ebab3ebe 100644 --- a/ext/pin_auth/include/pin_auth_ui.h +++ b/ext/pin_auth/include/pin_auth_ui.h @@ -26,7 +26,7 @@ namespace DistributedHardware { class PinAuthUi { public: PinAuthUi(); - int32_t ShowPinDialog(int32_t code); + int32_t ShowPinDialog(int32_t code, std::shared_ptr authManager); int32_t InputPinDialog(int32_t code, std::shared_ptr authManager); private: diff --git a/ext/pin_auth/src/pin_auth.cpp b/ext/pin_auth/src/pin_auth.cpp index 138abc56fa23141fe5a180e07d6bdeca3b271edd..0bbadd15f7aa503e771432a132e9512f1834eec8 100644 --- a/ext/pin_auth/src/pin_auth.cpp +++ b/ext/pin_auth/src/pin_auth.cpp @@ -33,9 +33,9 @@ PinAuth::~PinAuth() { } -int32_t PinAuth::ShowAuthInfo(int32_t code) +int32_t PinAuth::ShowAuthInfo(int32_t code, std::shared_ptr authManager) { - return pinAuthUi_->ShowPinDialog(code); + return pinAuthUi_->ShowPinDialog(code, authManager); } int32_t PinAuth::StartAuth(int32_t code, std::shared_ptr authManager) diff --git a/ext/pin_auth/src/pin_auth_ui.cpp b/ext/pin_auth/src/pin_auth_ui.cpp index a3cfeefe271caa8d20a610b19cd8124fa35476ff..51f76bdb4ce70a6218f42bd8850ef686cadeea7f 100644 --- a/ext/pin_auth/src/pin_auth_ui.cpp +++ b/ext/pin_auth/src/pin_auth_ui.cpp @@ -28,7 +28,7 @@ PinAuthUi::PinAuthUi() LOGI("AuthUi constructor"); } -int32_t PinAuthUi::ShowPinDialog(int32_t code) +int32_t PinAuthUi::ShowPinDialog(int32_t code, std::shared_ptr authManager) { LOGI("ShowPinDialog start"); nlohmann::json jsonObj; @@ -41,9 +41,14 @@ int32_t PinAuthUi::ShowPinDialog(int32_t code) params, OHOS::Rosen::WindowType::WINDOW_TYPE_SYSTEM_ALARM_WINDOW, ACE_X, ACE_Y, ACE_WIDTH, ACE_HEIGHT, - [](int32_t id, const std::string& event, const std::string& params) { - LOGI("CancelDialog start id:%d,event:%s,parms:%s", id, event.c_str(), params.c_str()); - Ace::UIServiceMgrClient::GetInstance()->CancelDialog(id); + [authManager](int32_t id, const std::string& event, const std::string& params) { + if (strcmp(params.c_str(), "0") == 0) { + authManager->ClosePage(id); + } + if (strcmp(params.c_str(), "1") == 0) { + LOGI("CancelDialog start id:%d,event:%s,parms:%s", id, event.c_str(), params.c_str()); + Ace::UIServiceMgrClient::GetInstance()->CancelDialog(id); + } }); LOGI("ShowConfigDialog end"); return DM_OK; diff --git a/ext/show_pin_dialog/dialog_ui/js/pages/index/index.js b/ext/show_pin_dialog/dialog_ui/js/pages/index/index.js index 114655c3a4d334a82a2e5a2186be08df84bea372..3a55ac1cc8215df26437b036c9f92ec5dbb7568d 100644 --- a/ext/show_pin_dialog/dialog_ui/js/pages/index/index.js +++ b/ext/show_pin_dialog/dialog_ui/js/pages/index/index.js @@ -6,6 +6,7 @@ export default { }, onInit() { console.info('getParams: ' + router.getParams()); + callNativeHandler("EVENT_CONFIRM", "0"); }, onConfirm() { console.info('click confirm'); diff --git a/services/devicemanagerservice/include/authentication/authentication.h b/services/devicemanagerservice/include/authentication/authentication.h index 43c486511f474a6ff795b3554e82bb8a6f4f4665..67ca0c3ee86b1e0fccae4eb20927cda40dc3a829 100644 --- a/services/devicemanagerservice/include/authentication/authentication.h +++ b/services/devicemanagerservice/include/authentication/authentication.h @@ -24,7 +24,7 @@ class DmAuthManager; class IAuthentication { public: virtual ~IAuthentication() = default; - virtual int32_t ShowAuthInfo(int32_t code) = 0; + virtual int32_t ShowAuthInfo(int32_t code, std::shared_ptr authManager) = 0; virtual int32_t StartAuth(int32_t code, std::shared_ptr authManager) = 0; virtual int32_t VerifyAuthentication(std::string pinToken, int32_t code, const std::string &authParam) = 0; }; diff --git a/services/devicemanagerservice/include/authentication/dm_auth_manager.h b/services/devicemanagerservice/include/authentication/dm_auth_manager.h index 6b0298ec907ad3c7c70e83bf738b05e8cb741d5f..a24f9d45d6a58adf253a7b9b9f47d11f882e3b69 100644 --- a/services/devicemanagerservice/include/authentication/dm_auth_manager.h +++ b/services/devicemanagerservice/include/authentication/dm_auth_manager.h @@ -86,6 +86,7 @@ typedef struct DmAuthRequestContext { std::string appThumbnail; std::string token; int32_t reason; + int32_t aceId; std::vector syncGroupList; } DmAuthRequestContext; @@ -112,6 +113,7 @@ typedef struct DmAuthResponseContext { int64_t requestId; int32_t code; int32_t state; + int32_t aceId; std::vector syncGroupList; } DmAuthResponseContext; @@ -162,6 +164,7 @@ public: int32_t GetAuthenticationParam(DmAuthParam &authParam); int32_t OnUserOperation(int32_t action); void UserSwitchEventCallback(void); + void ClosePage(const int32_t &id); private: std::shared_ptr softbusConnector_; diff --git a/services/devicemanagerservice/src/authentication/dm_auth_manager.cpp b/services/devicemanagerservice/src/authentication/dm_auth_manager.cpp index 1e9976f44f3f49ccf3613bbc1dfaa33a1fabfc96..009b3f371e1ac23c18fe3969564ad327e0754a7a 100644 --- a/services/devicemanagerservice/src/authentication/dm_auth_manager.cpp +++ b/services/devicemanagerservice/src/authentication/dm_auth_manager.cpp @@ -547,7 +547,7 @@ void DmAuthManager::AuthenticateFinish() LOGI("DmAuthManager::AuthenticateFinish start"); if (authResponseState_ != nullptr) { if (authResponseState_->GetStateType() == AuthState::AUTH_RESPONSE_FINISH) { - CancelDisplay(); + Ace::UIServiceMgrClient::GetInstance()->CancelDialog(authResponseContext_->aceId); } if (!timerMap_.empty()) { for (auto &iter : timerMap_) { @@ -569,7 +569,7 @@ void DmAuthManager::AuthenticateFinish() } if (authResponseContext_->state == AuthState::AUTH_REQUEST_INPUT) { - CancelDisplay(); + Ace::UIServiceMgrClient::GetInstance()->CancelDialog(authResponseContext_->aceId); } listener_->OnAuthResult(authRequestContext_->hostPkgName, authRequestContext_->deviceId, @@ -688,7 +688,7 @@ void DmAuthManager::ShowAuthInfoDialog() } ptr = authenticationMap_[1]; LOGI("ShowAuthInfoDialog code:%d", authResponseContext_->code); - ptr->ShowAuthInfo(authResponseContext_->code); + ptr->ShowAuthInfo(authResponseContext_->code, shared_from_this()); } void DmAuthManager::ShowStartAuthDialog() @@ -785,5 +785,10 @@ void DmAuthManager::VerifyPinAuthAuthentication(const std::string &action) } LOGI("DmAuthManager::VerifyAuthentication complete"); } + +void DmAuthManager::ClosePage(const int32_t &id) +{ + authResponseContext_->aceId = id; +} } // namespace DistributedHardware } // namespace OHOS