Page MenuHomePhabricator

D7853.id27343.diff
No OneTemporary

D7853.id27343.diff

diff --git a/lib/socket/socket.react.js b/lib/socket/socket.react.js
--- a/lib/socket/socket.react.js
+++ b/lib/socket/socket.react.js
@@ -104,6 +104,8 @@
// async functions that hit server APIs
+logOut: (preRequestUserState: PreRequestUserState) => Promise<LogOutResult>,
+socketCrashLoopRecovery?: () => Promise<void>,
+ // keyserver olm sessions specific props
+ +getInitialNotificationsEncryptedMessage?: () => Promise<string>,
};
type State = {
+inflightRequests: ?InflightRequests,
@@ -463,6 +465,7 @@
cookie,
this.props.urlPrefix,
logInActionSources.socketAuthErrorResolutionAttempt,
+ this.props.getInitialNotificationsEncryptedMessage,
);
if (!recoverySessionChange && sessionChange) {
diff --git a/lib/utils/action-utils.js b/lib/utils/action-utils.js
--- a/lib/utils/action-utils.js
+++ b/lib/utils/action-utils.js
@@ -179,6 +179,7 @@
cookie: ?string,
urlPrefix: string,
logInActionSource: LogInActionSource,
+ getInitialNotificationsEncryptedMessage?: () => Promise<string>,
): Promise<?ClientSessionChange> {
const resolveInvalidatedCookie = getConfig().resolveInvalidatedCookie;
if (!resolveInvalidatedCookie) {
@@ -241,6 +242,7 @@
boundCallServerEndpoint,
dispatchRecoveryAttempt,
logInActionSource,
+ getInitialNotificationsEncryptedMessage,
);
return newSessionChange;
}
diff --git a/lib/utils/config.js b/lib/utils/config.js
--- a/lib/utils/config.js
+++ b/lib/utils/config.js
@@ -12,6 +12,7 @@
callServerEndpoint: CallServerEndpoint,
dispatchRecoveryAttempt: DispatchRecoveryAttempt,
logInActionSource: LogInActionSource,
+ getInitialNotificationsEncryptedMessage?: () => Promise<string>,
) => Promise<void>,
+setCookieOnRequest: boolean,
+setSessionIDOnRequest: boolean,
diff --git a/native/account/logged-out-modal.react.js b/native/account/logged-out-modal.react.js
--- a/native/account/logged-out-modal.react.js
+++ b/native/account/logged-out-modal.react.js
@@ -62,6 +62,7 @@
runTiming,
ratchetAlongWithKeyboardHeight,
} from '../utils/animation-utils.js';
+import { useInitialNotificationsEncryptedMessage } from '../utils/crypto-utils.js';
import {
type StateContainer,
type StateChange,
@@ -136,6 +137,8 @@
+styles: typeof unboundStyles,
// Redux dispatch functions
+dispatch: Dispatch,
+ // Keyserver olm sessions functions
+ +getInitialNotificationsEncryptedMessage: () => Promise<string>,
};
type State = {
+mode: LoggedOutMode,
@@ -315,6 +318,7 @@
cookie,
urlPrefix,
actionSource,
+ this.props.getInitialNotificationsEncryptedMessage,
);
if (
sessionChange &&
@@ -778,6 +782,8 @@
const styles = useStyles(unboundStyles);
const dispatch = useDispatch();
+ const getInitialNotificationsEncryptedMessage =
+ useInitialNotificationsEncryptedMessage();
return (
<LoggedOutModal
{...props}
@@ -791,6 +797,9 @@
splashStyle={splashStyle}
styles={styles}
dispatch={dispatch}
+ getInitialNotificationsEncryptedMessage={
+ getInitialNotificationsEncryptedMessage
+ }
/>
);
});
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
@@ -14,15 +14,23 @@
callServerEndpoint: CallServerEndpoint,
dispatchRecoveryAttempt: DispatchRecoveryAttempt,
logInActionSource: LogInActionSource,
+ getInitialNotificationsEncryptedMessage?: () => Promise<string>,
) {
const keychainCredentials = await fetchNativeKeychainCredentials();
if (!keychainCredentials) {
return;
}
- const extraInfo = await nativeLogInExtraInfoSelector({
+ let extraInfo = await nativeLogInExtraInfoSelector({
redux: store.getState(),
navContext: getGlobalNavContext(),
})();
+
+ if (getInitialNotificationsEncryptedMessage) {
+ const initialNotificationsEncryptedMessage =
+ await getInitialNotificationsEncryptedMessage();
+ extraInfo = { ...extraInfo, initialNotificationsEncryptedMessage };
+ }
+
const { calendarQuery } = extraInfo;
await dispatchRecoveryAttempt(
logInActionTypes,
diff --git a/native/data/sqlite-data-handler.js b/native/data/sqlite-data-handler.js
--- a/native/data/sqlite-data-handler.js
+++ b/native/data/sqlite-data-handler.js
@@ -21,6 +21,7 @@
import { setStoreLoadedActionType } from '../redux/action-types.js';
import { useSelector } from '../redux/redux-utils.js';
import { StaffContext } from '../staff/staff-context.js';
+import { useInitialNotificationsEncryptedMessage } from '../utils/crypto-utils.js';
import { isTaskCancelledError } from '../utils/error-handling.js';
import { useStaffCanSee } from '../utils/staff-utils.js';
@@ -40,6 +41,8 @@
state.currentUserInfo?.anonymous ? undefined : state.currentUserInfo?.id,
);
const mediaCacheContext = React.useContext(MediaCacheContext);
+ const getInitialNotificationsEncryptedMessage =
+ useInitialNotificationsEncryptedMessage();
const callFetchNewCookieFromNativeCredentials = React.useCallback(
async (source: LogInActionSource) => {
@@ -49,6 +52,7 @@
cookie,
urlPrefix,
source,
+ getInitialNotificationsEncryptedMessage,
);
dispatch({ type: setStoreLoadedActionType });
} catch (fetchCookieException) {
@@ -64,7 +68,13 @@
}
}
},
- [cookie, dispatch, staffCanSee, urlPrefix],
+ [
+ cookie,
+ dispatch,
+ staffCanSee,
+ urlPrefix,
+ getInitialNotificationsEncryptedMessage,
+ ],
);
const callClearSensitiveData = React.useCallback(
diff --git a/native/socket.react.js b/native/socket.react.js
--- a/native/socket.react.js
+++ b/native/socket.react.js
@@ -30,6 +30,7 @@
nativeGetClientResponsesSelector,
nativeSessionStateFuncSelector,
} from './selectors/socket-selectors.js';
+import { useInitialNotificationsEncryptedMessage } from './utils/crypto-utils.js';
const NativeSocket: React.ComponentType<BaseSocketProps> =
React.memo<BaseSocketProps>(function NativeSocket(props: BaseSocketProps) {
@@ -88,6 +89,8 @@
const dispatch = useDispatch();
const dispatchActionPromise = useDispatchActionPromise();
const callLogOut = useServerCall(logOut);
+ const getInitialNotificationsEncryptedMessage =
+ useInitialNotificationsEncryptedMessage();
const socketCrashLoopRecovery = React.useCallback(async () => {
if (!accountHasPassword(currentUserInfo)) {
@@ -108,6 +111,7 @@
cookie,
urlPrefix,
logInActionSources.refetchUserDataAfterAcknowledgment,
+ getInitialNotificationsEncryptedMessage,
);
}, [
callLogOut,
@@ -117,6 +121,7 @@
dispatchActionPromise,
preRequestUserState,
urlPrefix,
+ getInitialNotificationsEncryptedMessage,
]);
return (
@@ -140,6 +145,9 @@
logOut={callLogOut}
noDataAfterPolicyAcknowledgment={noDataAfterPolicyAcknowledgment}
socketCrashLoopRecovery={socketCrashLoopRecovery}
+ getInitialNotificationsEncryptedMessage={
+ getInitialNotificationsEncryptedMessage
+ }
/>
);
});

File Metadata

Mime Type
text/plain
Expires
Mon, Dec 2, 11:01 PM (21 h, 29 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2607142
Default Alt Text
D7853.id27343.diff (7 KB)

Event Timeline