GeezerVison is showing github.com — Dismiss Notifications (Swipe right) by Tiggilyboo · Pull Request #1150 · InfiniTimeOrg/InfiniTime
Conversation
Tiggilyboo
commented
May 19, 2022
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Hello all,
I've implemented dismissal of a notification by swiping right on each. This triggers an animation which throws the animation offscreen, then renders the next available notification.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
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.
Usually a PR should be focused on one topic or a single feature for example. Some of the changes here should be split off to at least one more PR.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Tiggilyboo
changed the title
Dismiss Notifications (Swipe right) & Analogue face changes (Stepmeter using hour indicators)
Dismiss Notifications (Swipe right)
May 19, 2022
Tiggilyboo
commented
May 19, 2022
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Usually a PR should be focused on one topic or a single feature for example. Some of the changes here should be split off to at least one more PR.
No problem, I have made this PR into the notifications dismissal and now creating the other watch face related one (here: #1151)
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
I found a bug:
If i send 1 notification and dismiss it, the 'no notifications' "notification" shows and the counter is 0/0 as it should be.
but if I send another notifications and dismiss it, a black screen shows with the counter at 1/2.
sending and dismissing another notification causes the counter total to be incremented.
here is a video:
pt_notif_dismiss_bug.mp4
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Tiggilyboo
commented
May 19, 2022
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
|
Nice catch, taking a look at this now. Thanks @Itai-Nelken
EDIT: Odd, it does not happen on InfiniSim, and for some reason my OTA image is not flashing (Pinecone gets to the top after 100%, screen blanks and then it goes back to pinecone. Assumedly the firmware is not happy, and reverts back to verified image).
I have pushed a further change below which fixed an issue with the array assignment when dismissing. I think this should fix your issue with blank notifications.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Happened for me in InfiniSim (create a notification, swipe it away, go back to watchface, swipe down to get to notifications, see total counter is still counted up)
with your fix it doesn't happen on InfiniSim anymore
|
Tiggilyboo reacted with thumbs up emoji
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
- Cleaned up animation delay value (one place to configure in header)
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.
didn't get through all of it, but ran out of time. Submitting notes up until now
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Tiggilyboo reacted with thumbs up emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
|
Mostly fixed. Now if I send 5 notifications and then dismiss them all, same thing happens.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
found a dismissal problem. Steps to reproduce
- start simulator
- hit
n three times
- dismiss the second (2/3) notification

- swipe down to see the oldest notification with wrong index
3/2

Doesn't happen if I swipe away the first 1/3 notification. Then the remaining notifications read 1/2 and 2/2
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Found a complication, which needs to be handled: The notifications array is used as a ring buffer
- In the beginning
readIndex and writeIndex are 0
- after the first push
readIndex is still 0, and writeIndex is 1
writeIndex will always be one more advanced than readIndex
- after the fifth insert
readIndex will be 4 and writeIndex has wrapped to be 0
- with the next push we're at
readIndex is 0, and writeIndex is 1
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
- Not very pretty, but it seems to work well: reassign id's
after removing a notification in order to preserve index calculation
for GetPrevious and GetNext.
- Fix index jumping after dismissal, only use GetPrevious or
GetLastNotification calls after dismiss.
Tiggilyboo
commented
May 21, 2022
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
found a dismissal problem. Steps to reproduce
* start simulator
* hit `n` three times
* dismiss the second (2/3) notification

* swipe down to see the oldest notification with wrong index `3/2`

Doesn't happen if I swipe away the first 1/3 notification. Then the remaining notifications read 1/2 and 2/2
I think I've fixed this now in my latest commit. Sad news, it's really not the nicest work around. As you've also pointed out, it uses a ring buffer, which means the tail and head are shifting about and indexes and the indexes that are displayed for each notification depends on an ever increasing id. In addition the readIndex and writeIndex now encorperates decrement logic to follow the ring buffer shenanigans.
EDIT:
So my solution was to decrement each valid notification id that is above the dismissed notification id. Afterward, reassign the nextId incrementation based on the highest last id (aka. notifications[readIndex].id + 1).
It now seems to be behaving predictably.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
- Try to use more LV_HOR_RES / LV_VER_RES where applicable in place of
magic 240's
- Revert page to lv_container as the styling parts were not working with
LV_PAGE_PART_BG (background colour, padding, border etc.).
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
|
Found a way to break the current code:
- start simulator
- hit
n 7 times (create seven notifications)
- swipe down to get to the notifications

- swipe away two times
- 0/0 notifications shown

|
Tiggilyboo reacted with thumbs up emoji
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Found a way to break the current code:
* start simulator
* hit `n` 7 times (create seven notifications)
* swipe down to get to the notifications

* swipe away two times
* 0/0 notifications shown

Having a go at this... This is tripping me up quite a bit!
The issue also happens for n == 6.
It seems that:
- n == 7: readIndex = 1
- dismiss 1: readIndex = 0
- dismess 2: readIndex loops back to 4.
- Then notifications[4] is an empty element, and shows it. As notifications[TotalNbNotifications - 1] = {} every dismiss. Which seems to be the problem...
In order to fix this, I need to be able to dismiss based on readIndex's position, not just from dismissed element to end of array... I think.
11111 // n == 7
^
11110 // dismiss x1
^
11100 // dismiss x2
^
Cooking something up... If anyone has any ideas, let me know!
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
NeroBurner
commented
Jun 1, 2022
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
|
I've created a SmallRingBuffer class to hide the ringbuffer index handling inside. And outside the index from 0 to 4 can be requested. You're welcome to test it :)
It needs some restructure and cleanups, but I think it is working
edit: cleaned up: NeroBurner@ef0facf
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
@Tiggilyboo I liked the swipe to dismiss feature so much I opened a new PR #1173 with the code from this PR, rebased it and added the ring-buffer rework. Is it ok for you to move to the new PR, or would you like to update this PR instead and champion the changes yourself? Either one is fine by me, I just want the notification dismissal feature 😁
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
@Tiggilyboo I liked the swipe to dismiss feature so much I opened a new PR #1173 with the code from this PR, rebased it and added the ring-buffer rework. Is it ok for you to move to the new PR, or would you like to update this PR instead and champion the changes yourself? Either one is fine by me, I just want the notification dismissal feature 😁
Yeah for sure get it merged, afk this weekend otherwise I would. Thanks for the ring buffer fixes!
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
You're very welcome! :)
Then I'm closing this PR in favor of my new one.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Reviewers
Riksu9000
Awaiting requested review from Riksu9000
NeroBurner
Awaiting requested review from NeroBurner
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
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.
|