Page MenuHomePhabricator

D13713.id45195.diff
No OneTemporary

D13713.id45195.diff

diff --git a/lib/push/apns-notif-creators.js b/lib/push/apns-notif-creators.js
--- a/lib/push/apns-notif-creators.js
+++ b/lib/push/apns-notif-creators.js
@@ -157,7 +157,7 @@
messageInfos,
};
- const notificationSizeValidator = (notif: APNsVisualNotification) => {
+ const isNotificationSizeValid = (notif: APNsVisualNotification) => {
const { headers, ...notifSansHeaders } = notif;
return (
encryptedNotifUtilsAPI.getNotifByteSize(
@@ -173,7 +173,7 @@
const shouldBeEncrypted = canDecryptIOSNotif || canDecryptMacOSNotifs;
if (!shouldBeEncrypted) {
- const notificationToSend = notificationSizeValidator(copyWithMessageInfos)
+ const notificationToSend = isNotificationSizeValid(copyWithMessageInfos)
? copyWithMessageInfos
: notification;
const targetedNotifications = devices.map(({ deliveryID }) => ({
@@ -211,7 +211,7 @@
devices,
copyWithMessageInfos,
platformDetails.codeVersion,
- notificationSizeValidator,
+ isNotificationSizeValid,
);
const devicesWithExcessiveSizeNoHolders = notifsWithMessageInfos
diff --git a/lib/push/crypto.js b/lib/push/crypto.js
--- a/lib/push/crypto.js
+++ b/lib/push/crypto.js
@@ -27,7 +27,7 @@
cryptoID: string,
senderDeviceDescriptor: SenderDeviceDescriptor,
unencryptedPayload: T,
- payloadSizeValidator?: (
+ isPayloadSizeValid?: (
| T
| $ReadOnly<{
...SenderDeviceDescriptor,
@@ -51,16 +51,16 @@
if (!unencryptedSerializedPayload) {
return {
resultPayload: unencryptedPayload,
- payloadSizeExceeded: payloadSizeValidator
- ? payloadSizeValidator(unencryptedPayload)
+ payloadSizeExceeded: isPayloadSizeValid
+ ? isPayloadSizeValid(unencryptedPayload)
: false,
};
}
let dbPersistCondition;
- if (payloadSizeValidator) {
+ if (isPayloadSizeValid) {
dbPersistCondition = (serializedPayload: string, type: '1' | '0') =>
- payloadSizeValidator({
+ isPayloadSizeValid({
encryptedPayload: serializedPayload,
type,
...senderDeviceDescriptor,
@@ -94,8 +94,8 @@
};
return {
resultPayload,
- payloadSizeExceeded: payloadSizeValidator
- ? payloadSizeValidator(resultPayload)
+ payloadSizeExceeded: isPayloadSizeValid
+ ? isPayloadSizeValid(resultPayload)
: false,
};
}
@@ -106,7 +106,7 @@
cryptoID: string,
senderDeviceDescriptor: SenderDeviceDescriptor,
notification: APNsVisualNotification,
- notificationSizeValidator?: APNsVisualNotification => boolean,
+ isNotificationSizeValid?: APNsVisualNotification => boolean,
codeVersion?: ?number,
blobHolder?: ?string,
): Promise<{
@@ -150,9 +150,9 @@
}
let dbPersistCondition;
- if (notificationSizeValidator) {
+ if (isNotificationSizeValid) {
dbPersistCondition = (encryptedPayload: string, type: '0' | '1') =>
- notificationSizeValidator({
+ isNotificationSizeValid({
...senderDeviceDescriptor,
id,
headers,
@@ -195,8 +195,8 @@
const unencryptedNotification = { ...notification, encryptionFailed: '1' };
return {
notification: unencryptedNotification,
- payloadSizeExceeded: notificationSizeValidator
- ? !notificationSizeValidator(unencryptedNotification)
+ payloadSizeExceeded: isNotificationSizeValid
+ ? !isNotificationSizeValid(unencryptedNotification)
: false,
};
}
@@ -274,7 +274,7 @@
senderDeviceDescriptor: SenderDeviceDescriptor,
cryptoID: string,
notification: AndroidVisualNotification,
- notificationSizeValidator?: AndroidVisualNotification => boolean,
+ isNotificationSizeValid?: AndroidVisualNotification => boolean,
blobHolder?: ?string,
): Promise<{
+notification: AndroidVisualNotification,
@@ -293,9 +293,9 @@
unencryptedPayload = { ...unencryptedPayload, blobHolder };
}
- let payloadSizeValidator;
- if (notificationSizeValidator) {
- payloadSizeValidator = (
+ let isPayloadSizeValid;
+ if (isNotificationSizeValid) {
+ isPayloadSizeValid = (
payload:
| AndroidVisualNotificationPayload
| $ReadOnly<{
@@ -304,7 +304,7 @@
+type: '0' | '1',
}>,
) => {
- return notificationSizeValidator({
+ return isNotificationSizeValid({
data: { ...unencryptedData, ...payload },
});
};
@@ -315,7 +315,7 @@
cryptoID,
senderDeviceDescriptor,
unencryptedPayload,
- payloadSizeValidator,
+ isPayloadSizeValid,
);
return {
notification: {
@@ -452,7 +452,7 @@
devices: $ReadOnlyArray<NotificationTargetDevice>,
notification: APNsVisualNotification,
codeVersion?: ?number,
- notificationSizeValidator?: APNsVisualNotification => boolean,
+ isNotificationSizeValid?: APNsVisualNotification => boolean,
): Promise<
$ReadOnlyArray<{
+cryptoID: string,
@@ -470,7 +470,7 @@
cryptoID,
senderDeviceDescriptor,
notification,
- notificationSizeValidator,
+ isNotificationSizeValid,
codeVersion,
blobHolder,
);
@@ -511,7 +511,7 @@
senderDeviceDescriptor: SenderDeviceDescriptor,
devices: $ReadOnlyArray<NotificationTargetDevice>,
notification: AndroidVisualNotification,
- notificationSizeValidator?: (
+ isNotificationSizeValid?: (
notification: AndroidVisualNotification,
) => boolean,
): Promise<
@@ -530,7 +530,7 @@
senderDeviceDescriptor,
cryptoID,
notification,
- notificationSizeValidator,
+ isNotificationSizeValid,
blobHolder,
);
return { deliveryID, cryptoID, ...notif };

File Metadata

Mime Type
text/plain
Expires
Sat, Nov 23, 1:58 AM (17 h, 57 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2567293
Default Alt Text
D13713.id45195.diff (5 KB)

Event Timeline