This differential overrides onNewToken method of FirebaseMessagineService to send broadcast to CommAndroidNotificationsEventEmitter with new token. CommAndroidNotificationsEventEmitter receives broadcast with token and send event to JavaScript. On the Js side we register to listen to
this type of event and react to it in the same way we used to.
Details
Build the app. Notifications should be delivered, since the device token should be correctly received.
Diff Detail
- Repository
- rCOMM Comm
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
native/android/app/src/main/java/app/comm/android/notifications/CommNotificationsHandler.java | ||
---|---|---|
84 ↗ | (On Diff #20980) | Should we save the broadcast manager as an instance variable just like we do e.g. with notification manager? |
native/push/android.js | ||
47 ↗ | (On Diff #20980) | Why do we use optional string? |
native/push/push-handler.react.js | ||
151 ↗ | (On Diff #20980) | Is it the only place where this const is used? |
native/push/push-handler.react.js | ||
---|---|---|
151 ↗ | (On Diff #20980) | Oh, you were talking about "commAndroidNotificationsToken" string not const commAndroidNotificationsEventEmitter. Well, it might be messy to introduce change in this (and other differentials that subscribe to events), but adding a differential on top of the stack that adds those strings to getConstants and replaces usages will be straight forward. We already did so for iOS. |
native/push/push-handler.react.js | ||
---|---|---|
151 ↗ | (On Diff #20980) | This diff stack is already growing, so I will wait with implementing this feature until it is landed. I also noticed that we actually didn't implement this feature on iOS. I will create a follow up task to replace event names strings with constants exported from native modules. It should be straightforward - entire API is set, we just need to put more data in dictionaries and use them in JavaScript. |