Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3380704
D11691.id39240.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
15 KB
Referenced Files
None
Subscribers
None
D11691.id39240.diff
View Options
diff --git a/lib/components/keyserver-connection-handler.js b/lib/components/keyserver-connection-handler.js
--- a/lib/components/keyserver-connection-handler.js
+++ b/lib/components/keyserver-connection-handler.js
@@ -28,7 +28,7 @@
import type { BaseSocketProps } from '../socket/socket.react.js';
import {
logInActionSources,
- type RecoveryActionSource,
+ type RecoveryFromReduxActionSource,
type AuthActionSource,
} from '../types/account-types.js';
import { authoritativeKeyserverID } from '../utils/authoritative-keyserver.js';
@@ -278,7 +278,7 @@
getConfig();
const innerPerformRecovery = React.useCallback(
(
- recoveryActionSource: RecoveryActionSource,
+ recoveryActionSource: RecoveryFromReduxActionSource,
setInProgress: boolean => mixed,
hasBeenCancelled: () => boolean,
) =>
@@ -327,7 +327,7 @@
const keyserverRecoveryLogIn = useKeyserverRecoveryLogIn(keyserverID);
const performRecovery = React.useCallback(
- (recoveryActionSource: RecoveryActionSource) => {
+ (recoveryActionSource: RecoveryFromReduxActionSource) => {
setAuthInProgress(true);
let cancelled = false;
diff --git a/lib/keyserver-conn/call-keyserver-endpoint-provider.react.js b/lib/keyserver-conn/call-keyserver-endpoint-provider.react.js
--- a/lib/keyserver-conn/call-keyserver-endpoint-provider.react.js
+++ b/lib/keyserver-conn/call-keyserver-endpoint-provider.react.js
@@ -18,8 +18,8 @@
} from './keyserver-conn-types.js';
import { canResolveKeyserverSessionInvalidation } from './recovery-utils.js';
import {
- recoveryActionSources,
- type RecoveryActionSource,
+ recoveryFromReduxActionSources,
+ type RecoveryFromReduxActionSource,
} from '../types/account-types.js';
import type { PlatformDetails } from '../types/device-types.js';
import type { Endpoint, SocketAPIHandler } from '../types/endpoints.js';
@@ -81,7 +81,7 @@
+sessionID: ?string,
+currentUserInfo: ?CurrentUserInfo,
+isSocketConnected: boolean,
- +activeSessionRecovery: ?RecoveryActionSource,
+ +activeSessionRecovery: ?RecoveryFromReduxActionSource,
+canRecoverSession?: ?boolean,
+lastCommunicatedPlatformDetails: ?PlatformDetails,
};
@@ -202,7 +202,7 @@
type: setActiveSessionRecoveryActionType,
payload: {
activeSessionRecovery:
- recoveryActionSources.cookieInvalidationResolutionAttempt,
+ recoveryFromReduxActionSources.cookieInvalidationResolutionAttempt,
keyserverID,
},
});
@@ -267,7 +267,7 @@
sessionID: ?string,
currentUserInfo: ?CurrentUserInfo,
isSocketConnected: boolean,
- activeSessionRecovery: ?RecoveryActionSource,
+ activeSessionRecovery: ?RecoveryFromReduxActionSource,
canRecoverSession: ?boolean,
lastCommunicatedPlatformDetails: ?PlatformDetails,
) =>
diff --git a/lib/keyserver-conn/keyserver-call-infos.js b/lib/keyserver-conn/keyserver-call-infos.js
--- a/lib/keyserver-conn/keyserver-call-infos.js
+++ b/lib/keyserver-conn/keyserver-call-infos.js
@@ -3,7 +3,7 @@
import { createSelector } from 'reselect';
import { useDerivedObject } from '../hooks/objects.js';
-import type { RecoveryActionSource } from '../types/account-types.js';
+import type { RecoveryFromReduxActionSource } from '../types/account-types.js';
import type { PlatformDetails } from '../types/device-types.js';
import type { KeyserverInfo } from '../types/keyserver-types.js';
@@ -17,7 +17,7 @@
+urlPrefix: string,
+sessionID: ?string,
+isSocketConnected: boolean,
- +activeSessionRecovery: ?RecoveryActionSource,
+ +activeSessionRecovery: ?RecoveryFromReduxActionSource,
+lastCommunicatedPlatformDetails: ?PlatformDetails,
};
@@ -38,7 +38,7 @@
urlPrefix: string,
sessionID: ?string,
isSocketConnected: boolean,
- activeSessionRecovery: ?RecoveryActionSource,
+ activeSessionRecovery: ?RecoveryFromReduxActionSource,
lastCommunicatedPlatformDetails: ?PlatformDetails,
) => ({
cookie,
diff --git a/lib/reducers/message-reducer.js b/lib/reducers/message-reducer.js
--- a/lib/reducers/message-reducer.js
+++ b/lib/reducers/message-reducer.js
@@ -75,7 +75,7 @@
import threadWatcher from '../shared/thread-watcher.js';
import { unshimMessageInfos } from '../shared/unshim-utils.js';
import { updateSpecs } from '../shared/updates/update-specs.js';
-import { recoveryActionSources } from '../types/account-types.js';
+import { recoveryFromReduxActionSources } from '../types/account-types.js';
import type { Media, Image } from '../types/media-types.js';
import { messageTypes } from '../types/message-types-enum.js';
import {
@@ -738,9 +738,9 @@
// TODO we can't check if the userID changed until ENG-6126
if (
action.payload.authActionSource ===
- recoveryActionSources.cookieInvalidationResolutionAttempt ||
+ recoveryFromReduxActionSources.cookieInvalidationResolutionAttempt ||
action.payload.authActionSource ===
- recoveryActionSources.socketAuthErrorResolutionAttempt
+ recoveryFromReduxActionSources.socketAuthErrorResolutionAttempt
) {
const localMessages = Object.values(messageStore.messages).filter(
rawMessageInfo => messageID(rawMessageInfo).startsWith(localIDPrefix),
diff --git a/lib/selectors/server-calls.js b/lib/selectors/server-calls.js
--- a/lib/selectors/server-calls.js
+++ b/lib/selectors/server-calls.js
@@ -10,7 +10,7 @@
connectionSelector,
lastCommunicatedPlatformDetailsSelector,
} from './keyserver-selectors.js';
-import type { RecoveryActionSource } from '../types/account-types.js';
+import type { RecoveryFromReduxActionSource } from '../types/account-types.js';
import type { PlatformDetails } from '../types/device-types.js';
import type { AppState } from '../types/redux-types.js';
import type { ConnectionInfo } from '../types/socket-types.js';
@@ -22,7 +22,7 @@
+sessionID: ?string,
+currentUserInfo: ?CurrentUserInfo,
+isSocketConnected: ?boolean,
- +activeSessionRecovery: ?RecoveryActionSource,
+ +activeSessionRecovery: ?RecoveryFromReduxActionSource,
+lastCommunicatedPlatformDetails: ?PlatformDetails,
};
diff --git a/lib/shared/session-utils.js b/lib/shared/session-utils.js
--- a/lib/shared/session-utils.js
+++ b/lib/shared/session-utils.js
@@ -7,7 +7,7 @@
sessionIDSelector,
} from '../selectors/keyserver-selectors.js';
import {
- recoveryActionSources,
+ recoveryFromReduxActionSources,
type AuthActionSource,
} from '../types/account-types.js';
import type { AppState } from '../types/redux-types.js';
@@ -90,14 +90,9 @@
// make sure that the CurrentUserInfo in Redux at the time this action is
// processed is the same as the user from whom the recovery was attempted. If
// that user has since logged out, we should ignore the result of the recovery.
-const actionSourcesCheckedForInvalidSessionRecovery = new Set([
- recoveryActionSources.cookieInvalidationResolutionAttempt,
- recoveryActionSources.socketAuthErrorResolutionAttempt,
- recoveryActionSources.appStartCookieLoggedInButInvalidRedux,
- recoveryActionSources.appStartReduxLoggedInButInvalidCookie,
- recoveryActionSources.refetchUserDataAfterAcknowledgment,
- recoveryActionSources.socketNotLoggedIn,
-]);
+const actionSourcesCheckedForInvalidSessionRecovery = new Set(
+ Object.values(recoveryFromReduxActionSources),
+);
function invalidSessionRecovery(
currentReduxState: AppState,
actionCurrentUserInfo: ?CurrentUserInfo,
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
@@ -29,8 +29,8 @@
clientKeyserverSocketReconnectDelay,
} from '../shared/timeouts.js';
import {
- recoveryActionSources,
- type RecoveryActionSource,
+ recoveryFromReduxActionSources,
+ type RecoveryFromReduxActionSource,
} from '../types/account-types.js';
import type { CompressedData } from '../types/compression-types.js';
import { type PlatformDetails } from '../types/device-types.js';
@@ -103,7 +103,7 @@
+noDataAfterPolicyAcknowledgment?: boolean,
+lastCommunicatedPlatformDetails: ?PlatformDetails,
+decompressSocketMessage: CompressedData => string,
- +activeSessionRecovery: null | RecoveryActionSource,
+ +activeSessionRecovery: null | RecoveryFromReduxActionSource,
+dispatch: Dispatch,
+dispatchActionPromise: DispatchActionPromise,
+showSocketCrashLoopAlert?: () => mixed,
@@ -498,7 +498,7 @@
type: setActiveSessionRecoveryActionType,
payload: {
activeSessionRecovery:
- recoveryActionSources.socketAuthErrorResolutionAttempt,
+ recoveryFromReduxActionSources.socketAuthErrorResolutionAttempt,
keyserverID: this.props.keyserverID,
},
});
@@ -683,7 +683,7 @@
type: setActiveSessionRecoveryActionType,
payload: {
activeSessionRecovery:
- recoveryActionSources.refetchUserDataAfterAcknowledgment,
+ recoveryFromReduxActionSources.refetchUserDataAfterAcknowledgment,
keyserverID: this.props.keyserverID,
},
});
@@ -707,7 +707,8 @@
this.props.dispatch({
type: setActiveSessionRecoveryActionType,
payload: {
- activeSessionRecovery: recoveryActionSources.socketNotLoggedIn,
+ activeSessionRecovery:
+ recoveryFromReduxActionSources.socketNotLoggedIn,
keyserverID: this.props.keyserverID,
},
});
diff --git a/lib/types/account-types.js b/lib/types/account-types.js
--- a/lib/types/account-types.js
+++ b/lib/types/account-types.js
@@ -95,21 +95,34 @@
+calendarQuery: CalendarQuery,
};
-export const recoveryActionSources = Object.freeze({
+export const recoveryFromReduxActionSources = Object.freeze({
cookieInvalidationResolutionAttempt: 'COOKIE_INVALIDATION_RESOLUTION_ATTEMPT',
appStartCookieLoggedInButInvalidRedux:
'APP_START_COOKIE_LOGGED_IN_BUT_INVALID_REDUX',
appStartReduxLoggedInButInvalidCookie:
'APP_START_REDUX_LOGGED_IN_BUT_INVALID_COOKIE',
socketAuthErrorResolutionAttempt: 'SOCKET_AUTH_ERROR_RESOLUTION_ATTEMPT',
+ refetchUserDataAfterAcknowledgment: 'REFETCH_USER_DATA_AFTER_ACKNOWLEDGMENT',
+ socketNotLoggedIn: 'SOCKET_NOT_LOGGED_IN',
+});
+
+export type RecoveryFromReduxActionSource = $Values<
+ typeof recoveryFromReduxActionSources,
+>;
+
+export const recoveryFromDataHandlerActionSources = Object.freeze({
//sqliteOpFailure: 'SQLITE_OP_FAILURE', (DEPRECATED)
sqliteLoadFailure: 'SQLITE_LOAD_FAILURE',
corruptedDatabaseDeletion: 'CORRUPTED_DATABASE_DELETION',
- refetchUserDataAfterAcknowledgment: 'REFETCH_USER_DATA_AFTER_ACKNOWLEDGMENT',
- socketNotLoggedIn: 'SOCKET_NOT_LOGGED_IN',
});
-export type RecoveryActionSource = $Values<typeof recoveryActionSources>;
+export type RecoveryFromDataHandlerActionSource = $Values<
+ typeof recoveryFromDataHandlerActionSources,
+>;
+
+export type RecoveryActionSource =
+ | RecoveryFromReduxActionSource
+ | RecoveryFromDataHandlerActionSource;
export const logInActionSources = Object.freeze({
logInFromWebForm: 'LOG_IN_FROM_WEB_FORM',
@@ -122,7 +135,8 @@
export type LogInActionSource = $Values<typeof logInActionSources>;
export const authActionSources = Object.freeze({
- ...recoveryActionSources,
+ ...recoveryFromReduxActionSources,
+ ...recoveryFromDataHandlerActionSources,
...logInActionSources,
});
diff --git a/lib/types/socket-types.js b/lib/types/socket-types.js
--- a/lib/types/socket-types.js
+++ b/lib/types/socket-types.js
@@ -4,8 +4,8 @@
import t, { type TInterface, type TUnion } from 'tcomb';
import {
- type RecoveryActionSource,
- recoveryActionSources,
+ type RecoveryFromReduxActionSource,
+ recoveryFromReduxActionSources,
} from './account-types.js';
import {
type ActivityUpdate,
@@ -503,7 +503,7 @@
+connectionIssue: ?ConnectionIssue,
// When this is flipped to truthy, a session recovery is attempted
// This can happen when the keyserver invalidates the session
- +activeSessionRecovery: null | RecoveryActionSource,
+ +activeSessionRecovery: null | RecoveryFromReduxActionSource,
};
export const connectionInfoValidator: TInterface<ConnectionInfo> =
tShape<ConnectionInfo>({
@@ -519,7 +519,9 @@
lateResponses: t.list(t.Number),
unreachable: t.Boolean,
connectionIssue: t.maybe(t.enums.of([])),
- activeSessionRecovery: t.maybe(t.enums.of(values(recoveryActionSources))),
+ activeSessionRecovery: t.maybe(
+ t.enums.of(values(recoveryFromReduxActionSources)),
+ ),
});
export const defaultConnectionInfo: ConnectionInfo = {
status: 'connecting',
@@ -531,7 +533,7 @@
};
export type SetActiveSessionRecoveryPayload = {
- +activeSessionRecovery: null | RecoveryActionSource,
+ +activeSessionRecovery: null | RecoveryFromReduxActionSource,
+keyserverID: string,
};
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
@@ -19,7 +19,7 @@
import { setActiveSessionRecoveryActionType } from 'lib/keyserver-conn/keyserver-conn-types.js';
import { cookieSelector } from 'lib/selectors/keyserver-selectors.js';
import { isLoggedIn } from 'lib/selectors/user-selectors.js';
-import { recoveryActionSources } from 'lib/types/account-types.js';
+import { recoveryFromReduxActionSources } from 'lib/types/account-types.js';
import type { Dispatch } from 'lib/types/redux-types.js';
import { useDispatch } from 'lib/utils/redux-utils.js';
import { usingCommServicesAccessToken } from 'lib/utils/services-utils.js';
@@ -420,8 +420,8 @@
}
const actionSource = loggedIn
- ? recoveryActionSources.appStartReduxLoggedInButInvalidCookie
- : recoveryActionSources.appStartCookieLoggedInButInvalidRedux;
+ ? recoveryFromReduxActionSources.appStartReduxLoggedInButInvalidCookie
+ : recoveryFromReduxActionSources.appStartCookieLoggedInButInvalidRedux;
dispatch({
type: setActiveSessionRecoveryActionType,
payload: {
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
@@ -19,8 +19,8 @@
import { useInitialNotificationsEncryptedMessage } from 'lib/shared/crypto-utils.js';
import { shouldClearData } from 'lib/shared/data-utils.js';
import {
- recoveryActionSources,
- type RecoveryActionSource,
+ recoveryFromDataHandlerActionSources,
+ type RecoveryFromDataHandlerActionSource,
} from 'lib/types/account-types.js';
import type { CallSingleKeyserverEndpoint } from 'lib/utils/call-single-keyserver-endpoint.js';
import { getMessageForException } from 'lib/utils/errors.js';
@@ -71,7 +71,7 @@
authoritativeKeyserverID,
);
const recoverDataFromAuthoritativeKeyserver = React.useCallback(
- async (source: RecoveryActionSource) => {
+ async (source: RecoveryFromDataHandlerActionSource) => {
const innerRecoverDataFromAuthoritativeKeyserver = (
callSingleKeyserverEndpoint: CallSingleKeyserverEndpoint,
callKeyserverEndpoint: CallKeyserverEndpoint,
@@ -115,7 +115,7 @@
);
const recoverData = React.useCallback(
- (source: RecoveryActionSource) => {
+ (source: RecoveryFromDataHandlerActionSource) => {
if (supportingMultipleKeyservers) {
invariant(
false,
@@ -179,7 +179,9 @@
commCoreModule.terminate();
}
}
- await recoverData(recoveryActionSources.corruptedDatabaseDeletion);
+ await recoverData(
+ recoveryFromDataHandlerActionSources.corruptedDatabaseDeletion,
+ );
})();
return;
}
@@ -258,7 +260,9 @@
'{no exception message}',
);
}
- await recoverData(recoveryActionSources.sqliteLoadFailure);
+ await recoverData(
+ recoveryFromDataHandlerActionSources.sqliteLoadFailure,
+ );
}
})();
}, [
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Nov 29, 1:36 AM (21 h, 47 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2595264
Default Alt Text
D11691.id39240.diff (15 KB)
Attached To
Mode
D11691: [lib] Separate recovery types that are managed by KeyserverConnectionHandler
Attached
Detach File
Event Timeline
Log In to Comment