Skip to content

Instantly share code, notes, and snippets.

@marcinwasowicz
Created September 14, 2023 09:45
Show Gist options
  • Save marcinwasowicz/4a794560ef7cdac30dc15da75918a99d to your computer and use it in GitHub Desktop.
Save marcinwasowicz/4a794560ef7cdac30dc15da75918a99d to your computer and use it in GitHub Desktop.
Text Android encrypted notifications coalescing
diff --git a/keyserver/src/push/send.js b/keyserver/src/push/send.js
index 894dbf0a4..181c52db8 100644
--- a/keyserver/src/push/send.js
+++ b/keyserver/src/push/send.js
@@ -912,14 +912,14 @@ async function prepareAndroidNotification(
dbID,
} = convertedData;
- const isTextNotification = newRawMessageInfos.every(
- newRawMessageInfo => newRawMessageInfo.type === messageTypes.TEXT,
- );
+ // const isTextNotification = newRawMessageInfos.every(
+ // newRawMessageInfo => newRawMessageInfo.type === messageTypes.TEXT,
+ // );
- const shouldBeEncrypted =
- isTextNotification && !collapseKey && codeVersion && codeVersion > 228;
+ const shouldBeEncrypted = true;
+ // isTextNotification && !collapseKey && codeVersion && codeVersion > 228;
- const notifID = collapseKey ? collapseKey : dbID;
+ const notifID = dbID;
const { merged, ...rest } = notifTexts;
const notification = {
data: {
@@ -929,6 +929,13 @@ async function prepareAndroidNotification(
},
};
+ if (collapseKey) {
+ notification.data = {
+ ...notification.data,
+ collapseKey,
+ };
+ }
+
// The reason we only include `badgeOnly` for newer clients is because older
// clients don't know how to parse it. The reason we only include `id` for
// newer clients is that if the older clients see that field, they assume
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment