-
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
feat(messaging, ios): add provideAppNotificationSettings iOS permission / handler #5972
feat(messaging, ios): add provideAppNotificationSettings iOS permission / handler #5972
Conversation
This pull request is being automatically deployed with Vercel (learn more). react-native-firebase – ./🔍 Inspect: https://vercel.com/invertase/react-native-firebase/3rMJRS7R2RT9dyH89BfYJYGki3pz react-native-firebase-next – ./website_modular🔍 Inspect: https://vercel.com/invertase/react-native-firebase-next/6yCLAXQXeNkZjGt3UXjCudux6cg6 [Deployment for 236e29e canceled] |
Hey @baylesa-dev - this looks good as a start at letting the system know that you want to provide the feature, but I think there is a callback the system will invoke if the user selects it? So there needs to be an implementation of the callback that is ... swizzled in via our AppDelegate hooks I think? ... and the ability to specify a javascript method as a handler for when that method is called? |
Codecov Report
@@ Coverage Diff @@
## main #5972 +/- ##
============================================
- Coverage 53.04% 52.99% -0.05%
Complexity 622 622
============================================
Files 208 208
Lines 10171 10183 +12
Branches 1618 1618
============================================
+ Hits 5394 5395 +1
- Misses 4523 4534 +11
Partials 254 254 |
Hey @mikehardy ! Yes you're right, this is why the PR is still draft. The method on UNUserNotificationCenter is openSettingsForNotification but I'm a bit lost for now, I'm not an expert with Objective C :/ |
I'm pretty awful at Objective-C as well, however, it looks like this is mostly done! We are already checking + delegating to the original implementation if it responds to the selector: react-native-firebase/packages/messaging/ios/RNFBMessaging/RNFBMessaging+UNUserNotificationCenter.m Lines 119 to 124 in 8efda50
I think the thing to do is after that implementation as an "else" (so it is a non-breaking change), you can try to call a javascript-level handler if one is set. Seems like the other items in the same area are emitting an event to the JS-level, then at the JS level if a handler is set, the event listener can call the handler? |
Not yet working when app is killed - |
should be fixed -> need documentation now |
I'm travelling today but will do my best to review quickly. In the meantime if you check our GitHub actions tab and find the patch package action runs for your branch they can be used for easy test integrations |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM - cool feature, this is a really nice addition, thank you!
Missed a safe-guard for android: 7006d30 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just fiddled with the documentation a tiny tiny bit since it was still being rejected as I see you working through lint and spelling and all the other little thing. Hopefully this one goes through if not I can push little changes to get it done since it has to wait on me to run the CI jobs anyway ever since github stopped running them auto for first PRs to avoid bitcoin miners.
The numbering on the documentation is irritatingly + persistently incorrect. No idea why, it's specifically 1/2/3 now but on Vercel it's 1/1/1 --> https://react-native-firebase-git-fork-baylesa-dev-fea-988d8a-invertase.vercel.app/messaging/ios-permissions#handle-button-for-in-app-notifications-settings Looks fine on the markdown preview via github https://github.com/invertase/react-native-firebase/blob/236e29e14f02e8a0dc483c4e4c10cf071f9b051a/docs/messaging/ios-permissions.md#handle-button-for-in-app-notifications-settings - which isn't worth as much, but I'm inclined to merge it and see what happens after the native e2e runs are done That's the only thing I'm fiddling with at the moment |
with apologies we seem to be having some sort of CI runner shortage issue at the moment. This is good to go, from my perspective but just to make sure I want to see a clean e2e run. I'll do a local run of the PR through android/ios e2e if it doesn't resolve shortly, then we can merge and release this thing. Thanks again, this is a really high quality PR with docs and everything, that's sincerely appreciated |
Looks like it finally ran through okay on android. I had a bit of time earlier to run it through locally myself, was fine on android and ios. Still not sure what's going on with the numbering in the docs but going to merge it to see if it was some sort of cached version somehow since I can't understand how it would possibly result in 1/1/1 when it's clearly 1/2/3 now |
Thanks a lot @mikehardy 🙏 |
Description
providesAppNotificationSettings
is useful to display a button/link in iOS settings to redirect user to in-app notification settings. However the option is not available in@react-native-firebase/messaging
Apple developer documentation | UNNotificationSettings | providesAppNotificationSettings
Checklist
Android
iOS
e2e
tests added or updated inpackages/\*\*/e2e
jest
tests added or updated inpackages/\*\*/__tests__
Test Plan
Think
react-native-firebase
is great? Please consider supporting the project with any of the below:React Native Firebase
andInvertase
on Twitter🔥