Skip to content
This repository has been archived by the owner on Apr 4, 2023. It is now read-only.

Add FCM data to the data key #510

Merged
merged 2 commits into from
Oct 7, 2017
Merged

Conversation

bpeterman
Copy link
Contributor

@bpeterman bpeterman commented Oct 6, 2017

The docs state that the data from FCM messages should be under the data key. Currently it's just in the body of the main JSON object returned. This causes an issue for the TypeScript usage:

firebase.init({
onMessageReceivedCallback: (message: Message) => {
console.log(Title: ${message.title});
console.log(Body: ${message.body});
// if your server passed a custom property called 'foo', then do this:
console.log(Value of 'foo': ${message.data.foo});
}
});

The interface restricts us from using anything other than the data key .

This PR puts everything from getData underneath the "data" key in the JSON object.

Blake Peterman added 2 commits October 6, 2017 11:51
Before this change the elements in the data object are put into the main json object.  The docs say that this should be underneath the data key.  This causes an issue with TypeScript because you're not able to access keys not defined in the interface.
@bpeterman bpeterman changed the title Add FCM data to the data key rather than body Add FCM data to the data key Oct 6, 2017
@EddyVerbruggen
Copy link
Owner

Looks good to me, thank you very much!

@EddyVerbruggen EddyVerbruggen merged commit 677ba39 into EddyVerbruggen:master Oct 7, 2017
@EddyVerbruggen EddyVerbruggen added this to the 4.1.2 milestone Oct 13, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants