diff --git a/native/account/resolve-invalidated-cookie.js b/native/account/resolve-invalidated-cookie.js --- a/native/account/resolve-invalidated-cookie.js +++ b/native/account/resolve-invalidated-cookie.js @@ -9,12 +9,15 @@ import { getGlobalNavContext } from '../navigation/icky-global.js'; import { store } from '../redux/redux-setup.js'; import { nativeLogInExtraInfoSelector } from '../selectors/account-selectors.js'; +import type { InitialNotifMessageOptions } from '../utils/crypto-utils.js'; async function resolveInvalidatedCookie( callServerEndpoint: CallServerEndpoint, dispatchRecoveryAttempt: DispatchRecoveryAttempt, logInActionSource: LogInActionSource, - getInitialNotificationsEncryptedMessage?: () => Promise, + getInitialNotificationsEncryptedMessage?: ( + ?InitialNotifMessageOptions, + ) => Promise, ) { const keychainCredentials = await fetchNativeKeychainCredentials(); if (!keychainCredentials) { @@ -27,7 +30,7 @@ if (getInitialNotificationsEncryptedMessage) { const initialNotificationsEncryptedMessage = - await getInitialNotificationsEncryptedMessage(); + await getInitialNotificationsEncryptedMessage({ callServerEndpoint }); extraInfo = { ...extraInfo, initialNotificationsEncryptedMessage }; } diff --git a/native/utils/crypto-utils.js b/native/utils/crypto-utils.js --- a/native/utils/crypto-utils.js +++ b/native/utils/crypto-utils.js @@ -10,11 +10,15 @@ useServerCall, useDispatchActionPromise, } from 'lib/utils/action-utils.js'; -import type { CallServerEndpointOptions } from 'lib/utils/call-server-endpoint.js'; +import type { + CallServerEndpoint, + CallServerEndpointOptions, +} from 'lib/utils/call-server-endpoint.js'; import { commCoreModule } from '../native-modules.js'; -type InitialNotifMessageOptions = { +export type InitialNotifMessageOptions = { + +callServerEndpoint?: ?CallServerEndpoint, +callServerEndpointOptions?: ?CallServerEndpointOptions, }; function useInitialNotificationsEncryptedMessage(): ( @@ -27,10 +31,13 @@ return React.useCallback( async options => { + const callServerEndpoint = options?.callServerEndpoint; const callServerEndpointOptions = options?.callServerEndpointOptions; - const olmSessionDataPromise = callGetOlmSessionInitializationData( - callServerEndpointOptions, - ); + + const initDataAction = callServerEndpoint + ? getOlmSessionInitializationData(callServerEndpoint) + : callGetOlmSessionInitializationData; + const olmSessionDataPromise = initDataAction(callServerEndpointOptions); dispatchActionPromise( getOlmSessionInitializationDataActionTypes,