From d49a6d48fc48db4383aaf8a1cd3e2bb5cfdd880d Mon Sep 17 00:00:00 2001 From: Carlos Miceli Date: Tue, 25 Feb 2025 15:15:13 -0300 Subject: [PATCH] Revert "Merge pull request #56926 from callstack-internal/feat/add-troubleshoot-menu-to-publicscreens" This reverts commit fd654cb004935e328994f79da6f6123b01fb6cd0, reversing changes made to aea1f859fb1c7350ba6dc57a224d3cba6099dc80. --- src/Expensify.tsx | 8 +- src/ROUTES.ts | 2 +- src/SCREENS.ts | 2 +- src/components/TestToolMenu.tsx | 97 +++--- src/components/TestToolsModal.tsx | 2 +- src/hooks/useDebugShortcut.ts | 26 -- src/hooks/useIsAuthenticated.ts | 11 - .../Navigation/AppNavigator/AuthScreens.tsx | 13 + .../ModalStackNavigators/index.tsx | 8 +- .../Navigators/RightModalNavigator.tsx | 299 +++++++++--------- .../Navigation/AppNavigator/PublicScreens.tsx | 5 - .../RELATIONS/SETTINGS_TO_RHP.ts | 2 +- src/libs/Navigation/linkingConfig/config.ts | 9 +- src/libs/Navigation/types.ts | 9 +- src/pages/settings/AboutPage/ConsolePage.tsx | 22 +- .../ShareLogList/BaseShareLogList.tsx | 24 +- .../Troubleshoot/TroubleshootPage.tsx | 6 +- 17 files changed, 239 insertions(+), 306 deletions(-) delete mode 100644 src/hooks/useDebugShortcut.ts delete mode 100644 src/hooks/useIsAuthenticated.ts diff --git a/src/Expensify.tsx b/src/Expensify.tsx index 0f3138bbfb75..85e8f6c6af88 100644 --- a/src/Expensify.tsx +++ b/src/Expensify.tsx @@ -12,12 +12,9 @@ import GrowlNotification from './components/GrowlNotification'; import RequireTwoFactorAuthenticationModal from './components/RequireTwoFactorAuthenticationModal'; import AppleAuthWrapper from './components/SignInButtons/AppleAuthWrapper'; import SplashScreenHider from './components/SplashScreenHider'; -import TestToolsModal from './components/TestToolsModal'; import UpdateAppModal from './components/UpdateAppModal'; import * as CONFIG from './CONFIG'; import CONST from './CONST'; -import useDebugShortcut from './hooks/useDebugShortcut'; -import useIsAuthenticated from './hooks/useIsAuthenticated'; import useLocalize from './hooks/useLocalize'; import {updateLastRoute} from './libs/actions/App'; import {disconnect} from './libs/actions/Delegate'; @@ -100,8 +97,6 @@ function Expensify() { const [focusModeNotification] = useOnyx(ONYXKEYS.FOCUS_MODE_NOTIFICATION, {initWithStoredValues: false}); const [lastVisitedPath] = useOnyx(ONYXKEYS.LAST_VISITED_PATH); - useDebugShortcut(); - useEffect(() => { if (!account?.needsTwoFactorAuthSetup || account.requiresTwoFactorAuth) { return; @@ -118,7 +113,7 @@ function Expensify() { setAttemptedToOpenPublicRoom(true); }, [isCheckingPublicRoom]); - const isAuthenticated = useIsAuthenticated(); + const isAuthenticated = useMemo(() => !!(session?.authToken ?? null), [session]); const autoAuthState = useMemo(() => session?.autoAuthState ?? '', [session]); const shouldInit = isNavigationReady && hasAttemptedToOpenPublicRoom; @@ -311,7 +306,6 @@ function Expensify() { /> )} {shouldHideSplash && } - ); } diff --git a/src/ROUTES.ts b/src/ROUTES.ts index e7d6990db8d5..1974f9851a88 100644 --- a/src/ROUTES.ts +++ b/src/ROUTES.ts @@ -268,7 +268,7 @@ const ROUTES = { SETTINGS_STATUS_CLEAR_AFTER_DATE: 'settings/profile/status/clear-after/date', SETTINGS_STATUS_CLEAR_AFTER_TIME: 'settings/profile/status/clear-after/time', SETTINGS_TROUBLESHOOT: 'settings/troubleshoot', - CONSOLE_DEBUG: { + SETTINGS_CONSOLE: { route: 'settings/troubleshoot/console', getRoute: (backTo?: string) => getUrlWithBackToParam(`settings/troubleshoot/console`, backTo), }, diff --git a/src/SCREENS.ts b/src/SCREENS.ts index 7c32387244a2..d950fb1cd5db 100644 --- a/src/SCREENS.ts +++ b/src/SCREENS.ts @@ -62,7 +62,6 @@ const SCREENS = { ADVANCED_FILTERS_IN_RHP: 'Search_Advanced_Filters_In_RHP', TRANSACTION_HOLD_REASON_RHP: 'Search_Transaction_Hold_Reason_RHP', }, - CONSOLE_DEBUG: 'Console_Debug', SETTINGS: { ROOT: 'Settings_Root', SHARE_CODE: 'Settings_Share_Code', @@ -78,6 +77,7 @@ const SCREENS = { CLOSE: 'Settings_Close', REPORT_CARD_LOST_OR_DAMAGED: 'Settings_ReportCardLostOrDamaged', TROUBLESHOOT: 'Settings_Troubleshoot', + CONSOLE: 'Settings_Console', SHARE_LOG: 'Share_Log', PROFILE: { diff --git a/src/components/TestToolMenu.tsx b/src/components/TestToolMenu.tsx index 8d8c3bc4dc89..83aba3d4b61e 100644 --- a/src/components/TestToolMenu.tsx +++ b/src/components/TestToolMenu.tsx @@ -1,12 +1,11 @@ import React from 'react'; import {useOnyx} from 'react-native-onyx'; -import useIsAuthenticated from '@hooks/useIsAuthenticated'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; -import {isUsingStagingApi} from '@libs/ApiUtils'; -import {setShouldFailAllRequests, setShouldForceOffline, setShouldSimulatePoorConnection} from '@userActions/Network'; -import {expireSessionWithDelay, invalidateAuthToken, invalidateCredentials} from '@userActions/Session'; -import {setIsDebugModeEnabled, setShouldUseStagingServer} from '@userActions/User'; +import * as ApiUtils from '@libs/ApiUtils'; +import * as Network from '@userActions/Network'; +import * as Session from '@userActions/Session'; +import * as User from '@userActions/User'; import CONFIG from '@src/CONFIG'; import ONYXKEYS from '@src/ONYXKEYS'; import type {User as UserOnyx} from '@src/types/onyx'; @@ -29,14 +28,11 @@ function TestToolMenu() { const [network] = useOnyx(ONYXKEYS.NETWORK); const [user = USER_DEFAULT] = useOnyx(ONYXKEYS.USER); const [isUsingImportedState] = useOnyx(ONYXKEYS.IS_USING_IMPORTED_STATE); - const shouldUseStagingServer = user?.shouldUseStagingServer ?? isUsingStagingApi(); + const shouldUseStagingServer = user?.shouldUseStagingServer ?? ApiUtils.isUsingStagingApi(); const isDebugModeEnabled = !!user?.isDebugModeEnabled; const styles = useThemeStyles(); const {translate} = useLocalize(); - // Check if the user is authenticated to show options that require authentication - const isAuthenticated = useIsAuthenticated(); - return ( <> {translate('initialSettingsPage.troubleshoot.testingPreferences')} - {isAuthenticated && ( - <> - {/* When toggled the app will be put into debug mode. */} - - setIsDebugModeEnabled(!isDebugModeEnabled)} - /> - - - {/* Instantly invalidates a user's local authToken. Useful for testing flows related to reauthentication. */} - -