Closed mars-lan closed 3 years ago
Hi @mars-lan, there should be a note in the reference docs (here https://notifee.app/react-native/reference/getinitialnotification) - but it seems to be missing 🤔 , I also have a WIP branch with other changes for the user docs that I'm about to push up today.
The motivation towards this change is that the onForegroundEvent
automatically receives the initial notification. There haven't been any code changes, but we plan to disable initial notification from being populated on iOS as part of reworking how events work but that will be in a major version update, and in the same release of other changes e.g. https://github.com/notifee/react-native-notifee/pull/280.
If we receive the message in onForegroundEvent
, is there some indication it was the "initial one"? Or do we just assume that a PRESS event will do the same action in both cases?
Added a note https://github.com/notifee/react-native-notifee/commit/29015957054f321861dce6021588fa44a7e062aa which will be live shortly to the docs site.
@happyfloat yeah, it'll be the press action which is how I use it in my own apps. Apple has deprecated UIApplicationLaunchOptionsLocalNotificationKey
which is used to detect the initial notification and recommends using didReceiveNotificationResponse
. (ref)
We are looking at improving the events on iOS where we can pass down the app state when the event arrived, so if the app state was inactive
when the initial notification came in, that can be an indicator to determine what caused the app to open. But, it should only be used for an analytics indication really. Not sure if there is a use case to treat an initial notification different to a press action event.
As I mentioned earlier, there has been no code changes on iOS. If there are any changes to the handling of events, it will be in a major release.
Added an extra note to the docs https://github.com/notifee/documentation/commit/259baad7a911740407875dc08253a64f8db01714
The release note for 1.11.0 mentions that
However, I cna't seem to find the note in either https://notifee.app/react-native/docs/events or https://notifee.app/react-native/reference/getinitialnotification?
Also is the deprecation only limited to iOS? Does that mean
onForegroundEvent
will automatically receive the intial notification?