同步星历下载的交互 2456/1
authorCaisking <Casiking@zhihuishixun.com>
Tue, 30 Sep 2025 08:44:25 +0000 (16:44 +0800)
committerCaisking <Casiking@zhihuishixun.com>
Tue, 30 Sep 2025 08:44:25 +0000 (16:44 +0800)
code/sdk/application/wearable/fd230/nativeapp/nativeui/ephemeris_download/src/EphemerisDownloadPresenter.cpp
code/sdk/application/wearable/fd272/nativeapp/nativeui/ephemeris_download/src/EphemerisDownloadPresenter.cpp
code/sdk/application/wearable/n9/nativeapp/nativeui/ephemeris_download/src/EphemerisDownloadPresenter.cpp

index 88ef07c..1a1a53f 100644 (file)
@@ -27,13 +27,9 @@ EphemerisDownloadPresenter::~EphemerisDownloadPresenter() {}
 
 void EphemerisDownloadPresenter::OnResume() {
   RootView::GetInstance()->SetOnKeyActListener(this);
-  // 启动定时器
-  EphemerisDownloadModel::GetInstance().ephemeris_data_timer(1000); // 1秒间隔
 }
 
 void EphemerisDownloadPresenter::OnStop() {
-  // 停止定时器
-  EphemerisDownloadModel::GetInstance().ephemeris_stop_data_timer();
 }
 
 EphemerisDownloadPresenter* EphemerisDownloadPresenter::GetInstance() {
@@ -102,8 +98,14 @@ void EphemerisDownloadPresenter::UpdateDownloadStatus() {
         }
         else if(EphemerisDownloadModel::GetInstance().GetEphemerisDownloadProgress() > 0)
         {
-            std::string progress = "下载中,正在下载"+std::to_string(EphemerisDownloadModel::GetInstance().GetEphemerisDownloadProgress())+"%";
-            EphemerisDownloadView::GetInstance()->GetDownloadLabel()->SetText(progress.c_str());
+            // 进度需要*10
+            int progress = EphemerisDownloadModel::GetInstance().GetEphemerisDownloadProgress() * 10;
+            if(progress > 100)
+            {
+                progress = 100;
+            }
+            std::string progress_str = "下载中,正在下载"+std::to_string(progress)+"%";
+            EphemerisDownloadView::GetInstance()->GetDownloadLabel()->SetText(progress_str.c_str());
         }
         else if(EphemerisDownloadModel::GetInstance().GetEphemerisDownloadProgress() == 10)
         {
@@ -122,6 +124,11 @@ void EphemerisDownloadPresenter::UpdateDownloadStatus() {
         EphemerisDownloadView::GetInstance()->GetDownloadLabel()->SetText(
             "下载成功");
       }
+      //更新有效期
+      if(EphemerisDownloadView::GetInstance()->GetValidityPeriodLabel()) {
+        EphemerisDownloadView::GetInstance()->GetValidityPeriodLabel()->SetText(
+            EphemerisDownloadModel::GetInstance().GetEphemerisValidityPeriod().c_str());
+      }
     }
     break;
   case EphemerisDownloadStatus::FAILED:
index 88ef07c..1a1a53f 100644 (file)
@@ -27,13 +27,9 @@ EphemerisDownloadPresenter::~EphemerisDownloadPresenter() {}
 
 void EphemerisDownloadPresenter::OnResume() {
   RootView::GetInstance()->SetOnKeyActListener(this);
-  // 启动定时器
-  EphemerisDownloadModel::GetInstance().ephemeris_data_timer(1000); // 1秒间隔
 }
 
 void EphemerisDownloadPresenter::OnStop() {
-  // 停止定时器
-  EphemerisDownloadModel::GetInstance().ephemeris_stop_data_timer();
 }
 
 EphemerisDownloadPresenter* EphemerisDownloadPresenter::GetInstance() {
@@ -102,8 +98,14 @@ void EphemerisDownloadPresenter::UpdateDownloadStatus() {
         }
         else if(EphemerisDownloadModel::GetInstance().GetEphemerisDownloadProgress() > 0)
         {
-            std::string progress = "下载中,正在下载"+std::to_string(EphemerisDownloadModel::GetInstance().GetEphemerisDownloadProgress())+"%";
-            EphemerisDownloadView::GetInstance()->GetDownloadLabel()->SetText(progress.c_str());
+            // 进度需要*10
+            int progress = EphemerisDownloadModel::GetInstance().GetEphemerisDownloadProgress() * 10;
+            if(progress > 100)
+            {
+                progress = 100;
+            }
+            std::string progress_str = "下载中,正在下载"+std::to_string(progress)+"%";
+            EphemerisDownloadView::GetInstance()->GetDownloadLabel()->SetText(progress_str.c_str());
         }
         else if(EphemerisDownloadModel::GetInstance().GetEphemerisDownloadProgress() == 10)
         {
@@ -122,6 +124,11 @@ void EphemerisDownloadPresenter::UpdateDownloadStatus() {
         EphemerisDownloadView::GetInstance()->GetDownloadLabel()->SetText(
             "下载成功");
       }
+      //更新有效期
+      if(EphemerisDownloadView::GetInstance()->GetValidityPeriodLabel()) {
+        EphemerisDownloadView::GetInstance()->GetValidityPeriodLabel()->SetText(
+            EphemerisDownloadModel::GetInstance().GetEphemerisValidityPeriod().c_str());
+      }
     }
     break;
   case EphemerisDownloadStatus::FAILED:
index 88ef07c..1a1a53f 100644 (file)
@@ -27,13 +27,9 @@ EphemerisDownloadPresenter::~EphemerisDownloadPresenter() {}
 
 void EphemerisDownloadPresenter::OnResume() {
   RootView::GetInstance()->SetOnKeyActListener(this);
-  // 启动定时器
-  EphemerisDownloadModel::GetInstance().ephemeris_data_timer(1000); // 1秒间隔
 }
 
 void EphemerisDownloadPresenter::OnStop() {
-  // 停止定时器
-  EphemerisDownloadModel::GetInstance().ephemeris_stop_data_timer();
 }
 
 EphemerisDownloadPresenter* EphemerisDownloadPresenter::GetInstance() {
@@ -102,8 +98,14 @@ void EphemerisDownloadPresenter::UpdateDownloadStatus() {
         }
         else if(EphemerisDownloadModel::GetInstance().GetEphemerisDownloadProgress() > 0)
         {
-            std::string progress = "下载中,正在下载"+std::to_string(EphemerisDownloadModel::GetInstance().GetEphemerisDownloadProgress())+"%";
-            EphemerisDownloadView::GetInstance()->GetDownloadLabel()->SetText(progress.c_str());
+            // 进度需要*10
+            int progress = EphemerisDownloadModel::GetInstance().GetEphemerisDownloadProgress() * 10;
+            if(progress > 100)
+            {
+                progress = 100;
+            }
+            std::string progress_str = "下载中,正在下载"+std::to_string(progress)+"%";
+            EphemerisDownloadView::GetInstance()->GetDownloadLabel()->SetText(progress_str.c_str());
         }
         else if(EphemerisDownloadModel::GetInstance().GetEphemerisDownloadProgress() == 10)
         {
@@ -122,6 +124,11 @@ void EphemerisDownloadPresenter::UpdateDownloadStatus() {
         EphemerisDownloadView::GetInstance()->GetDownloadLabel()->SetText(
             "下载成功");
       }
+      //更新有效期
+      if(EphemerisDownloadView::GetInstance()->GetValidityPeriodLabel()) {
+        EphemerisDownloadView::GetInstance()->GetValidityPeriodLabel()->SetText(
+            EphemerisDownloadModel::GetInstance().GetEphemerisValidityPeriod().c_str());
+      }
     }
     break;
   case EphemerisDownloadStatus::FAILED: