From a627395f15a569d867a6fee3ec9f8116c89d1632 Mon Sep 17 00:00:00 2001 From: lcaidm Date: Thu, 27 Jan 2022 18:16:53 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=A0=B7=E5=BC=8F=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=EF=BC=8C=E9=A1=B5=E9=9D=A2=E5=85=B3=E9=97=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: lcaidm --- .../dialog_ui/js/pages/index/index.css | 22 ++++++------ common/include/dm_constants.h | 6 ++-- .../dialog_ui/js/pages/index/index.css | 35 ++++++++++--------- .../dialog_ui/js/pages/index/index.hml | 4 +-- ext/pin_auth/include/pin_auth.h | 2 +- ext/pin_auth/include/pin_auth_ui.h | 2 +- ext/pin_auth/src/pin_auth.cpp | 4 +-- ext/pin_auth/src/pin_auth_ui.cpp | 13 ++++--- .../dialog_ui/js/pages/index/index.css | 18 +++++----- .../dialog_ui/js/pages/index/index.js | 1 + .../include/authentication/authentication.h | 2 +- .../include/authentication/dm_auth_manager.h | 3 ++ .../src/authentication/dm_auth_manager.cpp | 11 ++++-- 13 files changed, 70 insertions(+), 53 deletions(-) diff --git a/common/include/dialog_ui/js/pages/index/index.css b/common/include/dialog_ui/js/pages/index/index.css index b87a3962a..997f0c8af 100644 --- a/common/include/dialog_ui/js/pages/index/index.css +++ b/common/include/dialog_ui/js/pages/index/index.css @@ -7,8 +7,8 @@ } .title { - font-size: 48px; - line-height: 70px; + font-size: 80px; + line-height: 150px; font-weight: 800; } @@ -16,26 +16,26 @@ width: 85%; margin-top: 10%; text-align: center; - height: 45px; + height: 100px; } .but1 { - width: 40%; - height: 36px; - font-size: 26px; + width: 30%; + height: 80px; + font-size: 50px; margin-left: 10%; } .but2 { - width: 20%; - height: 36px; - font-size: 26px; + width: 30%; + height: 80px; + font-size: 50px; margin-left: 55%; } .title-list { - font-size: 38px; - line-height: 40px; + font-size: 70px; + line-height: 100px; font-weight: 800; } diff --git a/common/include/dm_constants.h b/common/include/dm_constants.h index 7878b4266..1206f3909 100644 --- a/common/include/dm_constants.h +++ b/common/include/dm_constants.h @@ -175,9 +175,9 @@ const std::string ETH_PORT = "ETH_PORT"; // ACE const int32_t ACE_X = 50; -const int32_t ACE_Y = 200; -const int32_t ACE_WIDTH = 400; -const int32_t ACE_HEIGHT = 200; +const int32_t ACE_Y = 300; +const int32_t ACE_WIDTH = 600; +const int32_t ACE_HEIGHT = 400; } // namespace DistributedHardware } // namespace OHOS #endif diff --git a/ext/input_pin_dialog/dialog_ui/js/pages/index/index.css b/ext/input_pin_dialog/dialog_ui/js/pages/index/index.css index cf763b2ac..fc2207c2f 100644 --- a/ext/input_pin_dialog/dialog_ui/js/pages/index/index.css +++ b/ext/input_pin_dialog/dialog_ui/js/pages/index/index.css @@ -7,44 +7,47 @@ } .title { - font-size: 48px; - line-height: 40px; + font-size: 80px; + line-height: 100px; font-weight: 800; } .title-list { - font-size: 30px; - line-height: 35px; + font-size: 60px; + line-height: 60px; font-weight: 800; } .title-error { - font-size: 15px; - line-height: 20px; + font-size: 30px; + line-height: 40px; font-weight: 800; color: #ff0000; } .title-pin { - font-size: 30px; - line-height: 35px; + font-size: 60px; + line-height: 80px; font-weight: 800; } .but { - margin: 10px 20px 10px 20px; width: 85%; - height: 40px; + margin-top: 10%; + text-align: center; + height: 100px; } .but1 { - width: 80px; - height: 36px; - font-size: 26px; + width: 30%; + height: 80px; + font-size: 50px; + margin-left: 10%; } .but2 { - width: 80px; - height: 36px; - font-size: 26px; + width: 30%; + height: 80px; + font-size: 50px; + margin-left: 55%; } \ No newline at end of file diff --git a/ext/input_pin_dialog/dialog_ui/js/pages/index/index.hml b/ext/input_pin_dialog/dialog_ui/js/pages/index/index.hml index 7f629df7a..004278185 100644 --- a/ext/input_pin_dialog/dialog_ui/js/pages/index/index.hml +++ b/ext/input_pin_dialog/dialog_ui/js/pages/index/index.hml @@ -12,10 +12,10 @@ PIN码输入错误,请重新输入
- -
diff --git a/ext/pin_auth/include/pin_auth.h b/ext/pin_auth/include/pin_auth.h index b2636e0af..dca2e7e7f 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 61575797f..5ff26c3e1 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 138abc56f..0bbadd15f 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 a3cfeefe2..51f76bdb4 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.css b/ext/show_pin_dialog/dialog_ui/js/pages/index/index.css index feb20b4fd..3807fd55e 100644 --- a/ext/show_pin_dialog/dialog_ui/js/pages/index/index.css +++ b/ext/show_pin_dialog/dialog_ui/js/pages/index/index.css @@ -7,25 +7,25 @@ } .title { - font-size: 48px; - line-height: 50px; + font-size: 80px; + line-height: 120px; font-weight: 800; } .title-list { - font-size: 38px; - line-height: 40px; + font-size: 60px; + line-height: 100px; font-weight: 800; } .title-pin { - font-size: 48px; - line-height: 50px; + font-size: 60px; + line-height: 100px; font-weight: 800; } .but { - width: 100%; - font-size: 26px; - height: 36px; + width: 80px; + font-size: 50px; + height: 80px; } \ No newline at end of file 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 114655c3a..3a55ac1cc 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 43c486511..67ca0c3ee 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 6b0298ec9..a24f9d45d 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 1e9976f44..009b3f371 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 -- Gitee From 160f19cd6fb5724d9160d23c57ccf01632bc6e77 Mon Sep 17 00:00:00 2001 From: lcaidm Date: Sat, 29 Jan 2022 16:51:39 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=A0=B7=E5=BC=8F=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=EF=BC=8C=E9=A1=B5=E9=9D=A2=E5=85=B3=E9=97=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dialog_ui/js/pages/index/index.hml | 2 +- .../include/dialog_ui/js/pages/index/index.js | 11 -------- .../dialog_ui/js/pages/index/index.hml | 3 -- .../dialog_ui/js/pages/index/index.js | 28 +++++++++---------- .../dialog_ui/js/pages/index/index.css | 2 +- .../src/authentication/dm_auth_manager.cpp | 2 +- 6 files changed, 16 insertions(+), 32 deletions(-) diff --git a/common/include/dialog_ui/js/pages/index/index.hml b/common/include/dialog_ui/js/pages/index/index.hml index 81ab90ff6..0ab94e3af 100644 --- a/common/include/dialog_ui/js/pages/index/index.hml +++ b/common/include/dialog_ui/js/pages/index/index.hml @@ -7,7 +7,7 @@