Page MenuHomePhabricator

D5226.id17137.diff
No OneTemporary

D5226.id17137.diff

diff --git a/lib/actions/user-actions.js b/lib/actions/user-actions.js
--- a/lib/actions/user-actions.js
+++ b/lib/actions/user-actions.js
@@ -105,16 +105,6 @@
return flattened;
}
-const cookieInvalidationResolutionAttempt =
- 'COOKIE_INVALIDATION_RESOLUTION_ATTEMPT';
-const appStartCookieLoggedInButInvalidRedux =
- 'APP_START_COOKIE_LOGGED_IN_BUT_INVALID_REDUX';
-const appStartReduxLoggedInButInvalidCookie =
- 'APP_START_REDUX_LOGGED_IN_BUT_INVALID_COOKIE';
-const socketAuthErrorResolutionAttempt = 'SOCKET_AUTH_ERROR_RESOLUTION_ATTEMPT';
-const sqliteOpFailure = 'SQLITE_OP_FAILURE';
-const sqliteLoadFailure = 'SQLITE_LOAD_FAILURE';
-
const logInActionTypes = Object.freeze({
started: 'LOG_IN_STARTED',
success: 'LOG_IN_SUCCESS',
@@ -230,11 +220,8 @@
};
export {
- appStartCookieLoggedInButInvalidRedux,
- appStartReduxLoggedInButInvalidCookie,
changeUserPasswordActionTypes,
changeUserPassword,
- cookieInvalidationResolutionAttempt,
deleteAccount,
deleteAccountActionTypes,
getSessionPublicKeys,
@@ -248,9 +235,6 @@
searchUsersActionTypes,
setUserSettings,
setUserSettingsActionTypes,
- socketAuthErrorResolutionAttempt,
- sqliteLoadFailure,
- sqliteOpFailure,
updateSubscription,
updateSubscriptionActionTypes,
};
diff --git a/lib/shared/account-utils.js b/lib/shared/account-utils.js
--- a/lib/shared/account-utils.js
+++ b/lib/shared/account-utils.js
@@ -1,10 +1,7 @@
// @flow
-import {
- cookieInvalidationResolutionAttempt,
- socketAuthErrorResolutionAttempt,
-} from '../actions/user-actions';
import type { LogInActionSource } from '../types/account-types';
+import { loginActionSourceTypes } from '../types/account-types';
import type { AppState } from '../types/redux-types';
import type { PreRequestUserState } from '../types/session-types';
import type { CurrentUserInfo } from '../types/user-types';
@@ -63,8 +60,8 @@
source: ?LogInActionSource,
): boolean {
if (
- source !== cookieInvalidationResolutionAttempt &&
- source !== socketAuthErrorResolutionAttempt
+ source !== loginActionSourceTypes.cookieInvalidationResolutionAttempt &&
+ source !== loginActionSourceTypes.socketAuthErrorResolutionAttempt
) {
return false;
}
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
@@ -5,10 +5,7 @@
import * as React from 'react';
import { updateActivityActionTypes } from '../actions/activity-actions';
-import {
- socketAuthErrorResolutionAttempt,
- logOutActionTypes,
-} from '../actions/user-actions';
+import { logOutActionTypes } from '../actions/user-actions';
import { unsupervisedBackgroundActionType } from '../reducers/lifecycle-state-reducer';
import {
pingFrequency,
@@ -17,6 +14,7 @@
clientRequestSocketTimeout,
} from '../shared/timeouts';
import type { LogOutResult } from '../types/account-types';
+import { loginActionSourceTypes } from '../types/account-types';
import type { CalendarQuery } from '../types/entry-types';
import type { Dispatch } from '../types/redux-types';
import {
@@ -454,7 +452,7 @@
this.props.dispatch,
cookie,
this.props.urlPrefix,
- socketAuthErrorResolutionAttempt,
+ loginActionSourceTypes.socketAuthErrorResolutionAttempt,
);
if (!recoverySessionChange && sessionChange) {
@@ -471,7 +469,7 @@
},
preRequestUserState: this.initializedWithUserState,
error: null,
- source: socketAuthErrorResolutionAttempt,
+ source: loginActionSourceTypes.socketAuthErrorResolutionAttempt,
},
});
} else if (!recoverySessionChange) {
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
@@ -74,13 +74,18 @@
+password: string,
};
-export type LogInActionSource =
- | 'COOKIE_INVALIDATION_RESOLUTION_ATTEMPT'
- | 'APP_START_COOKIE_LOGGED_IN_BUT_INVALID_REDUX'
- | 'APP_START_REDUX_LOGGED_IN_BUT_INVALID_COOKIE'
- | 'SOCKET_AUTH_ERROR_RESOLUTION_ATTEMPT'
- | 'SQLITE_OP_FAILURE'
- | 'SQLITE_LOAD_FAILURE';
+export const loginActionSourceTypes = 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',
+ sqliteOpFailure: 'SQLITE_OP_FAILURE',
+ sqliteLoadFailure: 'SQLITE_LOAD_FAILURE',
+});
+
+export type LogInActionSource = $Values<typeof loginActionSourceTypes>;
export type LogInStartingPayload = {
+calendarQuery: CalendarQuery,
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
@@ -5,13 +5,13 @@
import { useSelector, useDispatch } from 'react-redux';
import { createSelector } from 'reselect';
-import { cookieInvalidationResolutionAttempt } from '../actions/user-actions';
import { serverCallStateSelector } from '../selectors/server-calls';
import type {
LogInActionSource,
LogInStartingPayload,
LogInResult,
} from '../types/account-types';
+import { loginActionSourceTypes } from '../types/account-types';
import type { Endpoint, SocketAPIHandler } from '../types/endpoints';
import type { LoadingOptions, LoadingInfo } from '../types/loading-types';
import type {
@@ -288,7 +288,7 @@
dispatch,
newAnonymousCookie,
urlPrefix,
- cookieInvalidationResolutionAttempt,
+ loginActionSourceTypes.cookieInvalidationResolutionAttempt,
);
currentlyWaitingForNewCookie = false;
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
@@ -18,11 +18,8 @@
import Icon from 'react-native-vector-icons/FontAwesome';
import { useDispatch } from 'react-redux';
-import {
- appStartCookieLoggedInButInvalidRedux,
- appStartReduxLoggedInButInvalidCookie,
-} from 'lib/actions/user-actions';
import { isLoggedIn } from 'lib/selectors/user-selectors';
+import { loginActionSourceTypes } from 'lib/types/account-types';
import type { Dispatch } from 'lib/types/redux-types';
import { fetchNewCookieFromNativeCredentials } from 'lib/utils/action-utils';
@@ -289,8 +286,8 @@
}
if (!__DEV__) {
const actionSource = loggedIn
- ? appStartReduxLoggedInButInvalidCookie
- : appStartCookieLoggedInButInvalidRedux;
+ ? loginActionSourceTypes.appStartReduxLoggedInButInvalidCookie
+ : loginActionSourceTypes.appStartCookieLoggedInButInvalidRedux;
const sessionChange = await fetchNewCookieFromNativeCredentials(
dispatch,
cookie,
diff --git a/native/data/sqlite-context-provider.js b/native/data/sqlite-context-provider.js
--- a/native/data/sqlite-context-provider.js
+++ b/native/data/sqlite-context-provider.js
@@ -5,7 +5,7 @@
import { setMessageStoreMessages } from 'lib/actions/message-actions.js';
import { setThreadStoreActionType } from 'lib/actions/thread-actions';
-import { sqliteLoadFailure } from 'lib/actions/user-actions';
+import { loginActionSourceTypes } from 'lib/types/account-types';
import { fetchNewCookieFromNativeCredentials } from 'lib/utils/action-utils';
import { convertClientDBThreadInfosToRawThreadInfos } from 'lib/utils/thread-ops-utils';
@@ -51,7 +51,7 @@
dispatch,
cookie,
urlPrefix,
- sqliteLoadFailure,
+ loginActionSourceTypes.sqliteLoadFailure,
);
} finally {
setStoreLoaded(true);
diff --git a/native/redux/redux-setup.js b/native/redux/redux-setup.js
--- a/native/redux/redux-setup.js
+++ b/native/redux/redux-setup.js
@@ -12,7 +12,6 @@
logOutActionTypes,
deleteAccountActionTypes,
logInActionTypes,
- sqliteOpFailure,
} from 'lib/actions/user-actions';
import baseReducer from 'lib/reducers/master-reducer';
import { processThreadStoreOperations } from 'lib/reducers/thread-reducer';
@@ -20,6 +19,7 @@
invalidSessionDowngrade,
invalidSessionRecovery,
} from 'lib/shared/account-utils';
+import { loginActionSourceTypes } from 'lib/types/account-types';
import { defaultEnabledApps } from 'lib/types/enabled-apps';
import { defaultCalendarFilters } from 'lib/types/filter-types';
import type { Dispatch, BaseAction } from 'lib/types/redux-types';
@@ -347,7 +347,7 @@
cookie: state.cookie,
},
error: null,
- source: sqliteOpFailure,
+ source: loginActionSourceTypes.sqliteOpFailure,
},
});
await persistor.flush();

File Metadata

Mime Type
text/plain
Expires
Thu, Nov 28, 7:37 AM (21 h, 7 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2593260
Default Alt Text
D5226.id17137.diff (8 KB)

Event Timeline