Skip to content

Payload as map#277

Closed
josh-burton wants to merge 3 commits into
MaikuB:masterfrom
josh-burton:payload-as-map
Closed

Payload as map#277
josh-burton wants to merge 3 commits into
MaikuB:masterfrom
josh-burton:payload-as-map

Conversation

@josh-burton

Copy link
Copy Markdown
Contributor

I've implemented these changes so I can receive both Firebase messages and local notifications with the onSelected callback in my app.

This PR is to open a discussion around these changes and whether it might be something that should be merged.

Basically, because of the known issue around not being able to have multiple notification delegates on iOS, local notifications overrides Firebase Messaging callbacks.

When clicking on a Firebase notification, local notifications still gets invoked, but it only extracts and passes the payload back to the onSelected callback. A Firebase notification doesn't have a payload so the payload is null.

By passing back the userInfo dictionary, we can extract the payload on the dart side and add an extra parameter to onSelected which is all the (firebase) data from the notification - it allows the user to handle both Firebase and local notifications.

Android doesn't have the same problem (I think) so the payload is just passed back but within a map.

@MaikuB

MaikuB commented Jul 30, 2019

Copy link
Copy Markdown
Owner

FYI that one of the members of the Flutter team is looking into the issue and in fact has a PR that pending approval. As such, I don't think this PR is necessary

@josh-burton

Copy link
Copy Markdown
Contributor Author

Great! Do you have a link?

@MaikuB

MaikuB commented Jul 30, 2019

Copy link
Copy Markdown
Owner

flutter-team-archive/engine#9864

It's referenced in the issue I created on the Flutter repository around this

@sante85

sante85 commented Jul 31, 2019

Copy link
Copy Markdown

please reopen

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.

3 participants