From: Caisking Date: Sat, 27 Sep 2025 07:33:57 +0000 (+0800) Subject: 增加小程序解绑的逻辑优化 X-Git-Tag: V1.0.9_20251128_194606_LN~309^2^2 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=refs%2Fchanges%2F2415%2Fhead;p=mirrors%2FFD230.git 增加小程序解绑的逻辑优化 --- 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 235b07faa..4c7a1dcbf 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 @@ -240,6 +240,8 @@ namespace OHOS bool is_all_services_ready = false; bool init_falg = false; bool bind_status = false; + + int net_count = 0; }; } 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 7f81c0b0c..c5d607da9 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 @@ -1045,13 +1045,29 @@ if(get_is_ln_get_device_token_success() == 0) { do_ln_http_server_send_data(LN_HTTP_SERVICE_CMD_GET_DEVICE_TOKEN, NULL, 0); + // 重置网络计数 + net_count = 0; } else { if (init_falg == false) { + // 有网之后需要延迟5s + net_count ++; + if(net_count < 5) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "有网之后需要延迟 %d", net_count); + return; + } //发送获取绑定用户ID do_ln_http_server_send_data(LN_HTTP_SERVICE_CMD_GET_USER_ID, NULL, 0); + // 获取到设备是未绑定状态,但是内部有绑定记录 需要恢复出厂 + if(bind_status == true && uapi_ln_is_device_bound() == 0) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "恢复出厂"); + restore_factory_settings(); + return; + } // 网络连接成功,调用HTTP服务获取设备Token // 获取一下OTA 是否有最新版本 int ota = ota_update_boot(); 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 243235900..b75e9ada2 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 @@ -141,7 +141,7 @@ namespace OHOS { #ifdef CUSTOM_UTILS if(custom_get_factory_test_flag()) - return; + return; #endif //如果在二维码界面 判断是否绑定 if(ThunderBirdMainView::GetInstance() != nullptr)