Rocket.Chat.ReactNative icon indicating copy to clipboard operation
Rocket.Chat.ReactNative copied to clipboard

iOS notifications, but no badge count

Open aimeecringle opened this issue 2 years ago • 2 comments

Description:

I receive iOS notifications, but the badge count (any number) never appears.

Environment Information:

  • Rocket.Chat Server Version: 4.8.1
  • Rocket.Chat App Version: 4.28.0
  • Device Name: iPhone / iPad
  • OS Version: iPhone 15.5 / iPad 15.5

Steps to reproduce:

  1. Follow the documentation step for step: https://developer.rocket.chat/mobile-app/mobile-app-white-labelling/ios-app-white-labelling
  2. Build the App to physical device
  3. Log in with user
  4. Send user a message so push notification is sent

Expected behavior:

I would expect a badge to appear when I receive a push notifications.

Actual behavior:

The badge never appears when I receive push notifications.

Additional context:

The only thing I can think of, is that it has to do with the Rocket.Chat target (see attached image), which is in my Xcode project, but absent from the documentation. I’m new to ReactNative and iOS development in general, so I will miss things if the docs miss things. Android notifications and badges work as expected.

Targets

aimeecringle avatar Jun 10 '22 15:06 aimeecringle

Same here

SafdarSikander avatar Jun 19 '22 14:06 SafdarSikander

@aimeecringle I sent you a message on rocket.chat We need help trying to find a solution.

dnlsilva avatar Jul 12 '22 17:07 dnlsilva

I experience the same, but with the standard Rocket.Chat app.

Self hosted server 5.4.3, iOS App 4.35.1.37441, using the push service from cloud.rocket.chat. My iOS is 16.2.

After a quick research it appears to me, that the icon badge counter is set by local notifications, not with push notifications. So the App would wake up from the push notification and then set the badge counter accordingly with local notifications. Here is an article how to set that up with ReactNative: Creating React Native badge components in iOS - LogRocket Blog (I didn’t look at the code of the iOS App yet, so no idea if it maybe is already done that way.)

ansiwen avatar Mar 01 '23 13:03 ansiwen

@ansiwen That's not the case. The badge count is calculated on backend and sent on push payload.

diegolmello avatar Mar 01 '23 13:03 diegolmello

@diegolmello right, later in the article they also mention that.

Anyway, would be great to find the issue. Maybe a look at how https://github.com/vector-im/element-ios does that can help? That is working very reliably in this respect.

ansiwen avatar Mar 01 '23 13:03 ansiwen

image

This is my app right now. Of course it's the experimental version of the app, but nothing changed in comparison to the store build.

diegolmello avatar Mar 01 '23 13:03 diegolmello

Something maybe related: I get badges on the app symbol for private messages, but not for new unread messages in private (?) channels.

I get the push notification, and when I open the app it's there, but no badge.

phriedrich avatar Mar 01 '23 13:03 phriedrich

Something maybe related: I get badges on the app symbol for private messages, but not for new unread messages in private (?) channels.

Pretty sure that can't happen. Here's the query on backend https://github.com/RocketChat/Rocket.Chat/blob/0abc0d6d446e46b68c92fe31b9d4a2c89fb45d7a/apps/meteor/server/models/raw/Subscriptions.ts#L30

diegolmello avatar Mar 01 '23 14:03 diegolmello

@diegolmello You're right! That was a setting on the server side, showing the counter for channels only for mentions. Switching the counter to all messages, also shows the badge for those.

But maybe that's also the problem for OP's test case?

phriedrich avatar Mar 01 '23 14:03 phriedrich

@phriedrich That's it! There is a global setting for that (Unread_Count), that is only set to mentions by default. I'm not surprised many people get that wrong, because virtually every other messenger system has that as a per-user setting. I mean, that's something every user wants to decide separately, no?

ansiwen avatar Mar 01 '23 15:03 ansiwen

For the record: for what messages a push notification is sent out is a per-user setting, but the read-count is a global setting.

ansiwen avatar Mar 01 '23 15:03 ansiwen

@diegolmello and you are obviously using the "Platin Edition" of the app, of course everything will work perfectly there. 😋

ansiwen avatar Mar 01 '23 15:03 ansiwen

Great to hear that. I'm going to close the issue. @aimeecringle feel free to comment here if it doesn't solve it for you.

@ansiwen hahaha you would be amazed on the amount of issues we find on daily basis while trying new things 😅

diegolmello avatar Mar 01 '23 16:03 diegolmello