notifee icon indicating copy to clipboard operation
notifee copied to clipboard

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

Open gotcha84 opened this issue 1 year ago • 9 comments

Issues

Fixes

  • #925
  • #984

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.

gotcha84 avatar Feb 07 '24 00:02 gotcha84

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Feb 07 '24 00:02 CLAassistant

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

BMR11 avatar Feb 07 '24 17:02 BMR11

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

SMPinCode avatar Feb 09 '24 08:02 SMPinCode

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[bot] avatar Mar 08 '24 08:03 github-actions[bot]

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)

fobos531 avatar Mar 08 '24 08:03 fobos531

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?

carlbleick avatar Mar 08 '24 15:03 carlbleick

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

gezquinndesign avatar Mar 15 '24 20:03 gezquinndesign

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[bot] avatar Apr 12 '24 20:04 github-actions[bot]

I can confirm that this solves #913 as well.

I would love to see this merged soon!

jacobmllr95 avatar Apr 13 '24 06:04 jacobmllr95

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[bot] avatar May 11 '24 07:05 github-actions[bot]

not stale

fobos531 avatar May 11 '24 11:05 fobos531

is there a plan to merge this PR?

balsick avatar Jun 04 '24 14:06 balsick

Can someone please merge this?

singhayush1403 avatar Jun 04 '24 14:06 singhayush1403

thanks for the fix! 🙏

helenaford avatar Jun 11 '24 20:06 helenaford

Thanks for fixing and merging it. Any idea when this will be included in an upcoming release?

kiranz avatar Jun 17 '24 16:06 kiranz

@gotcha84 looks like this was merged, but has some linting issues https://github.com/invertase/notifee/actions/runs/9472210287/job/26097204168

@helenaford any reason aside from linting issues to not get another release out with this included?

markalanevans avatar Aug 01 '24 18:08 markalanevans

Ok. @gotcha84 i did the cleanup

@helenaford it's clean now.

https://github.com/invertase/notifee/pull/1073

markalanevans avatar Aug 01 '24 18:08 markalanevans

Firstly, thank you, and when do you think it will be deployed?

RyuWoong avatar Aug 14 '24 06:08 RyuWoong

@helenaford @mikehardy is it possible to merge the fix #1073 provided by @markalanevans? Currently, the library is incompatible with the latest RN versions since it fails the TS check.

Roman-ZN avatar Aug 15 '24 15:08 Roman-ZN

Hey there - @notifee/[email protected] is published just now with these changes --> https://github.com/invertase/notifee/releases/tag/%40notifee%2Freact-native%407.9.0

mikehardy avatar Sep 11 '24 14:09 mikehardy