Skip to content
This repository has been archived by the owner on Sep 24, 2021. It is now read-only.

getInitialNotification deprecated? #372

Closed
mars-lan opened this issue Aug 29, 2021 · 4 comments
Closed

getInitialNotification deprecated? #372

mars-lan opened this issue Aug 29, 2021 · 4 comments
Assignees
Labels
documentation Improvements or additions to documentation

Comments

@mars-lan
Copy link
Contributor

mars-lan commented Aug 29, 2021

The release note for 1.11.0 mentions that

[iOS]: Adds a note in the reference documentation that getInitialNotification() for iOS is deprecated in favour of onForegroundEvent.

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?

@helenaford
Copy link
Member

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. #280.

@helenaford helenaford added the documentation Improvements or additions to documentation label Aug 29, 2021
@helenaford helenaford self-assigned this Aug 29, 2021
@marcel-happyfloat
Copy link

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?

@helenaford
Copy link
Member

helenaford commented Aug 31, 2021

Added a note 2901595 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.

@helenaford
Copy link
Member

Added an extra note to the docs notifee/documentation@259baad

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

3 participants