Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

notifications: Dismiss to watchface when empty #1716

Merged
merged 2 commits into from
Sep 18, 2024

Conversation

eliedrian
Copy link
Contributor

I found it slightly annoying that dismissing all notifications leaves me with a "No notification to display" message. Instead of dismissing to a relatively useless message, dismiss to watchface.

@github-actions
Copy link

github-actions bot commented Mar 30, 2023

Build checks have not completed. Possible reasons for this are:

  1. The checks need to be approved by a maintainer
  2. The branch has conflicts
  3. The firmware build has failed

Copy link
Contributor

@Riksu9000 Riksu9000 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like an interesting idea. The animation isn't working as I'd expect though. I expect the sideways dismiss animation to go to a black screen and then slide up to the watch face.

@@ -82,7 +82,6 @@ void Notifications::Refresh() {

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

@Riksu9000 Riksu9000 Mar 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this line has been deleted because it isn't necessary. Can you confirm the intent?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's right. No longer necessary. running is set to false. Previously, currentItem would be populated with the "No notifications to display" notification item.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well this is for the preview mode, so I believe it's not exactly necessary for this change. It should be explained in the commit description.

src/displayapp/screens/Notifications.cpp Outdated Show resolved Hide resolved
Comment on lines -120 to +119
running = currentItem->IsRunning() && running;
running = running && currentItem->IsRunning();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change isn't necessary.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is safer. Setting running to false implies we're ending the screen. It'd be a waste to create an item to assign to currentItem when we're ending anyway.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I see. I didn't realize that currentItem is left a nullptr in another function, and removing line 116 means it stays nullptr. Looks like this is more of an issue with code clarity. You should squash the fixup commits and explain these things in the commit message.

src/displayapp/screens/Notifications.cpp Outdated Show resolved Hide resolved
@eliedrian
Copy link
Contributor Author

Also addressed the strange animation.

Earlier, screen was flagged to be killed without the animation occurring.

@eliedrian eliedrian force-pushed the main branch 4 times, most recently from 3c734a0 to b49a84d Compare March 31, 2023 03:52
@eliedrian
Copy link
Contributor Author

Squashed.

Also updated the comment instead of fully removing it.

@LinuxinaBit
Copy link

Oh, thank you so much, I've been wanting a feature like this for so long!

@Riksu9000 Riksu9000 self-requested a review April 16, 2023 11:32
mark9064 added a commit to mark9064/InfiniTime that referenced this pull request May 8, 2023
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
mark9064 added a commit to mark9064/InfiniTime that referenced this pull request May 27, 2023
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
@mark9064
Copy link
Member

mark9064 commented Nov 6, 2023

Have been daily driving this for months, zero issues

@mark9064
Copy link
Member

Are there any outstanding issues preventing this from being merged? To me this is an easy usability improvement and as far as I can see all review comments have been addressed

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
@eliedrian
Copy link
Contributor Author

Yes, anything lacking from this?

@marigoldfish
Copy link

One more voice in support of this PR being merged :)

@JF002 JF002 added this to the 1.15.0 milestone Aug 19, 2024
Copy link
Contributor

@NeroBurner NeroBurner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looking good. I like the feature

@NeroBurner NeroBurner merged commit a266202 into InfiniTimeOrg:main Sep 18, 2024
5 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants