增加小程序解绑的逻辑优化 2415/1 2415/head 2416/target/1
authorCaisking <Casiking@zhihuishixun.com>
Sat, 27 Sep 2025 07:33:57 +0000 (15:33 +0800)
committerCaisking <Casiking@zhihuishixun.com>
Sat, 27 Sep 2025 07:33:57 +0000 (15:33 +0800)
code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/include/ThunderBirdModel.h
code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdModel.cpp
code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdPresenter.cpp

index 235b07f..4c7a1dc 100644 (file)
@@ -240,6 +240,8 @@ namespace OHOS
         bool is_all_services_ready = false;
         bool init_falg = false;
         bool bind_status = false;
+
+        int net_count = 0;
     };
 }
 
index 7f81c0b..c5d607d 100644 (file)
             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();
index 2432359..b75e9ad 100644 (file)
@@ -141,7 +141,7 @@ namespace OHOS
     {
 #ifdef CUSTOM_UTILS
        if(custom_get_factory_test_flag())
-            return;
+        return;
 #endif
         //如果在二维码界面 判断是否绑定
         if(ThunderBirdMainView::GetInstance() != nullptr)