Skip to content

Commit

Permalink
notifications: Dismiss to watchface when empty InfiniTimeOrg#1716
Browse files Browse the repository at this point in the history
commit 5a07821
Author: Eli Tan <[email protected]>
Date:   Thu Mar 30 15:43:05 2023 +0800

    notifications: Dismiss to watchface when empty

    Set `running` to false to flag end of watchface when there are no more
    notifications left to display.

    notifications: Update now inaccurate comment

    notifications: Fix `currentItem` possibly being null

    Consequentially, `currentItem` can be left null when `running` is set to
    false. This is fine. The notifications screen is ending anyway.

    notifications: Delay ending screen for dismiss animation

    notifications: End screen when item is not valid
  • Loading branch information
mark9064 committed May 7, 2023
1 parent 1be2a4f commit 5c3f255
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/displayapp/screens/Notifications.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ void Notifications::Refresh() {

} else if (mode == Modes::Preview && dismissingNotification) {
running = false;
currentItem = std::make_unique<NotificationItem>(alertNotificationService, motorController);

} else if (dismissingNotification) {
dismissingNotification = false;
Expand Down Expand Up @@ -113,11 +112,11 @@ void Notifications::Refresh() {
alertNotificationService,
motorController);
} else {
currentItem = std::make_unique<NotificationItem>(alertNotificationService, motorController);
running = false;
}
}

running = currentItem->IsRunning() && running;
running = running && currentItem->IsRunning();
}

void Notifications::OnPreviewInteraction() {
Expand Down Expand Up @@ -173,7 +172,9 @@ bool Notifications::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
} else if (nextMessage.valid) {
currentId = nextMessage.id;
} else {
// don't update id, won't be found be refresh and try to load latest message or no message box
// don't update id, notification manager will try to fetch
// but not find it. Refresh will try to load latest message
// or dismiss to watchface
}
DismissToBlack();
return true;
Expand Down

0 comments on commit 5c3f255

Please sign in to comment.