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 @@ -41,6 +41,7 @@ calendarActive: boolean, oneTimeKeyGenerator: ?OneTimeKeyGenerator, getSignedIdentityKeysBlob: ?() => Promise, + getInitialNotificationsEncryptedMessage: ?() => Promise, serverRequests: $ReadOnlyArray, ) => Promise<$ReadOnlyArray> = createSelector( (state: AppState) => state.threadStore.threadInfos, @@ -59,6 +60,7 @@ calendarActive: boolean, oneTimeKeyGenerator: ?OneTimeKeyGenerator, getSignedIdentityKeysBlob: ?() => Promise, + getInitialNotificationsEncryptedMessage: ?() => Promise, serverRequests: $ReadOnlyArray, ): Promise<$ReadOnlyArray> => { const clientResponses = []; @@ -169,6 +171,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, + callInitialNotificationsEncryptedMessage: () => Promise, +}; + const nativeGetClientResponsesSelector: ( - input: NavPlusRedux, + input: NativeGetClientResponsesSelectorInputType, ) => ( serverRequests: $ReadOnlyArray, ) => Promise<$ReadOnlyArray> = createSelector( - (input: NavPlusRedux) => getClientResponsesSelector(input.redux), - (input: NavPlusRedux) => calendarActiveSelector(input.navContext), + (input: NativeGetClientResponsesSelectorInputType) => + getClientResponsesSelector(input.redux), + (input: NativeGetClientResponsesSelectorInputType) => + calendarActiveSelector(input.navContext), + (input: NativeGetClientResponsesSelectorInputType) => + input.callInitialNotificationsEncryptedMessage, ( getClientResponsesFunc: ( calendarActive: boolean, oneTimeKeyGenerator: ?OneTimeKeyGenerator, getSignedIdentityKeysBlob: ?() => Promise, + getInitialNotificationsEncryptedMessage: ?() => Promise, serverRequests: $ReadOnlyArray, ) => Promise<$ReadOnlyArray>, calendarActive: boolean, + getInitialNotificationsEncryptedMessage: () => Promise, ) => (serverRequests: $ReadOnlyArray) => getClientResponsesFunc( calendarActive, oneTimeKeyGenerator, getSignedIdentityKeysBlob, + getInitialNotificationsEncryptedMessage, serverRequests, ), ); 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, + getInitialNotificationsEncryptedMessage: ?() => Promise, serverRequests: $ReadOnlyArray, ) => Promise<$ReadOnlyArray>, getSignedIdentityKeysBlob: ?() => Promise, @@ -101,6 +102,7 @@ calendarActive, null, getSignedIdentityKeysBlob, + null, serverRequests, ), );