Page MenuHomePhorge

D12386.1765350325.diff
No OneTemporary

Size
8 KB
Referenced Files
None
Subscribers
None

D12386.1765350325.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,13 +104,11 @@
+currentCalendarQuery: () => CalendarQuery,
+frozen: boolean,
+preRequestUserState: PreRequestUserState,
- +noDataAfterPolicyAcknowledgment?: boolean,
+lastCommunicatedPlatformDetails: ?PlatformDetails,
+decompressSocketMessage: CompressedData => string,
+activeSessionRecovery: null | RecoveryFromReduxActionSource,
+dispatch: Dispatch,
+dispatchActionPromise: DispatchActionPromise,
- +showSocketCrashLoopAlert?: () => mixed,
+fetchPendingUpdates: FetchPendingUpdatesInput => Promise<ClientStateSyncSocketResult>,
+isConnectedToInternet: boolean,
};
@@ -128,7 +126,6 @@
messageLastReceived: ?number;
reopenConnectionAfterClosing: boolean = false;
initializedWithUserState: ?PreRequestUserState;
- initFailureCountAfterPolicyAcknowledgment: number = 0;
initFailureCount: number = 0;
fetchingPendingUpdates: boolean = false;
@@ -443,7 +440,6 @@
if (!message) {
return;
}
- this.initFailureCountAfterPolicyAcknowledgment = 0;
this.initFailureCount = 0;
const { inflightRequests } = this.state;
@@ -684,32 +680,12 @@
try {
await this.sendInitialMessage();
} catch (e) {
- if (this.props.noDataAfterPolicyAcknowledgment) {
- this.initFailureCountAfterPolicyAcknowledgment++;
- this.initFailureCount = 0;
+ if (this.props.isConnectedToInternet) {
+ this.initFailureCount++;
} else {
- this.initFailureCountAfterPolicyAcknowledgment = 0;
- if (this.props.isConnectedToInternet) {
- this.initFailureCount++;
- } else {
- this.initFailureCount = 0;
- }
- }
- if (this.initFailureCountAfterPolicyAcknowledgment >= 2) {
- this.initFailureCountAfterPolicyAcknowledgment = 0;
this.initFailureCount = 0;
- this.props.showSocketCrashLoopAlert?.();
- this.props.dispatch({
- type: setActiveSessionRecoveryActionType,
- payload: {
- activeSessionRecovery:
- recoveryFromReduxActionSources.refetchUserDataAfterAcknowledgment,
- keyserverID: this.props.keyserverID,
- },
- });
- return;
- } else if (this.initFailureCount >= 2 && !this.fetchingPendingUpdates) {
- this.initFailureCountAfterPolicyAcknowledgment = 0;
+ }
+ if (this.initFailureCount >= 2 && !this.fetchingPendingUpdates) {
this.initFailureCount = 0;
this.fetchingPendingUpdates = true;
try {
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
@@ -102,6 +102,9 @@
appStartReduxLoggedInButInvalidCookie:
'APP_START_REDUX_LOGGED_IN_BUT_INVALID_COOKIE',
socketAuthErrorResolutionAttempt: 'SOCKET_AUTH_ERROR_RESOLUTION_ATTEMPT',
+ // The below type is deprecated, but we can't remove it here as it's used for
+ // input validation on the keyserver, and we don't want to break support for
+ // older clients
refetchUserDataAfterAcknowledgment: 'REFETCH_USER_DATA_AFTER_ACKNOWLEDGMENT',
socketNotLoggedIn: 'SOCKET_NOT_LOGGED_IN',
});
diff --git a/native/selectors/account-selectors.js b/native/selectors/account-selectors.js
--- a/native/selectors/account-selectors.js
+++ b/native/selectors/account-selectors.js
@@ -1,18 +1,13 @@
// @flow
-import _memoize from 'lodash/memoize.js';
import { createSelector } from 'reselect';
import { legacyLogInExtraInfoSelector } from 'lib/selectors/account-selectors.js';
-import { currentAsOfSelector } from 'lib/selectors/keyserver-selectors.js';
import type { LegacyLogInExtraInfo } from 'lib/types/account-types.js';
import type { SignedIdentityKeysBlob } from 'lib/types/crypto-types.js';
-import type { UserPolicies } from 'lib/types/policy-types.js';
-import { values } from 'lib/utils/objects.js';
import { commCoreModule } from '../native-modules.js';
import type { AppState } from '../redux/state-types.js';
-import type { ConnectivityInfo } from '../types/connectivity.js';
const nativeLegacyLogInExtraInfoSelector: (
state: AppState,
@@ -36,31 +31,4 @@
},
);
-const baseNoDataAfterPolicyAcknowledgmentSelector: (
- keyserverID: string,
-) => (state: AppState) => boolean = keyserverID =>
- createSelector(
- (state: AppState) => state.connectivity,
- currentAsOfSelector(keyserverID),
- (state: AppState) => state.userPolicies,
- (
- connectivity: ConnectivityInfo,
- currentAsOf: number,
- userPolicies: UserPolicies,
- ) =>
- connectivity.connected &&
- currentAsOf === 0 &&
- values(userPolicies).length > 0 &&
- values(userPolicies).every(policy => policy.isAcknowledged),
- );
-
-const noDataAfterPolicyAcknowledgmentSelector: (
- keyserverID: string,
-) => (state: AppState) => boolean = _memoize(
- baseNoDataAfterPolicyAcknowledgmentSelector,
-);
-
-export {
- nativeLegacyLogInExtraInfoSelector,
- noDataAfterPolicyAcknowledgmentSelector,
-};
+export { nativeLegacyLogInExtraInfoSelector };
diff --git a/native/socket.react.js b/native/socket.react.js
--- a/native/socket.react.js
+++ b/native/socket.react.js
@@ -4,7 +4,6 @@
import * as React from 'react';
import { useFetchPendingUpdates } from 'lib/actions/update-actions.js';
-import { canResolveKeyserverSessionInvalidation } from 'lib/keyserver-conn/recovery-utils.js';
import { preRequestUserStateForSingleKeyserverSelector } from 'lib/selectors/account-selectors.js';
import {
cookieSelector,
@@ -13,12 +12,10 @@
} from 'lib/selectors/keyserver-selectors.js';
import { openSocketSelector } from 'lib/selectors/socket-selectors.js';
import { isLoggedIn } from 'lib/selectors/user-selectors.js';
-import { accountHasPassword } from 'lib/shared/account-utils.js';
import { useInitialNotificationsEncryptedMessage } from 'lib/shared/crypto-utils.js';
import Socket, { type BaseSocketProps } from 'lib/socket/socket.react.js';
import { useDispatchActionPromise } from 'lib/utils/redux-promise-utils.js';
import { useDispatch } from 'lib/utils/redux-utils.js';
-import { usingCommServicesAccessToken } from 'lib/utils/services-utils.js';
import {
activeMessageListSelector,
@@ -26,13 +23,11 @@
} from './navigation/nav-selectors.js';
import { NavContext } from './navigation/navigation-context.js';
import { useSelector } from './redux/redux-utils.js';
-import { noDataAfterPolicyAcknowledgmentSelector } from './selectors/account-selectors.js';
import {
sessionIdentificationSelector,
nativeGetClientResponsesSelector,
nativeSessionStateFuncSelector,
} from './selectors/socket-selectors.js';
-import Alert from './utils/alert.js';
import { decompressMessage } from './utils/decompress.js';
const NativeSocket: React.ComponentType<BaseSocketProps> =
@@ -48,10 +43,6 @@
const active = useSelector(
state => isLoggedIn(state) && state.lifecycleState !== 'background',
);
- const noDataAfterPolicyAcknowledgment = useSelector(
- noDataAfterPolicyAcknowledgmentSelector(keyserverID),
- );
- const currentUserInfo = useSelector(state => state.currentUserInfo);
const openSocket = useSelector(openSocketSelector(keyserverID));
invariant(openSocket, 'openSocket failed to be created');
@@ -100,24 +91,6 @@
const dispatch = useDispatch();
const dispatchActionPromise = useDispatchActionPromise();
- const hasPassword = accountHasPassword(currentUserInfo);
- const showSocketCrashLoopAlert = React.useCallback(() => {
- if (
- canResolveKeyserverSessionInvalidation() &&
- (hasPassword || usingCommServicesAccessToken)
- ) {
- // In this case, we expect that the socket crash loop recovery
- // will be invisible to the user, so we don't show an alert
- return;
- }
- Alert.alert(
- 'Log in needed',
- 'After acknowledging the policies, we need you to log in to your ' +
- 'account again',
- [{ text: 'OK' }],
- );
- }, [hasPassword]);
-
const activeSessionRecovery = useSelector(
state =>
state.keyserverStore.keyserverInfos[keyserverID]?.connection
@@ -146,8 +119,6 @@
preRequestUserState={preRequestUserState}
dispatch={dispatch}
dispatchActionPromise={dispatchActionPromise}
- noDataAfterPolicyAcknowledgment={noDataAfterPolicyAcknowledgment}
- showSocketCrashLoopAlert={showSocketCrashLoopAlert}
lastCommunicatedPlatformDetails={lastCommunicatedPlatformDetails}
decompressSocketMessage={decompressMessage}
activeSessionRecovery={activeSessionRecovery}

File Metadata

Mime Type
text/plain
Expires
Wed, Dec 10, 7:05 AM (13 h, 53 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5861905
Default Alt Text
D12386.1765350325.diff (8 KB)

Event Timeline