@@ -11,8 +11,13 @@ extern lv_font_t jetbrains_mono_bold_20;
1111Notifications::Notifications (DisplayApp* app,
1212 Pinetime::Controllers::NotificationManager& notificationManager,
1313 Pinetime::Controllers::AlertNotificationService& alertNotificationService,
14+ Controllers::MotorController& motorController,
1415 Modes mode)
15- : Screen(app), notificationManager {notificationManager}, alertNotificationService {alertNotificationService}, mode {mode} {
16+ : Screen(app),
17+ notificationManager {notificationManager},
18+ alertNotificationService {alertNotificationService},
19+ motorController{motorController},
20+ mode {mode} {
1621 notificationManager.ClearNewNotificationFlag ();
1722 auto notification = notificationManager.GetLastNotification ();
1823 if (notification.valid ) {
@@ -23,7 +28,8 @@ Notifications::Notifications(DisplayApp* app,
2328 notification.category ,
2429 notificationManager.NbNotifications (),
2530 mode,
26- alertNotificationService);
31+ alertNotificationService,
32+ motorController);
2733 validDisplay = true ;
2834 } else {
2935 currentItem = std::make_unique<NotificationItem>(" Notification" ,
@@ -32,10 +38,13 @@ Notifications::Notifications(DisplayApp* app,
3238 notification.category ,
3339 notificationManager.NbNotifications (),
3440 Modes::Preview,
35- alertNotificationService);
41+ alertNotificationService,
42+ motorController);
3643 }
3744
3845 if (mode == Modes::Preview) {
46+
47+
3948
4049 timeoutLine = lv_line_create (lv_scr_act (), nullptr );
4150
@@ -63,7 +72,10 @@ bool Notifications::Refresh() {
6372 timeoutLinePoints[1 ].x = pos;
6473 lv_line_set_points (timeoutLine, timeoutLinePoints, 2 );
6574 }
66-
75+ // make sure we stop any vibrations before exiting
76+ if (!running) {
77+ motorController.stopRunning ();
78+ }
6779 return running;
6880}
6981
@@ -92,7 +104,8 @@ bool Notifications::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
92104 previousNotification.category ,
93105 notificationManager.NbNotifications (),
94106 mode,
95- alertNotificationService);
107+ alertNotificationService,
108+ motorController);
96109 }
97110 return true ;
98111 case Pinetime::Applications::TouchEvents::SwipeUp: {
@@ -117,7 +130,8 @@ bool Notifications::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
117130 nextNotification.category ,
118131 notificationManager.NbNotifications (),
119132 mode,
120- alertNotificationService);
133+ alertNotificationService,
134+ motorController);
121135 }
122136 return true ;
123137 case Pinetime::Applications::TouchEvents::LongTap: {
@@ -152,8 +166,9 @@ Notifications::NotificationItem::NotificationItem(const char* title,
152166 Controllers::NotificationManager::Categories category,
153167 uint8_t notifNb,
154168 Modes mode,
155- Pinetime::Controllers::AlertNotificationService& alertNotificationService)
156- : notifNr {notifNr}, notifNb {notifNb}, mode {mode}, alertNotificationService {alertNotificationService} {
169+ Pinetime::Controllers::AlertNotificationService& alertNotificationService,
170+ Controllers::MotorController& motorController)
171+ : notifNr {notifNr}, notifNb {notifNb}, mode {mode}, alertNotificationService {alertNotificationService}, motorController{motorController} {
157172
158173 lv_obj_t * container1 = lv_cont_create (lv_scr_act (), NULL );
159174
@@ -236,8 +251,10 @@ Notifications::NotificationItem::NotificationItem(const char* title,
236251 label_mute = lv_label_create (bt_mute, nullptr );
237252 lv_label_set_text (label_mute, Symbols::volumMute);
238253 lv_obj_set_style_local_bg_color (bt_mute, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GRAY);
254+
239255 } break ;
240256 }
257+
241258
242259 lv_obj_t * backgroundLabel = lv_label_create (lv_scr_act (), nullptr );
243260 lv_label_set_long_mode (backgroundLabel, LV_LABEL_LONG_CROP);
@@ -249,21 +266,21 @@ Notifications::NotificationItem::NotificationItem(const char* title,
249266void Notifications::NotificationItem::OnAcceptIncomingCall (lv_event_t event) {
250267 if (event != LV_EVENT_CLICKED)
251268 return ;
252-
269+ motorController. stopRunning ();
253270 alertNotificationService.AcceptIncomingCall ();
254271}
255272
256273void Notifications::NotificationItem::OnMuteIncomingCall (lv_event_t event) {
257274 if (event != LV_EVENT_CLICKED)
258275 return ;
259-
276+ motorController. stopRunning ();
260277 alertNotificationService.MuteIncomingCall ();
261278}
262279
263280void Notifications::NotificationItem::OnRejectIncomingCall (lv_event_t event) {
264281 if (event != LV_EVENT_CLICKED)
265282 return ;
266-
283+ motorController. stopRunning ();
267284 alertNotificationService.RejectIncomingCall ();
268285}
269286
0 commit comments