Add app version if available #102
Merged
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.
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 is0
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