only activate the timeout on call notification previews after they have been interacted with
This commit is contained in:
parent
d13dd6dee3
commit
5da65494b3
|
@ -29,7 +29,8 @@ Notifications::Notifications(DisplayApp* app,
|
||||||
notificationManager.NbNotifications(),
|
notificationManager.NbNotifications(),
|
||||||
mode,
|
mode,
|
||||||
alertNotificationService,
|
alertNotificationService,
|
||||||
motorController);
|
motorController,
|
||||||
|
&timeoutTickCountEnd);
|
||||||
validDisplay = true;
|
validDisplay = true;
|
||||||
} else {
|
} else {
|
||||||
currentItem = std::make_unique<NotificationItem>("Notification",
|
currentItem = std::make_unique<NotificationItem>("Notification",
|
||||||
|
@ -39,7 +40,8 @@ Notifications::Notifications(DisplayApp* app,
|
||||||
notificationManager.NbNotifications(),
|
notificationManager.NbNotifications(),
|
||||||
Modes::Preview,
|
Modes::Preview,
|
||||||
alertNotificationService,
|
alertNotificationService,
|
||||||
motorController);
|
motorController,
|
||||||
|
&timeoutTickCountEnd);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mode == Modes::Preview) {
|
if (mode == Modes::Preview) {
|
||||||
|
@ -63,7 +65,7 @@ Notifications::~Notifications() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Notifications::Refresh() {
|
bool Notifications::Refresh() {
|
||||||
if (mode == Modes::Preview) {
|
if (mode == Modes::Preview && !currentItem->timeoutOnHold) {
|
||||||
auto tick = xTaskGetTickCount();
|
auto tick = xTaskGetTickCount();
|
||||||
int32_t pos = 240 - ((tick - timeoutTickCountStart) / ((timeoutTickCountEnd - timeoutTickCountStart) / 240));
|
int32_t pos = 240 - ((tick - timeoutTickCountStart) / ((timeoutTickCountEnd - timeoutTickCountStart) / 240));
|
||||||
if (pos < 0)
|
if (pos < 0)
|
||||||
|
@ -105,7 +107,8 @@ bool Notifications::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
|
||||||
notificationManager.NbNotifications(),
|
notificationManager.NbNotifications(),
|
||||||
mode,
|
mode,
|
||||||
alertNotificationService,
|
alertNotificationService,
|
||||||
motorController);
|
motorController,
|
||||||
|
&timeoutTickCountEnd);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
case Pinetime::Applications::TouchEvents::SwipeUp: {
|
case Pinetime::Applications::TouchEvents::SwipeUp: {
|
||||||
|
@ -131,7 +134,8 @@ bool Notifications::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
|
||||||
notificationManager.NbNotifications(),
|
notificationManager.NbNotifications(),
|
||||||
mode,
|
mode,
|
||||||
alertNotificationService,
|
alertNotificationService,
|
||||||
motorController);
|
motorController,
|
||||||
|
&timeoutTickCountEnd);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
case Pinetime::Applications::TouchEvents::LongTap: {
|
case Pinetime::Applications::TouchEvents::LongTap: {
|
||||||
|
@ -167,8 +171,10 @@ Notifications::NotificationItem::NotificationItem(const char* title,
|
||||||
uint8_t notifNb,
|
uint8_t notifNb,
|
||||||
Modes mode,
|
Modes mode,
|
||||||
Pinetime::Controllers::AlertNotificationService& alertNotificationService,
|
Pinetime::Controllers::AlertNotificationService& alertNotificationService,
|
||||||
Controllers::MotorController& motorController)
|
Controllers::MotorController& motorController,
|
||||||
: notifNr {notifNr}, notifNb {notifNb}, mode {mode}, alertNotificationService {alertNotificationService}, motorController{motorController} {
|
uint32_t* timeoutEnd)
|
||||||
|
: notifNr {notifNr}, notifNb {notifNb}, mode {mode}, alertNotificationService {alertNotificationService},
|
||||||
|
motorController{motorController}, timeoutEnd{timeoutEnd} {
|
||||||
|
|
||||||
lv_obj_t* container1 = lv_cont_create(lv_scr_act(), NULL);
|
lv_obj_t* container1 = lv_cont_create(lv_scr_act(), NULL);
|
||||||
|
|
||||||
|
@ -251,7 +257,7 @@ Notifications::NotificationItem::NotificationItem(const char* title,
|
||||||
label_mute = lv_label_create(bt_mute, nullptr);
|
label_mute = lv_label_create(bt_mute, nullptr);
|
||||||
lv_label_set_text(label_mute, Symbols::volumMute);
|
lv_label_set_text(label_mute, Symbols::volumMute);
|
||||||
lv_obj_set_style_local_bg_color(bt_mute, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GRAY);
|
lv_obj_set_style_local_bg_color(bt_mute, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GRAY);
|
||||||
|
timeoutOnHold = true;
|
||||||
} break;
|
} break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -266,24 +272,31 @@ Notifications::NotificationItem::NotificationItem(const char* title,
|
||||||
void Notifications::NotificationItem::OnAcceptIncomingCall(lv_event_t event) {
|
void Notifications::NotificationItem::OnAcceptIncomingCall(lv_event_t event) {
|
||||||
if (event != LV_EVENT_CLICKED)
|
if (event != LV_EVENT_CLICKED)
|
||||||
return;
|
return;
|
||||||
motorController.stopRunning();
|
callPreviewInteraction();
|
||||||
alertNotificationService.AcceptIncomingCall();
|
alertNotificationService.AcceptIncomingCall();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Notifications::NotificationItem::OnMuteIncomingCall(lv_event_t event) {
|
void Notifications::NotificationItem::OnMuteIncomingCall(lv_event_t event) {
|
||||||
if (event != LV_EVENT_CLICKED)
|
if (event != LV_EVENT_CLICKED)
|
||||||
return;
|
return;
|
||||||
motorController.stopRunning();
|
callPreviewInteraction();
|
||||||
alertNotificationService.MuteIncomingCall();
|
alertNotificationService.MuteIncomingCall();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Notifications::NotificationItem::OnRejectIncomingCall(lv_event_t event) {
|
void Notifications::NotificationItem::OnRejectIncomingCall(lv_event_t event) {
|
||||||
if (event != LV_EVENT_CLICKED)
|
if (event != LV_EVENT_CLICKED)
|
||||||
return;
|
return;
|
||||||
motorController.stopRunning();
|
callPreviewInteraction();
|
||||||
alertNotificationService.RejectIncomingCall();
|
alertNotificationService.RejectIncomingCall();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline void Notifications::NotificationItem::callPreviewInteraction() {
|
||||||
|
*timeoutEnd = xTaskGetTickCount() + (5 * 1024);
|
||||||
|
timeoutOnHold = false;
|
||||||
|
motorController.stopRunning();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Notifications::NotificationItem::~NotificationItem() {
|
Notifications::NotificationItem::~NotificationItem() {
|
||||||
lv_obj_clean(lv_scr_act());
|
lv_obj_clean(lv_scr_act());
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,8 @@ namespace Pinetime {
|
||||||
uint8_t notifNb,
|
uint8_t notifNb,
|
||||||
Modes mode,
|
Modes mode,
|
||||||
Pinetime::Controllers::AlertNotificationService& alertNotificationService,
|
Pinetime::Controllers::AlertNotificationService& alertNotificationService,
|
||||||
Controllers::MotorController& motorController);
|
Controllers::MotorController& motorController,
|
||||||
|
uint32_t* timeoutEnd);
|
||||||
~NotificationItem();
|
~NotificationItem();
|
||||||
bool Refresh() {
|
bool Refresh() {
|
||||||
return false;
|
return false;
|
||||||
|
@ -44,8 +45,10 @@ namespace Pinetime {
|
||||||
void OnAcceptIncomingCall(lv_event_t event);
|
void OnAcceptIncomingCall(lv_event_t event);
|
||||||
void OnMuteIncomingCall(lv_event_t event);
|
void OnMuteIncomingCall(lv_event_t event);
|
||||||
void OnRejectIncomingCall(lv_event_t event);
|
void OnRejectIncomingCall(lv_event_t event);
|
||||||
|
bool timeoutOnHold = false;
|
||||||
private:
|
private:
|
||||||
|
void callPreviewInteraction();
|
||||||
|
|
||||||
uint8_t notifNr = 0;
|
uint8_t notifNr = 0;
|
||||||
uint8_t notifNb = 0;
|
uint8_t notifNb = 0;
|
||||||
char pageText[4];
|
char pageText[4];
|
||||||
|
@ -61,6 +64,7 @@ namespace Pinetime {
|
||||||
lv_obj_t* label_mute;
|
lv_obj_t* label_mute;
|
||||||
lv_obj_t* label_reject;
|
lv_obj_t* label_reject;
|
||||||
lv_obj_t* bottomPlaceholder;
|
lv_obj_t* bottomPlaceholder;
|
||||||
|
uint32_t* timeoutEnd;
|
||||||
Modes mode;
|
Modes mode;
|
||||||
Pinetime::Controllers::AlertNotificationService& alertNotificationService;
|
Pinetime::Controllers::AlertNotificationService& alertNotificationService;
|
||||||
Controllers::MotorController& motorController;
|
Controllers::MotorController& motorController;
|
||||||
|
|
|
@ -226,7 +226,7 @@ void SystemTask::Work() {
|
||||||
if (isSleeping && !isWakingUp)
|
if (isSleeping && !isWakingUp)
|
||||||
GoToRunning();
|
GoToRunning();
|
||||||
if (notificationManager.GetLastNotification().category == Controllers::NotificationManager::Categories::IncomingCall) {
|
if (notificationManager.GetLastNotification().category == Controllers::NotificationManager::Categories::IncomingCall) {
|
||||||
motorController.startRunning(50);
|
motorController.startRunning(500);
|
||||||
} else {
|
} else {
|
||||||
motorController.RunForDuration(35);
|
motorController.RunForDuration(35);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue