#154,解决:手表端超时不操作后,绑定请求会继续留在手表界面bug 942/4
authorluozheng <1732036298@qq.com>
Wed, 11 Sep 2024 09:40:03 +0000 (17:40 +0800)
committerluozheng <1732036298@qq.com>
Wed, 11 Sep 2024 09:40:03 +0000 (17:40 +0800)
code/sdk/application/wearable/service/msg_center/include/notify/pairing_notification.h
code/sdk/application/wearable/service/msg_center/src/notify/pairing_notification.cpp

index a6cadff..152fcc9 100644 (file)
@@ -2,20 +2,19 @@
  * @Author: luozheng 1732036298@qq.com
  * @Date: 2024-03-22 09:48:07
  * @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-09-02 17:22:48
+ * @LastEditTime: 2024-09-11 17:22:48
  * @FilePath: /FD230/code/sdk/application/wearable/service/msg_center/include/notify/pairing_notification.h
  */
 #ifndef PAIRING_NOTIFICATION_H
 #define PAIRING_NOTIFICATION_H
 
 #include "BaseView.h"
-#define NO_LCD_TEST_CONNECT 0
 namespace OHOS
 {
     UIViewGroup *CreateDeviceBindingView(void);
     UIViewGroup *CreateDeviceUnBindingView(void);
-    UIViewGroup * CreateDeviceUnbindingRequestGroupView(void);
-    
+    UIViewGroup *CreateDeviceUnbindingRequestGroupView(void);
+
     void FreeDeviceBindingView(void);
     void FreeDeviceUnBindingView(void);
     void FreeDeviceUnbindingRequestGroupView(void);
@@ -27,20 +26,15 @@ namespace OHOS
         void SetDeviceName(char *Name);
         char *GetDeviceName();
         void DeviceUnBindingViewIsVisible(bool state);
-        #if NO_LCD_TEST_CONNECT
-        void Pairing_StartTimer(uint32_t interval = 1000*5);
-        #else
-        void Pairing_StartTimer(uint32_t interval = 1000*30);
-        #endif
-
+        void Pairing_StartTimer(uint32_t interval = 1000 * 40);
         void Pairing_StopTimer(void);
         char DeviceName[50];
+
     private:
         PairingViewEventListener();
         ~PairingViewEventListener();
         PairingViewEventListener(const PairingViewEventListener &) = delete;
         const PairingViewEventListener &operator=(const PairingViewEventListener &) = delete;
-        
     };
 
 }
index 56ead69..fac9a6c 100644 (file)
@@ -2,7 +2,7 @@
  * @Author: luozheng 1732036298@qq.com
  * @Date: 2024-03-22 10:04:36
  * @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-09-07 17:28:10
+ * @LastEditTime: 2024-09-11 17:27:05
  * @FilePath: /FD230/code/sdk/application/wearable/service/msg_center/src/notify/pairing_notification.cpp
  */
 #include "notification_manager.h"
@@ -356,11 +356,9 @@ namespace OHOS
             DeviceBindingScrollView->Add(DeviceBindingButtonCancel);
             DeviceBindingScrollView->Add(DeviceBindingButtonOK);
             DeviceBindingView->Add(DeviceBindingScrollView);
-#if NO_LCD_TEST_CONNECT
-            PairingViewEventListener::GetInstance().Pairing_StartTimer();
-#endif
         }
 
+        //震动一次
         if (true != OHOS::ConfigModel::GetInstance()->GetDnotdisturb() && (!uapi_sleep_mode_flag_get()))
         {
             ui_api_vibrate_once_func();
@@ -368,6 +366,8 @@ namespace OHOS
 
         ScreenTurnOn(40 * 1000); // 亮屏操作  40秒关闭
 
+        PairingViewEventListener::GetInstance().Pairing_StartTimer(); //开启一个40s后弹窗自动销毁定时器
+
         NotificationManager::GetInstance()->RegisterNotifyCleanupFunction(FreeDeviceBindingView);
         return DeviceBindingView;
     }
@@ -528,6 +528,8 @@ namespace OHOS
         }
 
         ScreenTurnOn(40 * 1000); // 亮屏操作  40秒关闭
+
+        PairingViewEventListener::GetInstance().Pairing_StartTimer(); //开启一个40s后弹窗自动销毁定时器
         /* -------------------------------------------------------------------------- */
 
         NotificationManager::GetInstance()->RegisterNotifyCleanupFunction(FreeDeviceUnBindingView);
@@ -723,6 +725,7 @@ namespace OHOS
         WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[FreeDeviceBindingView]");
         if (DeviceBindingView != nullptr)
         {
+            PairingViewEventListener::GetInstance().Pairing_StopTimer();
             DeviceBindingView->RemoveAll();
             if (DeviceBindingScrollView != nullptr)
             {
@@ -772,6 +775,7 @@ namespace OHOS
         WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[FreeDeviceUnBindingView]");
         if (DeviceUnBindingView != nullptr)
         {
+            PairingViewEventListener::GetInstance().Pairing_StopTimer();
             DeviceUnBindingView->RemoveAll();
             if (DeviceUnBindingScrollView != nullptr)
             {
@@ -873,20 +877,7 @@ namespace OHOS
     static void Pairing_TimerCallbackProc(int data)
     {
         WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Pairing_TimerCallbackProc");
-#ifdef SUPPORT_BLE_SERVICE
-#if NO_LCD_TEST_CONNECT
-        comfirmPaire(1);
-#else
-        comfirmPaire(0);
-#endif
-#endif
-        if (NotificationManager::GetInstance()->GetShowingNotifyId() == TOPIC_EVENT_DEVICE_BIND &&
-            NotificationManager::GetInstance()->HasNotifyShowing() == true)
-        {
-            NotificationManager::GetInstance()->StopNotify();
-        }
-
-        PairingViewEventListener::GetInstance().Pairing_StopTimer();
+        NotificationManager::GetInstance()->StopNotify();
     }
 
     /*
@@ -936,7 +927,6 @@ namespace OHOS
             g_timer = NULL;
             return;
         }
-        uapi_setScreenDuration(interval);
         return;
     }
 
@@ -948,6 +938,7 @@ namespace OHOS
         // 检查定时器是否存在
         if (g_timer != NULL)
         {
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "PairingViewEventListener::Pairing_StopTimer");
             osTimerStop(g_timer);
             // 删除定时器并置为 NULL
             osStatus_t ret = osTimerDelete(g_timer);