strongloop / loopback-component-push

Push notification component for LoopBack.
http://loopback.io/doc/en/lb2/Push-notifications.html
Other
96 stars 95 forks source link

GCM: Iterate __data object to send complete msg payload #145

Closed MichaelMarner closed 6 years ago

MichaelMarner commented 7 years ago

Description

GCM messages sent by the connector are missing data. This is because the code to construct the message iterates over the Notification's keys. However, the notification is not a simple Javascript object, but a loopback model instance. Most of the notification data is stored in notification.__data.

This PR changes how data is added to the message. We add data by iterating over Object.keys(notification.__data) instead of Object.keys(notification). In addition, we add a list of data that is used internally by the component that does not need to be sent (id, etc). We filter the keys so the excluded items are not sent.

Related issues

106 - This PR actually fixes this, as it adds all data to the message payload. This bug was incorrectly marked as a duplicate of #82. Rather, #82 is a subset of #106, as 82 is referring to two specific keys.

114 makes sure alert and badge are sent by explicitly adding those keys to the data to be sent. This PR goes about things the other way, sending all data unless it is excluded.

103 is most likely related to this PR.

slnode commented 7 years ago

Can one of the admins verify this patch?

slnode commented 7 years ago

Can one of the admins verify this patch?

slnode commented 7 years ago

Can one of the admins verify this patch?

slnode commented 7 years ago

Can one of the admins verify this patch? To accept patch and trigger a build add comment ".ok\W+to\W+test."

maxaleks commented 7 years ago

Hi all. What is the status? I have to use node-gcm library directly because of this bug

stale[bot] commented 6 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

slnode commented 6 years ago

Can one of the admins verify this patch?

stale[bot] commented 6 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] commented 6 years ago

This issue has been closed due to continued inactivity. Thank you for your understanding. If you believe this to be in error, please contact one of the code owners, listed in the CODEOWNERS file at the top-level of this repository.

slnode commented 6 years ago

Can one of the admins verify this patch?

slnode commented 6 years ago

Can one of the admins verify this patch?