Skip to content

Commit a618f43

Browse files
committed
Fixes
1 parent e6dcb30 commit a618f43

3 files changed

Lines changed: 21 additions & 12 deletions

File tree

src/displayapp/DisplayApp.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -336,12 +336,12 @@ void DisplayApp::LoadApp(Apps app, DisplayApp::FullRefreshDirections direction)
336336

337337
case Apps::Notifications:
338338
currentScreen = std::make_unique<Screens::Notifications>(
339-
this, notificationManager, systemTask->nimble().alertService(), Screens::Notifications::Modes::Normal);
339+
this, notificationManager, systemTask->nimble().alertService(), motorController, Screens::Notifications::Modes::Normal);
340340
ReturnApp(Apps::Clock, FullRefreshDirections::Up, TouchEvents::SwipeUp);
341341
break;
342342
case Apps::NotificationsPreview:
343343
currentScreen = std::make_unique<Screens::Notifications>(
344-
this, notificationManager, systemTask->nimble().alertService(), Screens::Notifications::Modes::Preview);
344+
this, notificationManager, systemTask->nimble().alertService(), motorController, Screens::Notifications::Modes::Preview);
345345
ReturnApp(Apps::Clock, FullRefreshDirections::Up, TouchEvents::SwipeUp);
346346
break;
347347
case Apps::Timer:

src/displayapp/screens/Notifications.cpp

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ extern lv_font_t jetbrains_mono_bold_20;
1111
Notifications::Notifications(DisplayApp* app,
1212
Pinetime::Controllers::NotificationManager& notificationManager,
1313
Pinetime::Controllers::AlertNotificationService& alertNotificationService,
14+
Pinetime::Controllers::MotorController& motorController,
1415
Modes mode)
1516
: Screen(app), notificationManager {notificationManager}, alertNotificationService {alertNotificationService}, mode {mode} {
1617
notificationManager.ClearNewNotificationFlag();
@@ -35,16 +36,21 @@ Notifications::Notifications(DisplayApp* app,
3536
alertNotificationService);
3637
}
3738

38-
if (mode == Modes::Preview && notification.category != Controllers::NotificationManager::Categories::IncomingCall) {
39-
timeoutLine = lv_line_create(lv_scr_act(), nullptr);
39+
if (mode == Modes::Preview) {
40+
if (notification.category == Controllers::NotificationManager::Categories::IncomingCall) {
41+
motorController.StartRinging();
42+
} else {
43+
motorController.RunForDuration(35);
44+
timeoutLine = lv_line_create(lv_scr_act(), nullptr);
4045

41-
lv_obj_set_style_local_line_width(timeoutLine, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, 3);
42-
lv_obj_set_style_local_line_color(timeoutLine, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE);
43-
lv_obj_set_style_local_line_rounded(timeoutLine, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, true);
46+
lv_obj_set_style_local_line_width(timeoutLine, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, 3);
47+
lv_obj_set_style_local_line_color(timeoutLine, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE);
48+
lv_obj_set_style_local_line_rounded(timeoutLine, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, true);
4449

45-
lv_line_set_points(timeoutLine, timeoutLinePoints, 2);
46-
timeoutTickCountStart = xTaskGetTickCount();
47-
timeoutTickCountEnd = timeoutTickCountStart + (5 * 1024);
50+
lv_line_set_points(timeoutLine, timeoutLinePoints, 2);
51+
timeoutTickCountStart = xTaskGetTickCount();
52+
timeoutTickCountEnd = timeoutTickCountStart + (5 * 1024);
53+
}
4854
}
4955
}
5056

@@ -68,8 +74,9 @@ bool Notifications::Refresh() {
6874
}
6975

7076
bool Notifications::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
71-
if (mode != Modes::Normal)
72-
return true;
77+
if (mode != Modes::Normal) {
78+
return false;
79+
}
7380

7481
switch (event) {
7582
case Pinetime::Applications::TouchEvents::SwipeDown: {

src/displayapp/screens/Notifications.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include <memory>
66
#include "Screen.h"
77
#include "components/ble/NotificationManager.h"
8+
#include "components/motor/MotorController.h"
89

910
namespace Pinetime {
1011
namespace Controllers {
@@ -19,6 +20,7 @@ namespace Pinetime {
1920
explicit Notifications(DisplayApp* app,
2021
Pinetime::Controllers::NotificationManager& notificationManager,
2122
Pinetime::Controllers::AlertNotificationService& alertNotificationService,
23+
Pinetime::Controllers::MotorController& motorController,
2224
Modes mode);
2325
~Notifications() override;
2426

0 commit comments

Comments
 (0)