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

fix(iOS): Allow the original delegate to handle non-Notifee notifications first #985

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

gotcha84
Copy link

@gotcha84 gotcha84 commented Feb 7, 2024

Issues

Fixes

Overview

For notifications received when the app is backgrounded or killed in iOS (through userNotificationCenter:didReceiveNotificationResponse:), the original delegate is not invoked for non-Notifee notifications. The existing code attempts to parse the unknown notification into a format Notifee understands before giving the original delegate a chance to handle it.

I've moved up original delegate so that it handles a non-Notifee notification first (if it exists). If there is no original delegate, then we fall back to parsing the unknown notification and allowing Notifee to handle it.

Testing

  1. Jest tests all pass
  2. iOS end-to-end tests all pass
  3. I have an app that handles both Iterable and Notifee notifications.
    1. Before this change: The Iterable notification was being handled by Notifee, resulting in a default behavior of launching to the app home screen.
    2. After this change: Notifee falls back to the original delegate when encountering the Iterable notification, resulting in handling the notification correctly & launching the app to the correct screen.

@CLAassistant
Copy link

CLAassistant commented Feb 7, 2024

CLA assistant check
All committers have signed the CLA.

@gotcha84 gotcha84 changed the title iOS: Allow the original delegate to handle non-Notifee notifications first fix(iOS): Allow the original delegate to handle non-Notifee notifications first Feb 7, 2024
@BMR11
Copy link

BMR11 commented Feb 7, 2024

@mikehardy, Just wondering if we can get this in as this may be more common case and the bug prevents one listener from other

@SMPinCode
Copy link

Tried this.
messaging().getInitialNotification() works now when iOS app is terminated.

Copy link

github-actions bot commented Mar 8, 2024

Hello 👋, this PR has been opened for more than 2 months with no activity on it.

If you think this is a mistake please comment and ping a maintainer to get this merged ASAP! Thanks for contributing!

You have 15 days until this gets closed automatically

@github-actions github-actions bot added the Stale label Mar 8, 2024
@fobos531
Copy link
Contributor

fobos531 commented Mar 8, 2024

not stale

@mikehardy Is there a possibility to get this reviewed and merged? It would really help for projects that use libraries that depend on Notifee, but for projects where advanced notifee features are not directly required by the consumer (the developer), instead react-native-firebase is enough. This is exactly the use case I have and would greatly appreciate this change being merged. (same as in android, but that's a story for another PR)

@github-actions github-actions bot removed the Stale label Mar 8, 2024
@carlbleick
Copy link

If I correctly understand these changes, wouldn't the original delegate always get called instead of the notifee handler?
E.g when I use react-native-firebase?
Should there be an option to toggle that behaviour?

@gezquinndesign
Copy link

Good work @gotcha84 ! Looking forward to seeing this merged.

Copy link

Hello 👋, this PR has been opened for more than 2 months with no activity on it.

If you think this is a mistake please comment and ping a maintainer to get this merged ASAP! Thanks for contributing!

You have 15 days until this gets closed automatically

@github-actions github-actions bot added the Stale label Apr 12, 2024
@jacobmllr95
Copy link

I can confirm that this solves #913 as well.

I would love to see this merged soon!

@github-actions github-actions bot removed the Stale label Apr 13, 2024
Copy link

Hello 👋, this PR has been opened for more than 2 months with no activity on it.

If you think this is a mistake please comment and ping a maintainer to get this merged ASAP! Thanks for contributing!

You have 15 days until this gets closed automatically

@github-actions github-actions bot added the Stale label May 11, 2024
@fobos531
Copy link
Contributor

not stale

@github-actions github-actions bot removed the Stale label May 11, 2024
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

Successfully merging this pull request may close these issues.

None yet

8 participants