修改系统升级bug 135/1 135/head 136/target/1 137/target/1
authorhcj_ <1224667075@qq.com>
Tue, 7 May 2024 07:14:05 +0000 (15:14 +0800)
committerhcj_ <1224667075@qq.com>
Tue, 7 May 2024 07:14:05 +0000 (15:14 +0800)
code/sdk/application/wearable/fd230app/nativeui/system/include/SystemView.h
code/sdk/application/wearable/fd230app/nativeui/system/src/SystemPresenter.cpp
code/sdk/application/wearable/fd230app/nativeui/system/src/Systemupgrade.cpp

index c906f84..b00cafc 100644 (file)
@@ -27,6 +27,7 @@ namespace OHOS
 {\r
     static constexpr const char *ABOUT_THE_WATCH = "AboutTheWatchButton";   // 关于手表\r
     static constexpr const char *SYSTEM_UPGRADE = "SystemUpgradeButtonExt"; // 系统升级\r
+    static constexpr const char *SYSTEM_UPGRADE_t = "SystemUpgradeButtonExt_t"; // 点击系统升级\r
     static constexpr const char *WATCH_QR_CODE = "WatchqrcodeButton";       // 手表二维码\r
     static constexpr const char *SYSTEM_LANGUAGE = "SystemLanguageButton";  // 系统语言\r
     static constexpr const char *FACTORY_RESET = "FactoryResetButton";      // 恢复出厂设置\r
index 96c45f3..013774d 100644 (file)
@@ -194,7 +194,7 @@ namespace OHOS
         }\r
 \r
 \r
-        if (strcmp(view.GetViewId(), SYSTEM_UPGRADE) == 0) //点击是否立即升级\r
+        if (strcmp(view.GetViewId(), SYSTEM_UPGRADE_t) == 0) //点击是否立即升级\r
         {\r
             SystemupgradeView::GetInstance()->statr_down_fwpkg();\r
         }\r
index 1558a10..24a8842 100644 (file)
@@ -190,6 +190,7 @@ namespace OHOS
         if(fp==NULL)
         {
             WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "open fail");
+            if(SystemupgradeView::GetInstance())
             SystemupgradeView::GetInstance()->set_string_value(NULL,false);
             return;
         }
@@ -208,6 +209,7 @@ namespace OHOS
             WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "fread %d",ret);
             fclose(fp);
             free(buf);
+            if(SystemupgradeView::GetInstance())
             SystemupgradeView::GetInstance()->set_string_value(NULL,false);
             return;
         }
@@ -277,7 +279,7 @@ namespace OHOS
          
             sprintf(msg_buf,"%s",msg);
             WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "%s",msg); 
-       
+            if(SystemupgradeView::GetInstance())
             SystemupgradeView::GetInstance()->set_string_value(msg_buf,falg);
         
         //RootView::GetInstance()->Invalidate();
@@ -436,7 +438,11 @@ namespace OHOS
                         &connection);
         PRINT("custom_start_ota_download %d \r\n",rett);
         if(rett!=0)
-        SystemupgradeView::GetInstance()->set_string_value(NULL,false);
+        {
+            if(SystemupgradeView::GetInstance())
+            SystemupgradeView::GetInstance()->set_string_value(NULL,false);
+        }
+       
         // SystemupgradeView::GetInstance()->init_fail(0);
         return ERRCODE_SUCC;
     }
@@ -649,10 +655,16 @@ namespace OHOS
                 {
                     newVersion->SetText(str);
                 }
-                newVersionTitle->SetText("有最新固件版本");
 
+                if(newVersion)
                 newVersion->SetVisible(true);
-                newVersionTitle->SetVisible(true);
+
+                if(newVersionTitle)
+                {
+                    newVersionTitle->SetText("有最新固件版本");
+                    newVersionTitle->SetVisible(true);
+                }
+               
                 //new_label->SetVisible(true);
                 is_new_version=true;
 
@@ -662,13 +674,20 @@ namespace OHOS
                 if(str!=NULL)
                 {
                     WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "str %s",str);
-                    newVersion->SetText(str);
-                    newVersion->SetVisible(true);
+                    if(newVersion)
+                    {
+                        newVersion->SetText(str);
+                        newVersion->SetVisible(true);
+                    }
+                   
                 }
                 
+                if(newVersion)
+                {
+                    newVersionTitle->SetText("获取升级失败");
+                    newVersionTitle->SetVisible(true);
+                }
                 
-                newVersionTitle->SetText("获取升级失败");
-                newVersionTitle->SetVisible(true);
                 is_new_version=false;
         
             }
@@ -1000,7 +1019,7 @@ namespace OHOS
             WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::SystemUpgradeButtonExt new fail!");
         }
         SystemUpgradeButton_->SetPosition(163, 400, 180, 80);
-        SystemUpgradeButton_->SetViewId(SYSTEM_UPGRADE);
+        SystemUpgradeButton_->SetViewId(SYSTEM_UPGRADE_t);
         SystemUpgradeButton_->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919);
         SystemUpgradeButton_->SetText("确认升级");
         SystemUpgradeButton_->SetAlign(TEXT_ALIGNMENT_LEFT);