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

[FIX] Fix badge counter on iOS push notifications #6950

Merged
merged 1 commit into from
May 16, 2017

Conversation

sampaiodiego
Copy link
Member

@RocketChat/core

Closes #6356

@sampaiodiego sampaiodiego requested review from rodrigok and rafaelks May 11, 2017 15:20
@engelgabriel engelgabriel temporarily deployed to rocket-chat-pr-6950 May 11, 2017 15:21 Inactive
@geekgonecrazy
Copy link
Contributor

geekgonecrazy commented May 11, 2017

What about multi server? If you set the count doesn't iOS take that number regardless? So if server a said badge: 5 and server b said badge: 1 wouldn't the badge count alternate between the two badge counts?

@sampaiodiego
Copy link
Member Author

multi-instances will be handled by client.. the app should store a counter by server and display the correct number.. @rafaelks is aware of it RocketChat/Rocket.Chat.iOS#460 :)

@sampaiodiego sampaiodiego changed the title Fix badge counter on iOS push notifications [FIX] Fix badge counter on iOS push notifications May 11, 2017
@geekgonecrazy
Copy link
Contributor

@sampaiodiego ok just checking it was my understanding that if the app set it, and a push notification came in.. it would automatically take what the push notification told it.

So if the iOS app had calculated 10 total and set it to 10. When a new push came in that said badge: 5 that it would automatically set it back to 5.

Just want to make sure so it doesn't cause any issues with crazy counts down the road.
@rafaelks

@sampaiodiego
Copy link
Member Author

@geekgonecrazy nope.. like if the server A send a badge count of 5, when the app receives it, it will show 5 and store on it's local DB.. if server B send a badge count 2, the app will sum stored badges from all servers and then show it, so in this case it would show 7..

also if the user clicks on server B notification (or opens the app and connects to server B), the would clean up only the badges for server B and then show 5 again..

this is how I think it should work.. 😬

@rafaelks
Copy link
Contributor

@sampaiodiego @geekgonecrazy The value of the badge property here will always override whatever I have in the app. If the app has 10 and the push contains badge: 5, the app will (automatically) change the badge number to 5 and I cannot do anything about it.

Since we don't support multi-server right now on the client, I don't worry about it now. At some point, we'll need to change it (I think) to support the badge for multiple servers. I don't know yet what's the best solution for it, but we really don't need to worry about it right now.

Note: I think I have a way to handle the notification and manipulate the badge, but I haven't tried yet.

@rodrigok
Copy link
Member

Since the solution looks better than what we have now I'll merge this

@rodrigok rodrigok merged commit 7c88d8b into develop May 16, 2017
@rodrigok rodrigok deleted the fix-badge-counter-on-push-notifications branch May 16, 2017 14:43
@rodrigok rodrigok added this to the 0.57.0 milestone May 16, 2017
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.

ios push notification uses always badge:1
5 participants