Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3389641
D7857.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
5 KB
Referenced Files
None
Subscribers
None
D7857.diff
View Options
diff --git a/lib/selectors/socket-selectors.js b/lib/selectors/socket-selectors.js
--- a/lib/selectors/socket-selectors.js
+++ b/lib/selectors/socket-selectors.js
@@ -60,6 +60,7 @@
calendarActive: boolean,
oneTimeKeyGenerator: ?OneTimeKeyGenerator,
getSignedIdentityKeysBlob: ?() => Promise<SignedIdentityKeysBlob>,
+ getInitialNotificationsEncryptedMessage: ?() => Promise<string>,
serverRequests: $ReadOnlyArray<ClientServerRequest>,
) => Promise<$ReadOnlyArray<ClientClientResponse>> = createSelector(
(state: AppState) => state.threadStore.threadInfos,
@@ -78,6 +79,7 @@
calendarActive: boolean,
oneTimeKeyGenerator: ?OneTimeKeyGenerator,
getSignedIdentityKeysBlob: ?() => Promise<SignedIdentityKeysBlob>,
+ getInitialNotificationsEncryptedMessage: ?() => Promise<string>,
serverRequests: $ReadOnlyArray<ClientServerRequest>,
): Promise<$ReadOnlyArray<ClientClientResponse>> => {
const clientResponses = [];
@@ -212,6 +214,17 @@
type: serverRequestTypes.SIGNED_IDENTITY_KEYS_BLOB,
signedIdentityKeysBlob,
});
+ } else if (
+ serverRequest.type ===
+ serverRequestTypes.INITIAL_NOTIFICATIONS_ENCRYPTED_MESSAGE &&
+ getInitialNotificationsEncryptedMessage
+ ) {
+ const initialNotificationsEncryptedMessage =
+ await getInitialNotificationsEncryptedMessage();
+ clientResponses.push({
+ type: serverRequestTypes.INITIAL_NOTIFICATIONS_ENCRYPTED_MESSAGE,
+ initialNotificationsEncryptedMessage,
+ });
}
}
return clientResponses;
diff --git a/native/selectors/socket-selectors.js b/native/selectors/socket-selectors.js
--- a/native/selectors/socket-selectors.js
+++ b/native/selectors/socket-selectors.js
@@ -62,27 +62,39 @@
return signedIdentityKeysBlob;
}
+type NativeGetClientResponsesSelectorInputType = {
+ ...NavPlusRedux,
+ getInitialNotificationsEncryptedMessage: () => Promise<string>,
+};
+
const nativeGetClientResponsesSelector: (
- input: NavPlusRedux,
+ input: NativeGetClientResponsesSelectorInputType,
) => (
serverRequests: $ReadOnlyArray<ClientServerRequest>,
) => Promise<$ReadOnlyArray<ClientClientResponse>> = createSelector(
- (input: NavPlusRedux) => getClientResponsesSelector(input.redux),
- (input: NavPlusRedux) => calendarActiveSelector(input.navContext),
+ (input: NativeGetClientResponsesSelectorInputType) =>
+ getClientResponsesSelector(input.redux),
+ (input: NativeGetClientResponsesSelectorInputType) =>
+ calendarActiveSelector(input.navContext),
+ (input: NativeGetClientResponsesSelectorInputType) =>
+ input.getInitialNotificationsEncryptedMessage,
(
getClientResponsesFunc: (
calendarActive: boolean,
oneTimeKeyGenerator: ?OneTimeKeyGenerator,
getSignedIdentityKeysBlob: ?() => Promise<SignedIdentityKeysBlob>,
+ getInitialNotificationsEncryptedMessage: ?() => Promise<string>,
serverRequests: $ReadOnlyArray<ClientServerRequest>,
) => Promise<$ReadOnlyArray<ClientClientResponse>>,
calendarActive: boolean,
+ getInitialNotificationsEncryptedMessage: () => Promise<string>,
) =>
(serverRequests: $ReadOnlyArray<ClientServerRequest>) =>
getClientResponsesFunc(
calendarActive,
oneTimeKeyGenerator,
getSignedIdentityKeysBlob,
+ getInitialNotificationsEncryptedMessage,
serverRequests,
),
);
diff --git a/native/socket.react.js b/native/socket.react.js
--- a/native/socket.react.js
+++ b/native/socket.react.js
@@ -53,10 +53,14 @@
const sessionIdentification = useSelector(sessionIdentificationSelector);
const preRequestUserState = useSelector(preRequestUserStateSelector);
+ const getInitialNotificationsEncryptedMessage =
+ useInitialNotificationsEncryptedMessage();
+
const getClientResponses = useSelector(state =>
nativeGetClientResponsesSelector({
redux: state,
navContext,
+ getInitialNotificationsEncryptedMessage,
}),
);
const sessionStateFunc = useSelector(state =>
@@ -89,8 +93,6 @@
const dispatch = useDispatch();
const dispatchActionPromise = useDispatchActionPromise();
const callLogOut = useServerCall(logOut);
- const getInitialNotificationsEncryptedMessage =
- useInitialNotificationsEncryptedMessage();
const socketCrashLoopRecovery = React.useCallback(async () => {
if (!accountHasPassword(currentUserInfo)) {
diff --git a/web/selectors/socket-selectors.js b/web/selectors/socket-selectors.js
--- a/web/selectors/socket-selectors.js
+++ b/web/selectors/socket-selectors.js
@@ -91,6 +91,7 @@
calendarActive: boolean,
oneTimeKeyGenerator: ?OneTimeKeyGenerator,
getSignedIdentityKeysBlob: ?() => Promise<SignedIdentityKeysBlob>,
+ getInitialNotificationsEncryptedMessage: ?() => Promise<string>,
serverRequests: $ReadOnlyArray<ClientServerRequest>,
) => Promise<$ReadOnlyArray<ClientClientResponse>>,
getSignedIdentityKeysBlob: ?() => Promise<SignedIdentityKeysBlob>,
@@ -101,6 +102,7 @@
calendarActive,
null,
getSignedIdentityKeysBlob,
+ null,
serverRequests,
),
);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Nov 30, 7:55 PM (20 h, 25 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2602206
Default Alt Text
D7857.diff (5 KB)
Attached To
Mode
D7857: Introduce initial notifications encrypted message getter to socket selectors
Attached
Detach File
Event Timeline
Log In to Comment