Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3509412
D6813.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
4 KB
Referenced Files
None
Subscribers
None
D6813.diff
View Options
diff --git a/keyserver/src/creators/message-creator.js b/keyserver/src/creators/message-creator.js
--- a/keyserver/src/creators/message-creator.js
+++ b/keyserver/src/creators/message-creator.js
@@ -49,7 +49,7 @@
+devices: Map<
string,
{
- +deviceType: string,
+ +platform: string,
+deviceToken: string,
+codeVersion: ?string,
},
@@ -379,7 +379,7 @@
}
if (deviceToken) {
thisUserInfo.devices.set(deviceToken, {
- deviceType: platform,
+ platform,
deviceToken,
codeVersion: versions ? versions.codeVersion : null,
});
diff --git a/keyserver/src/push/send.js b/keyserver/src/push/send.js
--- a/keyserver/src/push/send.js
+++ b/keyserver/src/push/send.js
@@ -22,7 +22,7 @@
rawThreadInfoFromServerThreadInfo,
threadInfoFromRawThreadInfo,
} from 'lib/shared/thread-utils.js';
-import type { DeviceType } from 'lib/types/device-types.js';
+import type { Platform } from 'lib/types/device-types.js';
import {
type RawMessageInfo,
type MessageInfo,
@@ -53,7 +53,7 @@
import { getENSNames } from '../utils/ens-cache.js';
type Device = {
- +deviceType: DeviceType,
+ +platform: Platform,
+deviceToken: string,
+codeVersion: ?number,
};
@@ -154,7 +154,7 @@
const dbID = dbIDs.shift();
invariant(dbID, 'should have sufficient DB IDs');
- const byDeviceType = getDevicesByDeviceType(pushInfo[userID].devices);
+ const byPlatform = getDevicesByPlatform(pushInfo[userID].devices);
const firstMessageID = firstNewMessageInfo.id;
invariant(firstMessageID, 'RawMessageInfo.id should be set on server');
const notificationInfo = {
@@ -166,7 +166,7 @@
collapseKey: notifInfo.collapseKey,
};
- const iosVersionsToTokens = byDeviceType.get('ios');
+ const iosVersionsToTokens = byPlatform.get('ios');
if (iosVersionsToTokens) {
for (const [codeVer, deviceTokens] of iosVersionsToTokens) {
const codeVersion = parseInt(codeVer, 10); // only for Flow
@@ -196,7 +196,7 @@
deliveryPromises.push(deliveryPromise);
}
}
- const androidVersionsToTokens = byDeviceType.get('android');
+ const androidVersionsToTokens = byPlatform.get('android');
if (androidVersionsToTokens) {
for (const [codeVer, deviceTokens] of androidVersionsToTokens) {
const codeVersion = parseInt(codeVer, 10); // only for Flow
@@ -492,15 +492,15 @@
return await createIDs('notifications', numIDsNeeded);
}
-function getDevicesByDeviceType(
+function getDevicesByPlatform(
devices: Device[],
-): Map<DeviceType, Map<number, Set<string>>> {
- const byDeviceType = new Map();
+): Map<Platform, Map<number, Set<string>>> {
+ const byPlatform = new Map();
for (const device of devices) {
- let innerMap = byDeviceType.get(device.deviceType);
+ let innerMap = byPlatform.get(device.platform);
if (!innerMap) {
innerMap = new Map();
- byDeviceType.set(device.deviceType, innerMap);
+ byPlatform.set(device.platform, innerMap);
}
const codeVersion: number =
device.codeVersion !== null && device.codeVersion !== undefined
@@ -513,7 +513,7 @@
}
innerMostSet.add(device.deviceToken);
}
- return byDeviceType;
+ return byPlatform;
}
type IOSNotifInputData = {
@@ -859,15 +859,15 @@
const unreadCount = unreadCounts[userID];
const devices = deviceTokenResult.map(row => ({
- deviceType: row.platform,
+ platform: row.platform,
deviceToken: row.device_token,
codeVersion: JSON.parse(row.versions)?.codeVersion,
}));
- const byDeviceType = getDevicesByDeviceType(devices);
+ const byPlatform = getDevicesByPlatform(devices);
const deliveryPromises = [];
- const iosVersionsToTokens = byDeviceType.get('ios');
+ const iosVersionsToTokens = byPlatform.get('ios');
if (iosVersionsToTokens) {
for (const [codeVer, deviceTokens] of iosVersionsToTokens) {
const codeVersion = parseInt(codeVer, 10); // only for Flow
@@ -886,7 +886,7 @@
}
}
- const androidVersionsToTokens = byDeviceType.get('android');
+ const androidVersionsToTokens = byPlatform.get('android');
if (androidVersionsToTokens) {
for (const [codeVer, deviceTokens] of androidVersionsToTokens) {
const codeVersion = parseInt(codeVer, 10); // only for Flow
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Dec 22, 4:29 AM (3 h, 28 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2690354
Default Alt Text
D6813.diff (4 KB)
Attached To
Mode
D6813: [keyserver] Use Platform instead of a DeviceType for sending notifs
Attached
Detach File
Event Timeline
Log In to Comment