diff --git a/src/ONYXKEYS.ts b/src/ONYXKEYS.ts index 31e22491e2b9..bb1766f40e1f 100755 --- a/src/ONYXKEYS.ts +++ b/src/ONYXKEYS.ts @@ -241,9 +241,6 @@ const ONYXKEYS = { // This can be either "light", "dark" or "system" PREFERRED_THEME: 'preferredTheme', - // Experimental memory only Onyx mode flag - IS_USING_MEMORY_ONLY_KEYS: 'isUsingMemoryOnlyKeys', - // Information about the onyx updates IDs that were received from the server ONYX_UPDATES_FROM_SERVER: 'onyxUpdatesFromServer', @@ -566,7 +563,6 @@ type OnyxValuesMapping = { [ONYXKEYS.MY_DOMAIN_SECURITY_GROUPS]: Record; [ONYXKEYS.LAST_OPENED_PUBLIC_ROOM_ID]: string; [ONYXKEYS.PREFERRED_THEME]: ValueOf; - [ONYXKEYS.IS_USING_MEMORY_ONLY_KEYS]: boolean; [ONYXKEYS.MAPBOX_ACCESS_TOKEN]: OnyxTypes.MapboxAccessToken; [ONYXKEYS.ONYX_UPDATES_FROM_SERVER]: OnyxTypes.OnyxUpdatesFromServer; [ONYXKEYS.ONYX_UPDATES_LAST_UPDATE_ID_APPLIED_TO_CLIENT]: number; diff --git a/src/libs/Middleware/SaveResponseInOnyx.ts b/src/libs/Middleware/SaveResponseInOnyx.ts index 3b5cd60d84a4..ffe4f8a9bea9 100644 --- a/src/libs/Middleware/SaveResponseInOnyx.ts +++ b/src/libs/Middleware/SaveResponseInOnyx.ts @@ -1,8 +1,6 @@ import {SIDE_EFFECT_REQUEST_COMMANDS, WRITE_COMMANDS} from '@libs/API/types'; -import * as MemoryOnlyKeys from '@userActions/MemoryOnlyKeys/MemoryOnlyKeys'; import * as OnyxUpdates from '@userActions/OnyxUpdates'; import CONST from '@src/CONST'; -import ONYXKEYS from '@src/ONYXKEYS'; import type Middleware from './types'; // If we're executing any of these requests, we don't need to trigger our OnyxUpdates flow to update the current data even if our current value is out of @@ -19,16 +17,6 @@ const SaveResponseInOnyx: Middleware = (requestResponse, request) => return Promise.resolve(response); } - // If there is an OnyxUpdate for using memory only keys, enable them - onyxUpdates?.find(({key, value}) => { - if (key !== ONYXKEYS.IS_USING_MEMORY_ONLY_KEYS || !value) { - return false; - } - - MemoryOnlyKeys.enable(); - return true; - }); - const responseToApply = { type: CONST.ONYX_UPDATE_TYPES.HTTPS, lastUpdateID: Number(response?.lastUpdateID ?? 0), diff --git a/src/libs/Navigation/AppNavigator/AuthScreens.tsx b/src/libs/Navigation/AppNavigator/AuthScreens.tsx index 6f5dcdf9cda9..a2a435deacbd 100644 --- a/src/libs/Navigation/AppNavigator/AuthScreens.tsx +++ b/src/libs/Navigation/AppNavigator/AuthScreens.tsx @@ -49,9 +49,6 @@ type AuthScreensProps = { /** The report ID of the last opened public room as anonymous user */ lastOpenedPublicRoomID: OnyxEntry; - /** Opt-in experimental mode that prevents certain Onyx keys from persisting to disk */ - isUsingMemoryOnlyKeys: OnyxEntry; - /** The last Onyx update ID was applied to the client */ initialLastUpdateIDAppliedToClient: OnyxEntry; }; @@ -149,7 +146,7 @@ const modalScreenListeners = { }, }; -function AuthScreens({session, lastOpenedPublicRoomID, isUsingMemoryOnlyKeys = false, initialLastUpdateIDAppliedToClient}: AuthScreensProps) { +function AuthScreens({session, lastOpenedPublicRoomID, initialLastUpdateIDAppliedToClient}: AuthScreensProps) { const styles = useThemeStyles(); const StyleUtils = useStyleUtils(); const {isSmallScreenWidth} = useWindowDimensions(); @@ -167,7 +164,6 @@ function AuthScreens({session, lastOpenedPublicRoomID, isUsingMemoryOnlyKeys = f const chatShortcutConfig = CONST.KEYBOARD_SHORTCUTS.NEW_CHAT; const currentUrl = getCurrentUrl(); const isLoggingInAsNewUser = !!session?.email && SessionUtils.isLoggingInAsNewUser(currentUrl, session.email); - const shouldGetAllData = !!isUsingMemoryOnlyKeys || SessionUtils.didUserLogInDuringSession(); // Sign out the current user if we're transitioning with a different user const isTransitioning = currentUrl.includes(ROUTES.TRANSITION_BETWEEN_APPS); const isSupportalTransition = currentUrl.includes('authTokenType=support'); @@ -189,10 +185,7 @@ function AuthScreens({session, lastOpenedPublicRoomID, isUsingMemoryOnlyKeys = f // If we are on this screen then we are "logged in", but the user might not have "just logged in". They could be reopening the app // or returning from background. If so, we'll assume they have some app data already and we can call reconnectApp() instead of openApp(). - // Note: If a Guide has enabled the memory only key mode then we do want to run OpenApp as their app will not be rehydrated with - // the correct state on refresh. They are explicitly opting out of storing data they would need (i.e. reports_) to take advantage of - // the optimizations performed during ReconnectApp. - if (shouldGetAllData) { + if (SessionUtils.didUserLogInDuringSession()) { App.openApp(); } else { App.reconnectApp(initialLastUpdateIDAppliedToClient); @@ -381,9 +374,6 @@ export default withOnyx({ lastOpenedPublicRoomID: { key: ONYXKEYS.LAST_OPENED_PUBLIC_ROOM_ID, }, - isUsingMemoryOnlyKeys: { - key: ONYXKEYS.IS_USING_MEMORY_ONLY_KEYS, - }, initialLastUpdateIDAppliedToClient: { key: ONYXKEYS.ONYX_UPDATES_LAST_UPDATE_ID_APPLIED_TO_CLIENT, }, diff --git a/src/libs/PolicyUtils.ts b/src/libs/PolicyUtils.ts index f6534e075773..a109bce4c234 100644 --- a/src/libs/PolicyUtils.ts +++ b/src/libs/PolicyUtils.ts @@ -102,11 +102,6 @@ function isExpensifyTeam(email: string | undefined): boolean { return emailDomain === CONST.EXPENSIFY_PARTNER_NAME || emailDomain === CONST.EMAIL.GUIDES_DOMAIN; } -function isExpensifyGuideTeam(email: string): boolean { - const emailDomain = Str.extractEmailDomain(email ?? ''); - return emailDomain === CONST.EMAIL.GUIDES_DOMAIN; -} - /** * Checks if the current user is an admin of the policy. */ @@ -282,7 +277,6 @@ export { getPolicyBrickRoadIndicatorStatus, shouldShowPolicy, isExpensifyTeam, - isExpensifyGuideTeam, isInstantSubmitEnabled, isFreeGroupPolicy, isPolicyAdmin, diff --git a/src/libs/actions/MemoryOnlyKeys/MemoryOnlyKeys.ts b/src/libs/actions/MemoryOnlyKeys/MemoryOnlyKeys.ts deleted file mode 100644 index 15b9133f0aaf..000000000000 --- a/src/libs/actions/MemoryOnlyKeys/MemoryOnlyKeys.ts +++ /dev/null @@ -1,20 +0,0 @@ -import Onyx from 'react-native-onyx'; -import type {OnyxKey} from 'react-native-onyx'; -import Log from '@libs/Log'; -import ONYXKEYS from '@src/ONYXKEYS'; - -const memoryOnlyKeys: OnyxKey[] = [ONYXKEYS.COLLECTION.REPORT, ONYXKEYS.COLLECTION.POLICY, ONYXKEYS.PERSONAL_DETAILS_LIST]; - -const enable = () => { - Log.info('[MemoryOnlyKeys] enabled'); - Onyx.set(ONYXKEYS.IS_USING_MEMORY_ONLY_KEYS, true); - Onyx.setMemoryOnlyKeys(memoryOnlyKeys); -}; - -const disable = () => { - Log.info('[MemoryOnlyKeys] disabled'); - Onyx.set(ONYXKEYS.IS_USING_MEMORY_ONLY_KEYS, false); - Onyx.setMemoryOnlyKeys([]); -}; - -export {disable, enable}; diff --git a/src/libs/actions/MemoryOnlyKeys/exposeGlobalMemoryOnlyKeysMethods/index.native.ts b/src/libs/actions/MemoryOnlyKeys/exposeGlobalMemoryOnlyKeysMethods/index.native.ts deleted file mode 100644 index b89e03bdefdc..000000000000 --- a/src/libs/actions/MemoryOnlyKeys/exposeGlobalMemoryOnlyKeysMethods/index.native.ts +++ /dev/null @@ -1,8 +0,0 @@ -import type ExposeGlobalMemoryOnlyKeysMethods from './types'; - -/** - * This is a no-op because the global methods will only work for web and desktop - */ -const exposeGlobalMemoryOnlyKeysMethods: ExposeGlobalMemoryOnlyKeysMethods = () => {}; - -export default exposeGlobalMemoryOnlyKeysMethods; diff --git a/src/libs/actions/MemoryOnlyKeys/exposeGlobalMemoryOnlyKeysMethods/index.ts b/src/libs/actions/MemoryOnlyKeys/exposeGlobalMemoryOnlyKeysMethods/index.ts deleted file mode 100644 index 4514edacb288..000000000000 --- a/src/libs/actions/MemoryOnlyKeys/exposeGlobalMemoryOnlyKeysMethods/index.ts +++ /dev/null @@ -1,13 +0,0 @@ -import * as MemoryOnlyKeys from '@userActions/MemoryOnlyKeys/MemoryOnlyKeys'; -import type ExposeGlobalMemoryOnlyKeysMethods from './types'; - -const exposeGlobalMemoryOnlyKeysMethods: ExposeGlobalMemoryOnlyKeysMethods = () => { - window.enableMemoryOnlyKeys = () => { - MemoryOnlyKeys.enable(); - }; - window.disableMemoryOnlyKeys = () => { - MemoryOnlyKeys.disable(); - }; -}; - -export default exposeGlobalMemoryOnlyKeysMethods; diff --git a/src/libs/actions/MemoryOnlyKeys/exposeGlobalMemoryOnlyKeysMethods/types.ts b/src/libs/actions/MemoryOnlyKeys/exposeGlobalMemoryOnlyKeysMethods/types.ts deleted file mode 100644 index 4cb50041b627..000000000000 --- a/src/libs/actions/MemoryOnlyKeys/exposeGlobalMemoryOnlyKeysMethods/types.ts +++ /dev/null @@ -1,3 +0,0 @@ -type ExposeGlobalMemoryOnlyKeysMethods = () => void; - -export default ExposeGlobalMemoryOnlyKeysMethods; diff --git a/src/pages/signin/LoginForm/BaseLoginForm.tsx b/src/pages/signin/LoginForm/BaseLoginForm.tsx index bca0fbd2f8ef..4286a2603341 100644 --- a/src/pages/signin/LoginForm/BaseLoginForm.tsx +++ b/src/pages/signin/LoginForm/BaseLoginForm.tsx @@ -22,15 +22,12 @@ import useThemeStyles from '@hooks/useThemeStyles'; import canFocusInputOnScreenFocus from '@libs/canFocusInputOnScreenFocus'; import * as ErrorUtils from '@libs/ErrorUtils'; import isInputAutoFilled from '@libs/isInputAutoFilled'; -import Log from '@libs/Log'; import * as LoginUtils from '@libs/LoginUtils'; import {parsePhoneNumber} from '@libs/PhoneNumber'; -import * as PolicyUtils from '@libs/PolicyUtils'; import * as ValidationUtils from '@libs/ValidationUtils'; import Visibility from '@libs/Visibility'; import willBlurTextInputOnTapOutsideFunc from '@libs/willBlurTextInputOnTapOutside'; import * as CloseAccount from '@userActions/CloseAccount'; -import * as MemoryOnlyKeys from '@userActions/MemoryOnlyKeys/MemoryOnlyKeys'; import * as Session from '@userActions/Session'; import CONFIG from '@src/CONFIG'; import CONST from '@src/CONST'; @@ -151,12 +148,6 @@ function BaseLoginForm({account, credentials, closeAccount, blurOnSubmit = false const loginTrim = login.trim(); - // If the user has entered a guide email, then we are going to enable an experimental Onyx mode to help with performance - if (PolicyUtils.isExpensifyGuideTeam(loginTrim)) { - Log.info('Detected guide email in login field, setting memory only keys.'); - MemoryOnlyKeys.enable(); - } - const phoneLogin = LoginUtils.appendCountryCode(LoginUtils.getPhoneNumberWithoutSpecialChars(loginTrim)); const parsedPhoneNumber = parsePhoneNumber(phoneLogin); diff --git a/src/setup/index.ts b/src/setup/index.ts index a97862df9ae7..f79e6a461a3e 100644 --- a/src/setup/index.ts +++ b/src/setup/index.ts @@ -3,7 +3,6 @@ import Onyx from 'react-native-onyx'; import intlPolyfill from '@libs/IntlPolyfill'; import * as Metrics from '@libs/Metrics'; import * as Device from '@userActions/Device'; -import exposeGlobalMemoryOnlyKeysMethods from '@userActions/MemoryOnlyKeys/exposeGlobalMemoryOnlyKeysMethods'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import addUtilsToWindow from './addUtilsToWindow'; @@ -47,8 +46,6 @@ export default function () { }, }); - exposeGlobalMemoryOnlyKeysMethods(); - Device.setDeviceID(); // Force app layout to work left to right because our design does not currently support devices using this mode diff --git a/src/types/modules/react-native-onyx.d.ts b/src/types/modules/react-native-onyx.d.ts index ade71706a8e8..8498b03ec933 100644 --- a/src/types/modules/react-native-onyx.d.ts +++ b/src/types/modules/react-native-onyx.d.ts @@ -14,8 +14,6 @@ declare global { // Global methods for Onyx key management for debugging purposes // eslint-disable-next-line @typescript-eslint/consistent-type-definitions interface Window { - enableMemoryOnlyKeys: () => void; - disableMemoryOnlyKeys: () => void; Onyx: typeof Onyx; } }