Page MenuHomePhabricator

Move notification creaction and encryption to lib except for APNs noifs.
ClosedPublic

Authored by marcin on Jun 11 2024, 10:39 AM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Dec 23, 6:57 PM
Unknown Object (File)
Fri, Dec 20, 3:21 AM
Unknown Object (File)
Thu, Dec 19, 6:28 AM
Unknown Object (File)
Thu, Dec 19, 6:28 AM
Unknown Object (File)
Thu, Dec 19, 6:28 AM
Unknown Object (File)
Thu, Dec 19, 6:28 AM
Unknown Object (File)
Thu, Dec 19, 6:28 AM
Unknown Object (File)
Thu, Dec 19, 6:28 AM
Subscribers

Details

Summary

This differential uses EncryptedNotifsUtilsAPI to move notif generation and encryption to lib. APNs notifs are exception since in this case we will need to implement new types, creation and encryption from scratch instead of just smart copy-paste. It will be handled in separate diff.

Test Plan
  1. Flow
  2. Test all notifs for all platform and large notifs as well.

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

kamil requested changes to this revision.Jun 19 2024, 3:29 PM

Looks good but want to see responses to the inline comments before accepting.

keyserver/src/push/send.js
419 ↗(On Diff #41214)

could you explain why not dbID?

lib/push/notif-creators.js
1 ↗(On Diff #41214)

This file is messy a bit, what do you think about slicing code here and moving code to specific files for each platform to make it a bit more readable? I am not a fan of creating huge files with multiple purposes but if you have a different opinion I am okay with it.

Something like lib/push/android-notif-creators.js, lib/push/web-notif-creators.js etc.

31 ↗(On Diff #41214)

nit: maybe worth now moving those to a separate file with constants?

252 ↗(On Diff #41214)

I think this prop was added. Could you annotate all changes made additionally to moving code from /keyserver to /lib? Without annotating this, this diff is really hard to review

This revision now requires changes to proceed.Jun 19 2024, 3:29 PM

Split notif creators for each platform to separate files.

keyserver/src/push/send.js
419 ↗(On Diff #41214)

This function will be used on the client where we decided to cut scope and skip notif persistence. Therefore dbID doesn't make sense in general context.

lib/push/android-notif-creators.js
3 ↗(On Diff #41554)

Consider this logic a copy paste from the keyserver

lib/push/web-notif-creators.js
3 ↗(On Diff #41554)

Consider this logic a copy paste from the kesyerver. I only made it responsibility of the sender to create the id and pass it to function instead of generating it inside a function.

lib/push/wns-notif-creators.js
1 ↗(On Diff #41554)

Consider this a copy paste from the keyserver.

Thanks!

lib/types/notif-types.js
83 ↗(On Diff #41554)

why this change?

This revision is now accepted and ready to land.Jun 21 2024, 1:31 AM
lib/types/notif-types.js
83 ↗(On Diff #41554)

For thick threads we don't include the badge count in the notif since we don't know the badge count of the client we send notif to. It will be the responsibility of the client to calculate the badge count.

Add type of encrypted message to encrypted notification (1 for text and 0 for prekey)