From d5fc9a947820d9e2986ff5aa017c82b0e304fe51 Mon Sep 17 00:00:00 2001 From: Caisking Date: Sat, 20 Sep 2025 19:21:56 +0800 Subject: [PATCH] =?utf8?q?=E4=BC=98=E5=8C=96=E7=BB=91=E5=AE=9A=E6=B5=81?= =?utf8?q?=E7=A8=8B=EF=BC=9B=E8=8E=B7=E5=8F=96=E4=B9=8B=E5=90=8E=E4=B8=8D?= =?utf8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../thunderbird/include/ThunderBirdModel.h | 9 ++++++ .../include/ThunderBirdPresenter.h | 3 ++ .../thunderbird/src/ThunderBirdModel.cpp | 30 ++++++++++++++++++- .../thunderbird/src/ThunderBirdPresenter.cpp | 23 ++++++++++---- 4 files changed, 58 insertions(+), 7 deletions(-) diff --git a/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/include/ThunderBirdModel.h b/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/include/ThunderBirdModel.h index c6253c372..dbf78d5fe 100644 --- a/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/include/ThunderBirdModel.h +++ b/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/include/ThunderBirdModel.h @@ -131,6 +131,11 @@ namespace OHOS std::string GetDeviceId(); bool IsDeviceIdValid(); bool ValidateIMEIChecksum(const std::string& imei); + + // IMEI状态管理函数 + bool IsIMEIValid() const; + void CheckIMEIStatus(); + void SetIMEIValid(bool valid); // 对话状态相关函数 int GetConversationStatus(); @@ -165,6 +170,10 @@ namespace OHOS bool m_countUpActive; // 计数定时器是否激活 int m_countUpValue; // 当前计数值 int m_countUpTarget; // 计数目标值 + + // IMEI状态管理 + bool m_imeiValid; // IMEI是否有效标志位 + bool m_imeiChecked; // IMEI是否已检查过 }; } diff --git a/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/include/ThunderBirdPresenter.h b/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/include/ThunderBirdPresenter.h index 37074c11e..b4d5acd8b 100644 --- a/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/include/ThunderBirdPresenter.h +++ b/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/include/ThunderBirdPresenter.h @@ -55,6 +55,9 @@ namespace OHOS void ShowVolumeAdjustment(int volumeDelta); bool HandleViewNavigation(int16_t currentView, int16_t currentSubView, bool isUpKey, KeyType keyType); + // 二维码相关函数 + void UpdateQrcodeIfValid(); + // 界面导航处理函数 bool HandleGuideViewNavigation(int16_t currentSubView, KeyType keyType); bool HandleDialogueViewNavigation(int16_t currentSubView, KeyType keyType); diff --git a/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdModel.cpp b/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdModel.cpp index f84196ab4..45b03757b 100644 --- a/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdModel.cpp +++ b/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdModel.cpp @@ -56,7 +56,8 @@ m_statusChangeTime(0), m_lastStatusCheckTime(0), m_reminderHideActive(false), m_reminderHideTime(0), m_otaCountdownActive(false), m_otaCountdownValue(0), - m_countUpActive(false), m_countUpValue(0), m_countUpTarget(0) + m_countUpActive(false), m_countUpValue(0), m_countUpTarget(0), + m_imeiValid(false), m_imeiChecked(false) { // 初始化时加载提醒数据 // LoadRemindersFromFile(); @@ -1138,5 +1139,32 @@ } } + // IMEI状态管理函数实现 + bool ThunderBirdModel::IsIMEIValid() const + { + return m_imeiValid; + } + + void ThunderBirdModel::CheckIMEIStatus() + { + // 如果已经检查过,直接返回 + if (m_imeiChecked) { + return; + } + + // 检查IMEI有效性 + m_imeiValid = IsDeviceIdValid(); + m_imeiChecked = true; + + WEARABLE_LOGD("IMEI status checked: valid=%d", m_imeiValid); + } + + void ThunderBirdModel::SetIMEIValid(bool valid) + { + m_imeiValid = valid; + m_imeiChecked = true; + WEARABLE_LOGD("IMEI status set: valid=%d", m_imeiValid); + } + } \ No newline at end of file diff --git a/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdPresenter.cpp b/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdPresenter.cpp index bca98d4c6..c3c413079 100644 --- a/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdPresenter.cpp +++ b/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdPresenter.cpp @@ -155,12 +155,8 @@ namespace OHOS } else { - //判断二维码的有效性 - if(ThunderBirdModel::GetInstance()->IsDeviceIdValid()) - { - //更新二维码 - ThunderBirdGuideView::GetInstance()->UpdateQrcode(); - } + //更新二维码 + UpdateQrcodeIfValid(); } } //如果是在对话界面 需要根据对话状态去拿对话数据进行更新 @@ -601,5 +597,20 @@ namespace OHOS return true; } + // 更新二维码(如果设备ID有效) + void ThunderBirdPresenter::UpdateQrcodeIfValid() + { + // 确保IMEI状态已检查 + ThunderBirdModel::GetInstance()->CheckIMEIStatus(); + + // 检查IMEI是否有效 + if (!ThunderBirdModel::GetInstance()->IsIMEIValid()) { + return; + } + + // 更新二维码 更新一次二维码 不能一直获取 + ThunderBirdGuideView::GetInstance()->UpdateQrcode(); + } + } -- 2.17.1