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

iOS: A way to override notifee handling push notification press #1013

Closed
gezquinndesign opened this issue Mar 15, 2024 · 5 comments
Closed

Comments

@gezquinndesign
Copy link

gezquinndesign commented Mar 15, 2024

I found this issue and can see it was closed without resolution. It's close to what I would like to see.

I'm trying to set up Shake's Chat feature. To handle foreground notifications, the application needs to set itself as the UNUserNotificationCenterDelegate , and implement the didReceiveResponse and willPresentNotification methods.

The willPresentNotification works fine and the notification displays correctly. However, the didReceiveResponse is failing because it is being handled by Notifee. Is there any way to override this method in a react-native-project via the AppDelegate.mm file as suggested in the Shake docs?

@gezquinndesign
Copy link
Author

I found this PR, applied the changes and this fixes my issue, so closing this in anticipation of that getting merged.

@carlbleick
Copy link

@gezquinndesign Did you replace all push notification press actions with your own custom UNUserNotificationCenterDelegate by Shake's Chat feature? Or are you still managing some push notification presses directly via notifee?

@gezquinndesign
Copy link
Author

Hi @carlbleick, if and when the PR gets merged, I’m expecting to still use notifee to manage the non-shake notifications. The custom handler intercepts the notification press, checks if it’s from Shake and deals with it accordingly. If it’s not a Shake notification it just calls the usual completionHandler. I hope that makes sense. Any reason you want to know?

@carlbleick
Copy link

@gezquinndesign Thanks for your reply! It makes sense to me. I just dont quite understand how the notifee code knows wether the Shake delegate is reacting to that specific notification or not.
I understood it in a way that notifee would always call the Shake delegate as soon as there is one - not explicitly checking wether that specific notification is actually handled.

Have you tested the behaviour yourself already or are you waiting for the PR merge?

I want to know because I am currently patching the library myself to do almost the same (#925).

@gezquinndesign
Copy link
Author

Hi @carlbleick, I applied the changes in the PR directly in my app code along with the code changes in AppDelegate suggested by Shake, it worked as expected. However, I didn’t get round to testing non-Shake notification presses with those changes applied but I believe they should still be handled by notifee because the fallback is just to run the original delegate completionHandler.

My understanding might be a little off but I’d suggest applying the PR changes directly in your own code to see if the merge would resolve your own situation.

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

No branches or pull requests

2 participants