GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Dismiss notifications by swiping right by NeroBurner · Pull Request #1173 · InfiniTimeOrg/InfiniTime

Conversation

@NeroBurner

@NeroBurner NeroBurner commented Jun 5, 2022

Copy link
Copy Markdown
Contributor

Original code by @Tiggilyboo at #1150 rebased on current develop branch. I just reworked the ringbuffer and squashed to one clean commit


Rework notification ring buffer to have a begin-idx and a size_ internally. And add a new interface to access the notifications by index. The 0 index is always the latest notification.

The second new function is a Dismiss function to remove the notification with a specified idx from the buffer.

Fixes: #176

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Tiggilyboo, Shatur, Mindavi, and aha999 reacted with thumbs up emoji
All reactions
  • 👍 4 reactions
@NeroBurner
NeroBurner requested review from Avamander and Riksu9000 June 5, 2022 16:06
@NeroBurner NeroBurner mentioned this pull request Jun 5, 2022
Dismiss Notifications (Swipe right) #1150
Closed
@NeroBurner NeroBurner added this to the 1.10.0 milestone Jun 5, 2022
FintasticMan
FintasticMan requested changes Jun 5, 2022
View reviewed changes

@FintasticMan FintasticMan left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Could you keep the original commits, so that then the original author is credited properly?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@NeroBurner

NeroBurner commented Jun 5, 2022

Copy link
Copy Markdown
Contributor Author

I think the original author is properly credited: commit author is still Simon Willshire, and I'm mentioned as co-author in the commit, which is also shown correctly in the GitHub overview

And I like clean commits which work by itself.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@NeroBurner
NeroBurner force-pushed the notification_dismiss_neroburner branch from e75f3cf to 3cf9e98 Compare June 5, 2022 20:31
@NeroBurner

NeroBurner commented Jun 5, 2022

Copy link
Copy Markdown
Contributor Author

fixed code formatting errors and rebased on current develop branch

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@FintasticMan

FintasticMan commented Jun 5, 2022

Copy link
Copy Markdown
Member

I think the original author is properly credited: commit author is still Simon Willshire, and I'm mentioned as co-author in the commit, which is also shown correctly in the GitHub overview

Ah ok, I didn't see @Tiggilyboo's profile picture by the commit, so I thought they weren't a co-author.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Tiggilyboo

Tiggilyboo commented Jun 6, 2022

Copy link
Copy Markdown

Nice work, testing it on my watch, so far everything's stable and working as expected!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@NeroBurner
NeroBurner force-pushed the notification_dismiss_neroburner branch 2 times, most recently from ef0cda7 to b934383 Compare June 6, 2022 19:59
@Riksu9000

Riksu9000 commented Jun 11, 2022

Copy link
Copy Markdown
Contributor

If I have notifications like this:
[3/3] oldest
[2/3]
[1/3] newest
If I swipe on the second one, it will change to the oldest notification, but the animation direction makes it look like it is coming from below, which I think is the wrong direction.

The PineTime LCD drawing is very slow and not well suited to display movement without making use of hardware scrolling. There are only a few frames of animation using this method. It would be nice if the sideways animation that's used between QuickSettings and watchface could be used here too.

TRIM_20220611_173137.mp4

There's also this old notification dismissal pull which is probably worth examining if that hasn't been done already #323.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Riksu9000
Riksu9000 removed their request for review June 12, 2022 20:37
@NeroBurner
NeroBurner force-pushed the notification_dismiss_neroburner branch from b934383 to d961ffd Compare June 16, 2022 08:22
@NeroBurner

NeroBurner commented Jun 16, 2022

Copy link
Copy Markdown
Contributor Author

fixed the direction a new notifications is moved in. Didn't touch the swipe animation as quite like the swiping animation when dismissing the notification. Would it be a show stopper to keep the little laggy animation?

Thanks to InfiniTimeOrg/InfiniSim#37 the screen transitions can also be shown in the simulator

2022-06-16_notification_dismiss_up_and_down

Tiggilyboo reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Tiggilyboo

Tiggilyboo commented Jun 16, 2022

Copy link
Copy Markdown

fixed the direction a new notifications is moved in. Didn't touch the swipe animation as quite like the swiping animation when dismissing the notification. Would it be a show stopper to keep the little laggy animation?

Thanks to InfiniTimeOrg/InfiniSim#37 the screen transitions can also be shown in the simulator

2022-06-16_notification_dismiss_up_and_down

Agree, also I quite like the animation. Is the hardware scrolling only limited to the y direction? Will take a look and see for later MR.
I had a crash a little while back but it was from one of the earlier commits, unsure of causes as of yet. Will update to this commit and try to replicate.

Good work!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Riksu9000

Riksu9000 commented Jun 16, 2022

Copy link
Copy Markdown
Contributor

I wouldn't say I like the laggy animation, but perhaps it's passable. I'd personally like for it to be changed soon after merging though if we don't change it beforehand. There is only hardware based vertical scrolling. This is why the horizontal scrolling is done in stripes.

I recently also had a crash related to notifications, but can't remember what branch I was running. It happened when notifications were already open, I think as history and not a popup, I think the screen was also on and I received a new notification.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@devnoname120

devnoname120 commented Jun 18, 2022 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

@Riksu9000 Would enabling VSync help make the animation more seamless?

Alternatively we could cheat by displaying a small thrash pop-up on top of the current notification and then use vertical scroll to go to the next notification.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@devnoname120 devnoname120 mentioned this pull request Jun 19, 2022
Increase screen drawing speed #1186
Closed
1 task done
@devnoname120

devnoname120 commented Jun 19, 2022 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

See #1186 for smooth horizontal animations.

Edit: never mind it's not a solution.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Avamander
Avamander reviewed Jun 19, 2022
View reviewed changes
Comment thread src/components/ble/NotificationManager.cpp Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/displayapp/screens/Notifications.cpp Resolved

Uh oh!

There was an error while loading. Please reload this page.

JF002
JF002 requested changes Jun 19, 2022
View reviewed changes

@JF002 JF002 left a comment

Copy link
Copy Markdown
Collaborator

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Thanks for this PR, this feature will make a lot of users happy ;-)

There are a few points I would like to discuss before merging.

I have to admit that the sliding animation looks far better than what I would have expected knowing that the whole screen is refreshed at every frame. However, this is still not on par with other animations in the project (the vertical animation is smooth thanks to the hardware scrolling effect, and the left/right animations we use for the quick menu hides the slowness of the display). On one hand, I like this animation because it's similar to what we are used to on other touch devices, and on the other side, it's still a bit laggy. I would like to keep the UI of InfiniTime as smooth as possible, so I would appreciate if we at least tried to improve this one.

The changes in the struct NotificationManager::Notification. In the original code, the struct contained a field id. Its purpose was to uniquely identify a notification regardless of it position in the buffer. I added this field knowing that in the future, we will want to remove a specific notification either via BLE or the UI. As notification are received asynchronously, a new notification could be received while another one is being removed, which could result in the wrong notification being deleted. The purpose of this id field was to ensure that the correct notification is removed.
The new implementation removed that field and also mixes the concept of id (identifier) and index (position in the buffer). I think this implementation could be reviewed to re-add the concept of id : each notification has an unique ID, and, when the Notification app wants to delete a notification, it passes the id of the notification instead of the index of the notification in the buffer.

Note : when writing this comment, I noticed that NotificationManager does not seem to be correctly protected against concurrent accesses from BLE and the UI (and was not before this PR)... that's probably something to keep in mind if we encounter crashes.

Notice that GetNext(), GetPrevious() and GetLastNotification() return the Notification by value and I did it on purpose : If they returned a ref to the notification, the content of notification could be changed/deleted by a new notification received by BLE while it's currently being processed in the Notification app. I think the new methods At() should do the same. I also find the name At() a bit confusing and inconsistent. Couldn't we name this method Get() ?

Regarding the code formatting, the variables begin_idx and read_idx and index_ do not follow the coding conventions of the project.

Well, I hope I didn't discourage you with this rather long review, and feel free to discuss those comments if you do not agree with me ;-)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

devnoname120 reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@NeroBurner

NeroBurner commented Jun 19, 2022

Copy link
Copy Markdown
Contributor Author

The easiest solution for the transition would be to use the "swipe right stripey" animation (the one that is used from clock to quicksettings) to "disintegrate" the current notification and instantly show the new one. Then the checks if a new message is shown to swipe in from below or of the top of the screen could be removed as well.

Another a bit more complicated way would be to "disintegrate" onto a black new screen, which in turn then swipes to the new message (from below or top).


The id field seemed to me like a way to have the ring buffer together with the 1/5 notification message, which I didn't need anymore after the restructure. As there was more to the id field, I'll need to re-add it again


The At() function was structured to work like the at() function of std::vector (or other random access stl-containers). If we don't want the reference a rename to Get() feels good for me (because I would expect a function named similar to a stl-container to do a similar thing)


uh, yes sorry, I need to rename those internal variables 😅


I like code reviews. They take effort and time, but the outcome is always better code and programmers who learned something new :)

devnoname120 reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@NeroBurner
NeroBurner force-pushed the notification_dismiss_neroburner branch from d742e6a to 4d85f7a Compare June 25, 2022 20:14
@NeroBurner

NeroBurner commented Jun 25, 2022

Copy link
Copy Markdown
Contributor Author

ready for re-review

  • dismiss is done by Notification::Id to really dismiss the shown message instead of the one at the current viewed index
  • instead of the swipe animation use the RightAnim screen transition for more smoothness
JF002, Tiggilyboo, and Riksu9000 reacted with thumbs up emoji
All reactions
  • 👍 3 reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@JF002

JF002 commented Jun 26, 2022

Copy link
Copy Markdown
Collaborator

Thanks @NeroBurner. The result looks quite good, IMO : https://video.codingfield.com/w/p4kXKd3Bp9co4C6yvKvjQR

But I'm still a bit troubled by the new NotificationManager : it still exposes methods with "indexes" in the public API, which is against the encapsulation goal of the original implementation.

In the original implementation, my goal was to provide a high level API to the Notification screen:

  • Get the most recent notification
  • Get the oldest notification
  • Get the next/previous notification relative to a given notification.
    Such an interface allows to completely hide the underlying implementation. When developing the Notification app, you don't need to know that the NotificationManager stores the notification in a buffer, a queue, a circular buffer, a hashmap or anything else. You don't even need to know what a Notification ID is. It's up to the notification manager to ensure that notifications are returned in the correct chronological order.

In my mind, the only change needed to add support for notification dismissal should be to add a method Dismiss(ID) to NotificationManager.

There might be good reasons to re-write a lot of the internals of NotificationManager, but I can't see them. Was the original implementation not adapted to this new use-case? Was it too complex or too difficult to understand?

However, I really think we should keep the encapsulation level as it was in the original implementation.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Avamander

Avamander commented Jun 26, 2022

Copy link
Copy Markdown
Collaborator

However, I really think we should keep the encapsulation level as it was in the original implementation.

Could we do that refactor in a follow-up PR?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@NeroBurner

NeroBurner commented Jun 26, 2022

Copy link
Copy Markdown
Contributor Author

I've got a few hours today to see how much I can rewrite the encapsulation. The reason for the rewrite was the problems with the dismiss and reordering of the notifications after a dismiss. And the dependence of the "id" to the displayed index (the notification 1/5 part on the display).

A great part of the rewrite at the Notifications.h part is due to keeping track of the current index of the displayed message. And then it is much more straightforward to access the same index (like 3/5 to 3/4), or one decremented when at the oldest message (like 5/5 to 4/4).

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@JF002

JF002 commented Jun 26, 2022

Copy link
Copy Markdown
Collaborator

Could we do that refactor in a follow-up PR?

Yes, probably :) And I'm even willing to write such PR, as I have a clear view of what I would like to achieve (and probably fail at explaining it).

Avamander reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@JF002

JF002 commented Jun 26, 2022

Copy link
Copy Markdown
Collaborator

I've got a few hours today to see how much I can rewrite the encapsulation. The reason for the rewrite was the problems with the dismiss and reordering of the notifications after a dismiss. And the dependence of the "id" to the displayed index (the notification 1/5 part on the display).

A great part of the rewrite at the Notifications.h part is due to keeping track of the current index of the displayed message. And then it is much more straightforward to access the same index (like 3/5 to 3/4), or one decremented when at the oldest message (like 5/5 to 4/4).

Thanks for the explanation! So yes, indeed, changes in NotificationManager were indeed needed! I didn't realize that when reading the PR.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@NeroBurner
NeroBurner force-pushed the notification_dismiss_neroburner branch from f757c94 to effecd6 Compare June 26, 2022 16:05
@NeroBurner

NeroBurner commented Jun 26, 2022 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor Author

That was easier than I expected 🎉

InfiniSim_2022-06-25_182651

I still needed to introduce two new functions in total:

  • Dismiss(id)
  • IndexOf(id): return the index of the notification with the specified id

This way Notification.h doesn't need to keep track of the currentIdx. The index can't be used for anything else, because the index based functions are all private

Edit: it's three new functions

  • Get(id): get the notification with the specified id
dmlls reacted with heart emoji
All reactions
  • ❤️ 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@NeroBurner
NeroBurner force-pushed the notification_dismiss_neroburner branch from effecd6 to f12bb82 Compare June 26, 2022 16:08
Riksu9000
Riksu9000 reviewed Jun 26, 2022
View reviewed changes
Comment thread src/displayapp/screens/Notifications.cpp Resolved

Uh oh!

There was an error while loading. Please reload this page.

@NeroBurner
NeroBurner force-pushed the notification_dismiss_neroburner branch from f12bb82 to 245d4a7 Compare June 26, 2022 18:16
Riksu9000
Riksu9000 reviewed Jun 26, 2022
View reviewed changes
Comment thread src/displayapp/screens/Notifications.cpp Resolved

Uh oh!

There was an error while loading. Please reload this page.

Avamander
Avamander approved these changes Jun 26, 2022
View reviewed changes
@Tiggilyboo @NeroBurner
Dismiss notifications by swiping right
8bcfde7
Add a new interface `NotificationManager::Dismiss(id)` to delete a
notification with the specified `id`.

The animate the notification dismiss the `RightAnim` transition to a
black screen is used. After the dismiss the new message is swiped in
from below or above.

If we dismiss the oldest message (when we are at 5/5, or 3/3), then the
new message after a dismiss should appear to come from below.

Otherwise (when we are at 2/3) the new message after a dismiss should
appear to come from above.

Rework the index code to show the index of the currently viewed
notification. Instead of calculating the index relative to the oldest
`id` introduce a new interface `NotificationManager::IndexOf(id)`. This
is done because the `id` of the notifications in the buffer aren't
continuous anymore (as some messages could have been dismissed).

Rework notification ring buffer to have a beginIdx and a size
internally to make the dismissal of notifications easier.

Fixes: #176

Co-authored-by: Simon Willshire <[email protected]>
Co-authored-by: Reinhold Gschweicher <[email protected]>
@NeroBurner
NeroBurner force-pushed the notification_dismiss_neroburner branch from 245d4a7 to 8bcfde7 Compare June 26, 2022 19:44
Riksu9000
Riksu9000 suggested changes Jun 27, 2022
View reviewed changes
Comment thread src/displayapp/screens/Notifications.cpp Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/displayapp/screens/Notifications.h Resolved

Uh oh!

There was an error while loading. Please reload this page.

@NeroBurner
Notifications: no inTransition screen, simple blackbox is enough
3f3b8eb
Riksu9000
Riksu9000 approved these changes Jun 28, 2022
View reviewed changes

@Riksu9000 Riksu9000 left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

This'll be a great addition to the next release. The fast animations look great.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@Riksu9000
Riksu9000 requested a review from JF002 June 28, 2022 06:57
JF002
JF002 approved these changes Jun 28, 2022
View reviewed changes

@JF002 JF002 left a comment

Copy link
Copy Markdown
Collaborator

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

It looks really good to me, thanks for making the extra effort on this PR, @NeroBurner

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@JF002
JF002 merged commit 12fad74 into develop Jun 28, 2022
@NeroBurner
NeroBurner deleted the notification_dismiss_neroburner branch June 28, 2022 18:50
@devnoname120

devnoname120 commented Jul 9, 2022

Copy link
Copy Markdown

@NeroBurner Thank you for this great feature! Could you consider to make the dismiss function also work for incoming notifications? (The screen that you see when you just received a notification and which shows is a time/progress bar until it goes back to the current app.)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@NeroBurner

NeroBurner commented Jul 11, 2022

Copy link
Copy Markdown
Contributor Author

@devnoname120 please create a separate issue (or maybe one is already open) and ping me there

It should be possible

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@devnoname120

devnoname120 commented Jul 11, 2022

Copy link
Copy Markdown

@NeroBurner Someone else created an issue in the mean time: #1232

NeroBurner reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@FintasticMan FintasticMan FintasticMan requested changes
@JF002 JF002 JF002 approved these changes
@Avamander Avamander Avamander approved these changes
+1 more reviewer
@Riksu9000 Riksu9000 Riksu9000 approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

1.10.0

Development

Successfully merging this pull request may close these issues.

Ability to dismiss notifications

Uh oh!

There was an error while loading. Please reload this page.

7 participants

@NeroBurner @FintasticMan @Tiggilyboo @Riksu9000 @devnoname120 @JF002 @Avamander
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.