-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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(messaging,ios): keep original UNUserNotificationCenter delegate #3427
Conversation
Keeps a reference to any original UNUserNotificationCenter delegates that are set before we replace the delegate with out own implementation. Internally we will also call the original delegate if our code does not already handle the delegate call. This should keep compatibility with other RN modules that set the delegate.
Codecov Report
@@ Coverage Diff @@
## master #3427 +/- ##
=========================================
Coverage ? 85.25%
=========================================
Files ? 108
Lines ? 3429
Branches ? 0
=========================================
Hits ? 2923
Misses ? 506
Partials ? 0 |
This reverts commit b355a86
I tried what I've tried:
|
@radko93 can you show me your AppDelegate.m file contents? |
With |
Have you requested permission to display notifications and accepted? Can you show some code? |
I'm getting remote notifications in the background so I need to have permissions. I have something like this (using
and
|
Tried to use this PR. Still, I am not getting the AppDelegate |
@sivakumar-cf I need to know more information other than 'its not working', show me your app delegate code, your code that calls registerForRemoteMessages, which libraries are you using, device or simulator, etc etc? |
I am using
|
@Salakar I am getting notifications only when the app enters background or in the Killed state, But the AppDelegate notifications delegate callbacks are not getting called due to swizzling. Is there any way I can disable firebase swizzling methods, and manually send the callbacks to react-native-firebase SDK? |
@radko93 @Salakar I can confirm the package published to Setup:
Configuration: AppDelegate is configured strongly by following guides, with no differences. Note: not sure if it is documented, but you should also upload the certificates to firebase console (done via Result: Push notifications are displayed well if sent by firebase console, but not with other services. |
@artyorsh but does it also work in foregorud? |
@radko93 yes. Works as expected in case the notification is sent with firebase console |
Update on #3427 (comment): That was my issue not reading sendbird docs carefully. What they say - the app state should be handled with their APIs. The screenshot below might be helpful for sendbird users who stuck into same issue) This makes an issue I described invalid. |
@sivakumar-cf I also had this question about swizzling, I think RN Firebase now takes stuff straight from native Firebase further up the chain and there is no exposed Obj-c method to trigger notifications like in v5. So you need to bypass swizzling there. https://firebase.google.com/docs/cloud-messaging/ios/client#objective-c_6 I had to do this so I could receive Intercom push notifications as well as Firebase. Edit: Actually this didn't work, I'm a bit lost to be honest. v6 is very different from v5 and a lot of things I've found common practice over the past few years regarding push seem to be gone. Edit2: I got it, I was missing |
Seems like you're not the only one missing this - so I've just pushed a change where registration is now done automatically (with the option to opt-out of auto-registration if required) |
Oh you legend!!! Thanks so much!!! |
Fixes / supersedes #3425
* fix(messaging): add activity check to getInitialNotification * fix(messaging): add activity check to getInitialNotification * Update .spellcheck.dict.txt Co-authored-by: Mike Diarmid <[email protected]>
…ertase#3427) * fix(messaging,ios): keep original UNUserNotificationCenter delegate Keeps a reference to any original UNUserNotificationCenter delegates that are set before we replace the delegate with out own implementation. Internally we will also call the original delegate if our code does not already handle the delegate call. This should keep compatibility with other RN modules that set the delegate. * v6.4.1-alpha.0 * Revert "v6.4.1-alpha.0" This reverts commit b355a86 * feat: automatically register with APNs * docs: typos * fix: forward delegate call to FIRAuth Fixes / supersedes invertase#3425 * fix(messaging): add activity check to getInitialNotification (invertase#3495) * fix(messaging): add activity check to getInitialNotification * fix(messaging): add activity check to getInitialNotification * Update .spellcheck.dict.txt Co-authored-by: Mike Diarmid <[email protected]> Co-authored-by: Elliot Hesp <[email protected]>
Just had a funny moment debugging an RN Firebase push issue, found this issue and my own comments from last year 🤦♂️ |
…ertase#3427) * fix(messaging,ios): keep original UNUserNotificationCenter delegate Keeps a reference to any original UNUserNotificationCenter delegates that are set before we replace the delegate with out own implementation. Internally we will also call the original delegate if our code does not already handle the delegate call. This should keep compatibility with other RN modules that set the delegate. * v6.4.1-alpha.0 * Revert "v6.4.1-alpha.0" This reverts commit b355a86 * feat: automatically register with APNs * docs: typos * fix: forward delegate call to FIRAuth Fixes / supersedes invertase#3425 * fix(messaging): add activity check to getInitialNotification (invertase#3495) * fix(messaging): add activity check to getInitialNotification * fix(messaging): add activity check to getInitialNotification * Update .spellcheck.dict.txt Co-authored-by: Mike Diarmid <[email protected]> Co-authored-by: Elliot Hesp <[email protected]>
Keeps a reference to any original
UNUserNotificationCenter
delegates that are set before we replace the delegate with out own implementation. Internally we will also call the original delegate if our code does not already handle the delegate call (e.g. non FCM related notifications). This should keep compatibility with other RN modules that set the delegate.