Skip to content

Commit 9e8dd9a

Browse files
committed
NotificationItem now also redefines the start of the timeout
1 parent 56af4a0 commit 9e8dd9a

2 files changed

Lines changed: 16 additions & 8 deletions

File tree

src/displayapp/screens/Notifications.cpp

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ Notifications::Notifications(DisplayApp* app,
3030
mode,
3131
alertNotificationService,
3232
motorController,
33-
&timeoutTickCountEnd);
33+
&timeoutTickCountEnd,
34+
&timeoutTickCountStart);
3435
validDisplay = true;
3536
} else {
3637
currentItem = std::make_unique<NotificationItem>("Notification",
@@ -41,7 +42,8 @@ Notifications::Notifications(DisplayApp* app,
4142
Modes::Preview,
4243
alertNotificationService,
4344
motorController,
44-
&timeoutTickCountEnd);
45+
&timeoutTickCountEnd,
46+
&timeoutTickCountStart);
4547
}
4648

4749
if (mode == Modes::Preview) {
@@ -105,7 +107,8 @@ bool Notifications::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
105107
mode,
106108
alertNotificationService,
107109
motorController,
108-
&timeoutTickCountEnd);
110+
&timeoutTickCountEnd,
111+
&timeoutTickCountStart);
109112
}
110113
return true;
111114
case Pinetime::Applications::TouchEvents::SwipeUp: {
@@ -132,7 +135,8 @@ bool Notifications::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
132135
mode,
133136
alertNotificationService,
134137
motorController,
135-
&timeoutTickCountEnd);
138+
&timeoutTickCountEnd,
139+
&timeoutTickCountStart);
136140
}
137141
return true;
138142
case Pinetime::Applications::TouchEvents::LongTap: {
@@ -169,9 +173,10 @@ Notifications::NotificationItem::NotificationItem(const char* title,
169173
Modes mode,
170174
Pinetime::Controllers::AlertNotificationService& alertNotificationService,
171175
Controllers::MotorController& motorController,
172-
uint32_t* timeoutEnd)
176+
uint32_t* timeoutEnd,
177+
uint32_t* timeoutStart)
173178
: notifNr{notifNr}, notifNb{notifNb}, mode{mode}, alertNotificationService{alertNotificationService},
174-
motorController{motorController}, timeoutEnd{timeoutEnd} {
179+
motorController{motorController}, timeoutEnd{timeoutEnd}, timeoutStart{timeoutStart} {
175180
lv_obj_t* container1 = lv_cont_create(lv_scr_act(), NULL);
176181

177182
lv_obj_set_style_local_bg_color(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x222222));
@@ -286,7 +291,8 @@ void Notifications::NotificationItem::OnRejectIncomingCall(lv_event_t event) {
286291
}
287292

288293
inline void Notifications::NotificationItem::callPreviewInteraction() {
289-
*timeoutEnd = xTaskGetTickCount() + (5 * 1024);
294+
*timeoutStart = xTaskGetTickCount();
295+
*timeoutEnd = *timeoutStart + (5 * 1024);
290296
timeoutOnHold = false;
291297
motorController.stopRunning();
292298
}

src/displayapp/screens/Notifications.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ namespace Pinetime {
3737
Modes mode,
3838
Pinetime::Controllers::AlertNotificationService& alertNotificationService,
3939
Controllers::MotorController& motorController,
40-
uint32_t* timeoutEnd);
40+
uint32_t* timeoutEnd,
41+
uint32_t* timeoutStart);
4142
~NotificationItem();
4243
bool Refresh() {
4344
return false;
@@ -66,6 +67,7 @@ namespace Pinetime {
6667
lv_obj_t* label_reject;
6768
lv_obj_t* bottomPlaceholder;
6869
uint32_t* timeoutEnd;
70+
uint32_t* timeoutStart;
6971
Modes mode;
7072
Pinetime::Controllers::AlertNotificationService& alertNotificationService;
7173
Controllers::MotorController& motorController;

0 commit comments

Comments
 (0)