修复每日目标model,不再多次读取config(补 1159/2 1159/head 1160/target/1
authorhcj <1224667075@qq.com>
Fri, 11 Oct 2024 09:47:21 +0000 (17:47 +0800)
committerhcj <1224667075@qq.com>
Fri, 11 Oct 2024 09:47:21 +0000 (17:47 +0800)
code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp
code/sdk/application/wearable/service/msg_center/src/notify/goal_notification.cpp

index 79fb96e..0b3241a 100644 (file)
@@ -418,9 +418,9 @@ void MsgCenterNotifystepProc(const Topic topic, Request* req)
         goal_type=GOAL_STEP;
         if(get_Is_shouw_falg(goal_type))
         {   
-            if(0==ConfigModel::GetInstance()->get_configData_int(ConfigModel::CONFIGMODEL_ITEM_SPORTS_GOAL_STEP))
+            if(OHOS::GoalModel::GetInstance().get_step_goal_show())
             {
-             CustomEventPublish(TOPIC_EVENT_GOAL_SHOW_VIEW,(uint8_t *)&goal_type,1);
+                CustomEventPublish(TOPIC_EVENT_GOAL_SHOW_VIEW,(uint8_t *)&goal_type,1);
             }
         }
     }
@@ -430,7 +430,7 @@ void MsgCenterNotifystepProc(const Topic topic, Request* req)
         goal_type=GOAL_DISTANCE;
         if(get_Is_shouw_falg(goal_type))
         {   
-            if(ConfigModel::GetInstance()->get_configData_int(ConfigModel::CONFIGMODEL_ITEM_SPORTS_GOAL_OTHER))
+            if(OHOS::GoalModel::GetInstance().get_other_goal_show())
             {
                  CustomEventPublish(TOPIC_EVENT_GOAL_SHOW_VIEW,(uint8_t *)&goal_type,1);
             }
@@ -443,7 +443,7 @@ void MsgCenterNotifystepProc(const Topic topic, Request* req)
         goal_type=GOAL_FAT;
         if(get_Is_shouw_falg(goal_type))
         {   
-           if(ConfigModel::GetInstance()->get_configData_int(ConfigModel::CONFIGMODEL_ITEM_SPORTS_GOAL_OTHER))
+            if(OHOS::GoalModel::GetInstance().get_other_goal_show())
             {
                  CustomEventPublish(TOPIC_EVENT_GOAL_SHOW_VIEW,(uint8_t *)&goal_type,1);
             }
@@ -455,7 +455,7 @@ void MsgCenterNotifystepProc(const Topic topic, Request* req)
         goal_type=GOAL_STAND;
         if(get_Is_shouw_falg(goal_type))
         {   
-           if(ConfigModel::GetInstance()->get_configData_int(ConfigModel::CONFIGMODEL_ITEM_SPORTS_GOAL_OTHER))
+           if(OHOS::GoalModel::GetInstance().get_other_goal_show())
             {
                  CustomEventPublish(TOPIC_EVENT_GOAL_SHOW_VIEW,(uint8_t *)&goal_type,1);
             }
@@ -467,7 +467,7 @@ void MsgCenterNotifystepProc(const Topic topic, Request* req)
         goal_type=GOAL_CALOREIE;
         if(get_Is_shouw_falg(goal_type))
         {   
-           if(ConfigModel::GetInstance()->get_configData_int(ConfigModel::CONFIGMODEL_ITEM_SPORTS_GOAL_OTHER))
+           if(OHOS::GoalModel::GetInstance().get_other_goal_show())
             {
                  CustomEventPublish(TOPIC_EVENT_GOAL_SHOW_VIEW,(uint8_t *)&goal_type,1);
             }
@@ -656,6 +656,11 @@ void MsgCenterNotifyNextDayProc(const Topic topic, Request *req)
         std::bind(&OHOS::BloodOxygenModel::CleanAllData, OHOS::BloodOxygenModel::GetInstance()));
     /* --------------------------------- 每日目标相关 --------------------------------- */
     // 午夜清除运动数据
+    for(int i=1;i<6;i++)
+    {
+        set_Is_shouw_falg(1,i);
+    }
+    
     do_cywee_service_check_msg(CYWEE_SERVICE_CMD_RESET_DAILY_DATA, NULL);
     printf("******nextday is end******\r\n");
 #endif
index 49a4610..8c58a54 100644 (file)
@@ -33,7 +33,7 @@ namespace OHOS
     static   UILabelButtonExt *buttonok_ = nullptr;
     static   UIImageAnimatorView *imageAnimator{nullptr};
     static const ImageInfo **winimageInfos;
-    static ImageAnimatorInfo *winimageAnimatorInfo{nullptr};
+    static ImageAnimatorInfo winimageAnimatorInfo[94]{0};
     static std::string winbasePath = "/user/res/Training/training_GIF/win/";
 
     void Freegoalview(void)
@@ -118,6 +118,37 @@ namespace OHOS
         }
     }
 
+   // static void InitImageAnimatorSource(UIImageAnimatorView *&imageAnimator,
+    //                          ImageAnimatorInfo *&imageAnimatorInfo,
+    //                          const ImageInfo **imageInfo, int numFrames,
+    //                          int left, int top, int width, int height,
+    //                          const char *viewId, int time) {
+    //     if (imageAnimator == nullptr) {
+    //         imageAnimator = new UIImageAnimatorView();
+    //     }
+    //     imageAnimator->SetPosition(left, top);
+    //     imageAnimator->Resize(width, height);
+    //     imageAnimator->SetViewId(viewId);
+    //     // imageAnimator->SetStyle(STYLE_BACKGROUND_COLOR, 0xffffffff);
+    //     imageAnimator->SetStyle(STYLE_BACKGROUND_OPA, 0xff);
+
+    //    // imageAnimatorInfo = new ImageAnimatorInfo[numFrames];
+    //     for (int i = 0; i < numFrames; i++) {
+    //         imageAnimatorInfo[i].imageInfo = imageInfo[i];
+    //         imageAnimatorInfo[i].pos.x = left;
+    //         imageAnimatorInfo[i].pos.y = top;
+    //         imageAnimatorInfo[i].width = width;
+    //         imageAnimatorInfo[i].height = height;
+    //         imageAnimatorInfo[i].imageType = IMG_SRC_IMAGE_INFO;
+    //     }
+
+    //     imageAnimator->SetImageAnimatorSrc(imageAnimatorInfo, numFrames,
+    //                                         time); // 200 is the default delay time
+    //     imageAnimator->SetTimeOfPause(time);
+    //     imageAnimator->SetRepeat(true);
+    //     }
+
+
     uint8_t set_Is_shouw_falg(uint8_t flag,uint8_t type)
     {
         switch (type) {
@@ -165,7 +196,7 @@ namespace OHOS
             break;
         case GOAL_FAT:
             tag =  ConfigModel::GetInstance()->get_configData_int(ConfigModel::CONFIGMODEL_ITEM_SPORTS_GOAL_DURATION);
-            tagString=std::to_string(tag)+"minute";
+            tagString=std::to_string(tag)+"min";
             break;
         case GOAL_STAND:
              tag = ConfigModel::GetInstance()->get_configData_int(ConfigModel::CONFIGMODEL_ITEM_SPORTS_GOAL_STANDUP_TIMES);