增加目标达成10s后自动关闭
authorhcj <1224667075@qq.com>
Thu, 14 Nov 2024 03:20:54 +0000 (11:20 +0800)
committerhcj <1224667075@qq.com>
Thu, 14 Nov 2024 03:20:54 +0000 (11:20 +0800)
code/sdk/application/wearable/service/msg_center/src/notify/goal_notification.cpp

index 7cf2eb2..fe5dfb5 100644 (file)
@@ -289,7 +289,7 @@ namespace OHOS
     static void GoalviewShowCallBack(int data)
     {
         GoalviewShowCallBack_FALG--;
-        if(GoalviewShowCallBack_FALG)
+        if(GoalviewShowCallBack_FALG>=7)
         {
             if (true != OHOS::ConfigModel::GetInstance()->GetDnotdisturb() && (!uapi_sleep_mode_flag_get()))
             {
@@ -298,16 +298,19 @@ namespace OHOS
         }
         if(GoalviewShowCallBack_FALG==0)
         {
-            if(GoalviewShow_timer)
-            {
-                osTimerStop(GoalviewShow_timer);
-                osStatus_t  ret = osTimerDelete(GoalviewShow_timer);
-                if (ret != osOK) {
-                    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Disatransmitting_timer failed  ret = %lx!", ret);
-                    return;
-                }
-                GoalviewShow_timer = nullptr;
-            }
+
+            NotificationManager::GetInstance()->StopNotify();
+
+            // if(GoalviewShow_timer)
+            // {
+            //     osTimerStop(GoalviewShow_timer);
+            //     osStatus_t  ret = osTimerDelete(GoalviewShow_timer);
+            //     if (ret != osOK) {
+            //         WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Disatransmitting_timer failed  ret = %lx!", ret);
+            //         return;
+            //     }
+            //     GoalviewShow_timer = nullptr;
+            // }
         }
         WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "hintdialtimerCallBack ??????!");
         
@@ -331,7 +334,7 @@ namespace OHOS
 
         uint32_t tick;
         osStatus_t retTimer;
-        GoalviewShowCallBack_FALG=3;
+        GoalviewShowCallBack_FALG=10;
         GoalviewShow_timer = osTimerNew((osTimerFunc_t)GoalviewShowCallBack, osTimerPeriodic, NULL, NULL);
         tick =osMs2Tick(1000);// osMs2Tick(1000);
         retTimer = osTimerStart(GoalviewShow_timer, tick);