@@ -29,7 +29,8 @@ Notifications::Notifications(DisplayApp* app,
2929 notificationManager.NbNotifications (),
3030 mode,
3131 alertNotificationService,
32- motorController);
32+ motorController,
33+ &timeoutTickCountEnd);
3334 validDisplay = true ;
3435 } else {
3536 currentItem = std::make_unique<NotificationItem>(" Notification" ,
@@ -39,7 +40,8 @@ Notifications::Notifications(DisplayApp* app,
3940 notificationManager.NbNotifications (),
4041 Modes::Preview,
4142 alertNotificationService,
42- motorController);
43+ motorController,
44+ &timeoutTickCountEnd);
4345 }
4446
4547 if (mode == Modes::Preview) {
@@ -63,7 +65,7 @@ Notifications::~Notifications() {
6365}
6466
6567bool Notifications::Refresh () {
66- if (mode == Modes::Preview) {
68+ if (mode == Modes::Preview && !currentItem-> timeoutOnHold ) {
6769 auto tick = xTaskGetTickCount ();
6870 int32_t pos = 240 - ((tick - timeoutTickCountStart) / ((timeoutTickCountEnd - timeoutTickCountStart) / 240 ));
6971 if (pos < 0 )
@@ -105,7 +107,8 @@ bool Notifications::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
105107 notificationManager.NbNotifications (),
106108 mode,
107109 alertNotificationService,
108- motorController);
110+ motorController,
111+ &timeoutTickCountEnd);
109112 }
110113 return true ;
111114 case Pinetime::Applications::TouchEvents::SwipeUp: {
@@ -131,7 +134,8 @@ bool Notifications::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
131134 notificationManager.NbNotifications (),
132135 mode,
133136 alertNotificationService,
134- motorController);
137+ motorController,
138+ &timeoutTickCountEnd);
135139 }
136140 return true ;
137141 case Pinetime::Applications::TouchEvents::LongTap: {
@@ -167,8 +171,10 @@ Notifications::NotificationItem::NotificationItem(const char* title,
167171 uint8_t notifNb,
168172 Modes mode,
169173 Pinetime::Controllers::AlertNotificationService& alertNotificationService,
170- Controllers::MotorController& motorController)
171- : notifNr {notifNr}, notifNb {notifNb}, mode {mode}, alertNotificationService {alertNotificationService}, motorController{motorController} {
174+ Controllers::MotorController& motorController,
175+ uint32_t * timeoutEnd)
176+ : notifNr {notifNr}, notifNb {notifNb}, mode {mode}, alertNotificationService {alertNotificationService},
177+ motorController{motorController}, timeoutEnd{timeoutEnd} {
172178
173179 lv_obj_t * container1 = lv_cont_create (lv_scr_act (), NULL );
174180
@@ -251,7 +257,7 @@ Notifications::NotificationItem::NotificationItem(const char* title,
251257 label_mute = lv_label_create (bt_mute, nullptr );
252258 lv_label_set_text (label_mute, Symbols::volumMute);
253259 lv_obj_set_style_local_bg_color (bt_mute, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GRAY);
254-
260+ timeoutOnHold = true ;
255261 } break ;
256262 }
257263
@@ -266,24 +272,31 @@ Notifications::NotificationItem::NotificationItem(const char* title,
266272void Notifications::NotificationItem::OnAcceptIncomingCall (lv_event_t event) {
267273 if (event != LV_EVENT_CLICKED)
268274 return ;
269- motorController. stopRunning ();
275+ callPreviewInteraction ();
270276 alertNotificationService.AcceptIncomingCall ();
271277}
272278
273279void Notifications::NotificationItem::OnMuteIncomingCall (lv_event_t event) {
274280 if (event != LV_EVENT_CLICKED)
275281 return ;
276- motorController. stopRunning ();
282+ callPreviewInteraction ();
277283 alertNotificationService.MuteIncomingCall ();
278284}
279285
280286void Notifications::NotificationItem::OnRejectIncomingCall (lv_event_t event) {
281287 if (event != LV_EVENT_CLICKED)
282288 return ;
283- motorController. stopRunning ();
289+ callPreviewInteraction ();
284290 alertNotificationService.RejectIncomingCall ();
285291}
286292
293+ inline void Notifications::NotificationItem::callPreviewInteraction () {
294+ *timeoutEnd = xTaskGetTickCount () + (5 * 1024 );
295+ timeoutOnHold = false ;
296+ motorController.stopRunning ();
297+ }
298+
299+
287300Notifications::NotificationItem::~NotificationItem () {
288301 lv_obj_clean (lv_scr_act ());
289302}
0 commit comments