RocketChat / Rocket.Chat

The communications platform that puts data protection first.
https://rocket.chat/
Other
40.65k stars 10.65k forks source link

[NEW] Send 'mutable-content = 1' in APN payload #12956

Open cardoso opened 5 years ago

cardoso commented 5 years ago

This will allow us to support end-to-end encrypted notifications & also remove markdown in the client side.

Documentation:

https://developer.apple.com/library/archive/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/ModifyingNotifications.html

https://developer.apple.com/documentation/usernotifications/modifying_content_in_newly_delivered_notifications

Example payload:

{
   “aps” : {
      “category” : “SECRET”,
      “mutable-content” : 1,
      “alert” : {
         “title” : “Secret Message!”,
         “body”  : “(Encrypted)”
     },
   },
   “ENCRYPTED_DATA” : “Salted__·öîQÊ$UDì_¶Ù∞è   Ω^¬%gq∞NÿÒQùw”
}

This will also require work in https://github.com/RocketChat/push & https://github.com/RocketChat/pushgateway

geekgonecrazy commented 5 years ago

Looks like in raix/push it would be modified around here: https://github.com/raix/push/blob/master/lib/common/notifications.js#L30 . Just would need to make sure that its an int here instead of boolean

As well as around here: https://github.com/RocketChat/Rocket.Chat/blob/develop/packages/rocketchat-lib/server/lib/PushNotification.js#L19 and https://github.com/RocketChat/Rocket.Chat/blob/develop/packages/rocketchat-lib/server/lib/PushNotification.js#L45

Not sure exactly where the logic is that talks to push gateway... probably somewhere in here: https://github.com/RocketChat/Rocket.Chat/blob/develop/server/lib/cordova.js#L115

cardoso commented 5 years ago

@geekgonecrazy are we not using https://github.com/RocketChat/push now in place of raix?

geekgonecrazy commented 5 years ago

You're right we are: https://github.com/RocketChat/Rocket.Chat/blob/develop/packages/rocketchat-api/server/v1/push.js#L4

I think we did while waiting on them to include a patch. I think they have since merged it... so not sure if the fork is still necessary or not. @sampaiodiego would be able to tell us for sure :)