Skip to content

Conversation

enahum
Copy link
Contributor

@enahum enahum commented Apr 22, 2022

Summary

With multiple server support we will now receive notifications from more than one server at a time, this notifications also include a silent notification when a channel/thread is read.

We use this silent notification to remove notifications that belong to this channel/thread from the notification center on Both Android and iOS.

There is an issue though. Once there are no more mentions the clear notification includes a badge with a value of 0. When the badge is 0 on iOS devices it will remove every single notification from the Notification center even those notifications from another server that you haven't read. This can cause frustration.

To avoid this scenario, I made a change to get the appVersion by adding a suffix of -v to the platform string, so we will check for the existence of this suffix to set the "appVersion" and default to "1" if it does not exist to be backwards compatible.

Then if the appVersion is greater than one it means that the app supports multiple servers, thus for a clear notification that has a badge number of zero, we will replace it with a badge of 1. By having the number one only the notifications that belong to the channel/thread are going to be removed from the notification center leaving the other ones in place.

The app internally will update the badge number on the app icon to match the amount of unread mentions and if there are no more mentions, the app will remove the badge from the icon.

This PR is mandatory before we deploy the first alpha version of v2.

Ticket Link

https://mattermost.atlassian.net/browse/MM-43486

@enahum enahum added the 1: Dev Review Requires review by a core commiter label Apr 22, 2022
@enahum enahum requested review from agnivade and larkox April 22, 2022 17:55
@github-actions
Copy link

github-actions bot commented Apr 22, 2022

Unit Test Results

  1 files  ±0    5 suites  ±0   16s ⏱️ ±0s
18 tests ±0  18 ✔️ ±0  0 💤 ±0  0 ±0 

Results for commit e6941af. ± Comparison against base commit be6dd11.

♻️ This comment has been updated with latest results.

Copy link
Contributor

@agnivade agnivade left a comment

Choose a reason for hiding this comment

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

The app internally will update the badge number on the app icon to match the amount of unread mentions and if there are no more mentions, the app will remove the badge from the icon.

Does this mean the badge value is always ignored? Or it's ignored only when it's 1?

@enahum
Copy link
Contributor Author

enahum commented Apr 25, 2022

The app internally will update the badge number on the app icon to match the amount of unread mentions and if there are no more mentions, the app will remove the badge from the icon.

Does this mean the badge value is always ignored? Or it's ignored only when it's 1?

Is never ignored, on v1 it will be set to 0, all notifications removed by the OS and that is it. If it is set to another value, only the notifications from that channel/thread are moved an nothing more happens. On v2 badge in the payload is set to 1 and as soon as it reaches the device, the notifications that beling to that channel/thread are removed and then the app processes and checks if it need to remove the badge from the icon or update it to another value to match the unread mentions

@enahum enahum merged commit f9e1e09 into master Apr 26, 2022
@enahum enahum deleted the appVersion branch April 26, 2022 11:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1: Dev Review Requires review by a core commiter
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants