Page MenuHomePhabricator

D10332.diff
No OneTemporary

D10332.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
@@ -15,7 +15,6 @@
import UpdateHandler from './update-handler.react.js';
import { updateActivityActionTypes } from '../actions/activity-actions.js';
import { updateLastCommunicatedPlatformDetailsActionType } from '../actions/device-actions.js';
-import { logOutActionTypes } from '../actions/user-actions.js';
import { unsupervisedBackgroundActionType } from '../reducers/lifecycle-state-reducer.js';
import {
pingFrequency,
@@ -23,10 +22,7 @@
clientRequestVisualTimeout,
clientRequestSocketTimeout,
} from '../shared/timeouts.js';
-import {
- logInActionSources,
- type LogOutResult,
-} from '../types/account-types.js';
+import { logInActionSources } from '../types/account-types.js';
import type { CompressedData } from '../types/compression-types.js';
import { type PlatformDetails } from '../types/device-types.js';
import type { CalendarQuery } from '../types/entry-types.js';
@@ -43,6 +39,7 @@
type PreRequestUserState,
} from '../types/session-types.js';
import {
+ setConnectionIssueActionType,
clientSocketMessageTypes,
type ClientClientSocketMessage,
serverSocketMessageTypes,
@@ -111,7 +108,6 @@
+dispatch: Dispatch,
+dispatchActionPromise: DispatchActionPromise,
// async functions that hit server APIs
- +logOut: () => Promise<LogOutResult>,
+socketCrashLoopRecovery?: () => Promise<void>,
// keyserver olm sessions specific props
+getInitialNotificationsEncryptedMessage?: () => Promise<string>,
@@ -693,10 +689,13 @@
await this.props.socketCrashLoopRecovery();
} catch (error) {
console.log(error);
- void this.props.dispatchActionPromise(
- logOutActionTypes,
- this.props.logOut(),
- );
+ this.props.dispatch({
+ type: setConnectionIssueActionType,
+ payload: {
+ keyserverID: ashoatKeyserverID,
+ connectionIssue: 'policy_acknowledgement_socket_crash_loop',
+ },
+ });
}
return;
}
@@ -715,10 +714,13 @@
(e instanceof ServerError && e.message !== 'unknown_error')
) {
if (e.message === 'not_logged_in') {
- void this.props.dispatchActionPromise(
- logOutActionTypes,
- this.props.logOut(),
- );
+ this.props.dispatch({
+ type: setConnectionIssueActionType,
+ payload: {
+ keyserverID: ashoatKeyserverID,
+ connectionIssue: 'not_logged_in_error',
+ },
+ });
} else if (this.socket) {
this.socket.close();
}
diff --git a/native/socket.react.js b/native/socket.react.js
--- a/native/socket.react.js
+++ b/native/socket.react.js
@@ -3,7 +3,6 @@
import invariant from 'invariant';
import * as React from 'react';
-import { useLogOut, logOutActionTypes } from 'lib/actions/user-actions.js';
import { preRequestUserStateForSingleKeyserverSelector } from 'lib/selectors/account-selectors.js';
import {
cookieSelector,
@@ -16,6 +15,7 @@
import { useInitialNotificationsEncryptedMessage } from 'lib/shared/crypto-utils.js';
import Socket, { type BaseSocketProps } from 'lib/socket/socket.react.js';
import { logInActionSources } from 'lib/types/account-types.js';
+import { setConnectionIssueActionType } from 'lib/types/socket-types.js';
import {
useDispatchActionPromise,
fetchNewCookieFromNativeCredentials,
@@ -114,11 +114,16 @@
const dispatch = useDispatch();
const dispatchActionPromise = useDispatchActionPromise();
- const callLogOut = useLogOut();
const socketCrashLoopRecovery = React.useCallback(async () => {
if (!accountHasPassword(currentUserInfo)) {
- void dispatchActionPromise(logOutActionTypes, callLogOut());
+ void dispatch({
+ type: setConnectionIssueActionType,
+ payload: {
+ keyserverID: ashoatKeyserverID,
+ connectionIssue: 'policy_acknowledgement_socket_crash_loop',
+ },
+ });
Alert.alert(
'Log in needed',
'After acknowledging the policies, we need you to log in to your account again',
@@ -136,11 +141,9 @@
getInitialNotificationsEncryptedMessage,
);
}, [
- callLogOut,
cookie,
currentUserInfo,
dispatch,
- dispatchActionPromise,
urlPrefix,
getInitialNotificationsEncryptedMessage,
]);
@@ -163,7 +166,6 @@
preRequestUserState={preRequestUserState}
dispatch={dispatch}
dispatchActionPromise={dispatchActionPromise}
- logOut={callLogOut}
noDataAfterPolicyAcknowledgment={noDataAfterPolicyAcknowledgment}
socketCrashLoopRecovery={socketCrashLoopRecovery}
getInitialNotificationsEncryptedMessage={
diff --git a/web/socket.react.js b/web/socket.react.js
--- a/web/socket.react.js
+++ b/web/socket.react.js
@@ -3,7 +3,6 @@
import invariant from 'invariant';
import * as React from 'react';
-import { useLogOut } from 'lib/actions/user-actions.js';
import { preRequestUserStateForSingleKeyserverSelector } from 'lib/selectors/account-selectors.js';
import {
cookieSelector,
@@ -97,7 +96,6 @@
const dispatch = useDispatch();
const dispatchActionPromise = useDispatchActionPromise();
- const callLogOut = useLogOut();
const lastCommunicatedPlatformDetails = useSelector(
lastCommunicatedPlatformDetailsSelector(ashoatKeyserverID),
@@ -121,7 +119,6 @@
preRequestUserState={preRequestUserState}
dispatch={dispatch}
dispatchActionPromise={dispatchActionPromise}
- logOut={callLogOut}
lastCommunicatedPlatformDetails={lastCommunicatedPlatformDetails}
decompressSocketMessage={decompressMessage}
/>

File Metadata

Mime Type
text/plain
Expires
Sun, Nov 24, 1:43 PM (20 h, 46 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2576046
Default Alt Text
D10332.diff (5 KB)

Event Timeline