arminfelder / RocketChatMobilePushGateway

GNU General Public License v3.0
9 stars 8 forks source link

Potential malformed Android payload #7

Open AgentTNT opened 4 years ago

AgentTNT commented 4 years ago

Hi there,

I am using the v1.3.0 of the gateway, and while testing notifications with a custom app, I am experiencing something a bit odd.

Some background... RC Server - v3.7.1 Android App - Based on 4.11.0

When the RC server is set to send pushes directly with FCM, the "Reply" function is generated for the push on the device. However the moment the same push is sent via the gateway, the "Reply" action is removed.

(redacted)

Payload via the gateway:

Google push data {"collapseKey":"push","data":{"body":"5","ejson":"{\"host\":\"https://RC-URL/\",\"messageId\":\"12345\",\"notificationType\":\"message\",\"rid\":\"12345\",\"sender\":{\"_id\":\"12345\",\"name\":\"JD\",\"username\":\"JD\"},\"senderName\":\"JD\",\"type\":\"d\"}\n","message":"test","msgcnt":4,"title":"JD"},"priority":"10","to":"(device_token)"}

Payload via direct FCM:

from: 'push', title: 'JD', text: 'test', userId: 'JD', payload: { host: 'https://RC-URL/', messageId: 12345', notificationType: 'message', rid: '12345', sender: { _id: '12345', username: 'JD', name: 'JD' }, senderName: 'JD', type: 'd' }, badge: 8, sound: 'default', notId: -99239831, apn: { category: 'MESSAGE' }, gcm: { image: 'https://RC-URL/images/logo/android-chrome-192x192.png', style: 'inbox' } }

AgentTNT commented 4 years ago

Also to add, same behavior with the lack of a "Reply" function when using the fairchat app (v2.3.0.200022), and having the RC server using "gateway.fairchat.net", just to rule out a misconfiguration with my self-compiled app.

AgentTNT commented 4 years ago

It may have to do something with this - https://github.com/RocketChat/Rocket.Chat.ReactNative/pull/1771/files

AgentTNT commented 4 years ago

Fixed! Missing "notId" in the payload. I will submit a PR for this within a few days, along with any of the other newer options introduced to the app/server.