diff --git a/src/CONST.ts b/src/CONST.ts index edfea995ed9b..812fb4d5335d 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -2933,11 +2933,6 @@ const CONST = { PARENT_CHILD_SEPARATOR: ': ', CATEGORY_LIST_THRESHOLD: 8, TAG_LIST_THRESHOLD: 8, - DEMO_PAGES: { - SAASTR: 'SaaStrDemoSetup', - SBE: 'SbeDemoSetup', - MONEY2020: 'Money2020DemoSetup', - }, COLON: ':', MAPBOX: { PADDING: 50, diff --git a/src/Expensify.js b/src/Expensify.js index 756df5b79b88..0707ba069241 100644 --- a/src/Expensify.js +++ b/src/Expensify.js @@ -13,7 +13,6 @@ import AppleAuthWrapper from './components/SignInButtons/AppleAuthWrapper'; import SplashScreenHider from './components/SplashScreenHider'; import UpdateAppModal from './components/UpdateAppModal'; import withLocalize, {withLocalizePropTypes} from './components/withLocalize'; -import * as DemoActions from './libs/actions/DemoActions'; import * as EmojiPickerAction from './libs/actions/EmojiPickerAction'; import * as Report from './libs/actions/Report'; import * as User from './libs/actions/User'; @@ -183,13 +182,11 @@ function Expensify(props) { // If the app is opened from a deep link, get the reportID (if exists) from the deep link and navigate to the chat report Linking.getInitialURL().then((url) => { - DemoActions.runDemoByURL(url); Report.openReportFromDeepLink(url, isAuthenticated); }); // Open chat report from a deep link (only mobile native) Linking.addEventListener('url', (state) => { - DemoActions.runDemoByURL(state.url); Report.openReportFromDeepLink(state.url, isAuthenticated); }); diff --git a/src/ONYXKEYS.ts b/src/ONYXKEYS.ts index d108773ac0bd..53cd37e71f67 100755 --- a/src/ONYXKEYS.ts +++ b/src/ONYXKEYS.ts @@ -231,9 +231,6 @@ const ONYXKEYS = { // The access token to be used with the Mapbox library MAPBOX_ACCESS_TOKEN: 'mapboxAccessToken', - // Information on any active demos being run - DEMO_INFO: 'demoInfo', - // Max area supported for HTML element MAX_CANVAS_AREA: 'maxCanvasArea', @@ -431,7 +428,6 @@ type OnyxValues = { [ONYXKEYS.MAPBOX_ACCESS_TOKEN]: OnyxTypes.MapboxAccessToken; [ONYXKEYS.ONYX_UPDATES_FROM_SERVER]: OnyxTypes.OnyxUpdatesFromServer; [ONYXKEYS.ONYX_UPDATES_LAST_UPDATE_ID_APPLIED_TO_CLIENT]: number; - [ONYXKEYS.DEMO_INFO]: OnyxTypes.DemoInfo; [ONYXKEYS.MAX_CANVAS_AREA]: number; [ONYXKEYS.MAX_CANVAS_HEIGHT]: number; [ONYXKEYS.MAX_CANVAS_WIDTH]: number; diff --git a/src/ROUTES.ts b/src/ROUTES.ts index ca1fe9f0e81a..49f0337798ee 100644 --- a/src/ROUTES.ts +++ b/src/ROUTES.ts @@ -463,11 +463,6 @@ const ROUTES = { route: 'referral/:contentType', getRoute: (contentType: string) => `referral/${contentType}` as const, }, - - // These are some one-off routes that will be removed once they're no longer needed (see GH issues for details) - SAASTR: 'saastr', - SBE: 'sbe', - MONEY2020: 'money2020', } as const; export {getUrlWithBackToParam}; diff --git a/src/libs/Navigation/AppNavigator/AuthScreens.tsx b/src/libs/Navigation/AppNavigator/AuthScreens.tsx index f6572c84709d..b6304cb3b1b7 100644 --- a/src/libs/Navigation/AppNavigator/AuthScreens.tsx +++ b/src/libs/Navigation/AppNavigator/AuthScreens.tsx @@ -11,7 +11,6 @@ import * as Pusher from '@libs/Pusher/pusher'; import PusherConnectionManager from '@libs/PusherConnectionManager'; import * as SessionUtils from '@libs/SessionUtils'; import type {AuthScreensParamList} from '@navigation/types'; -import DemoSetupPage from '@pages/DemoSetupPage'; import NotFoundPage from '@pages/ErrorPage/NotFoundPage'; import DesktopSignInRedirectPage from '@pages/signin/DesktopSignInRedirectPage'; import SearchInputManager from '@pages/workspace/SearchInputManager'; @@ -50,9 +49,6 @@ type AuthScreensProps = { /** The last Onyx update ID was applied to the client */ lastUpdateIDAppliedToClient: OnyxEntry; - - /** Information about any currently running demos */ - demoInfo: OnyxEntry; }; const loadReportAttachments = () => require('../../../pages/home/report/ReportAttachments').default as React.ComponentType; @@ -130,7 +126,7 @@ const modalScreenListeners = { }, }; -function AuthScreens({lastUpdateIDAppliedToClient, session, lastOpenedPublicRoomID, demoInfo, isUsingMemoryOnlyKeys = false}: AuthScreensProps) { +function AuthScreens({lastUpdateIDAppliedToClient, session, lastOpenedPublicRoomID, isUsingMemoryOnlyKeys = false}: AuthScreensProps) { const styles = useThemeStyles(); const {isSmallScreenWidth} = useWindowDimensions(); const screenOptions = getRootNavigatorScreenOptions(isSmallScreenWidth, styles); @@ -189,10 +185,6 @@ function AuthScreens({lastUpdateIDAppliedToClient, session, lastOpenedPublicRoom App.redirectThirdPartyDesktopSignIn(); - // Check if we should be running any demos immediately after signing in. - if (demoInfo?.money2020?.isBeginningDemo) { - Navigation.navigate(ROUTES.MONEY2020, CONST.NAVIGATION.TYPE.FORCED_UP); - } if (lastOpenedPublicRoomID) { // Re-open the last opened public room if the user logged in from a public room link Report.openLastOpenedPublicRoom(lastOpenedPublicRoomID); @@ -283,21 +275,6 @@ function AuthScreens({lastUpdateIDAppliedToClient, session, lastOpenedPublicRoom options={defaultScreenOptions} getComponent={loadConciergePage} /> - - - ({ lastUpdateIDAppliedToClient: { key: ONYXKEYS.ONYX_UPDATES_LAST_UPDATE_ID_APPLIED_TO_CLIENT, }, - demoInfo: { - key: ONYXKEYS.DEMO_INFO, - }, })(AuthScreensMemoized); diff --git a/src/libs/Navigation/linkingConfig.ts b/src/libs/Navigation/linkingConfig.ts index 0383455a5946..e7080b3e72ec 100644 --- a/src/libs/Navigation/linkingConfig.ts +++ b/src/libs/Navigation/linkingConfig.ts @@ -30,9 +30,6 @@ const linkingConfig: LinkingOptions = { [SCREENS.DESKTOP_SIGN_IN_REDIRECT]: ROUTES.DESKTOP_SIGN_IN_REDIRECT, [SCREENS.REPORT_ATTACHMENTS]: ROUTES.REPORT_ATTACHMENTS.route, - // Demo routes - [CONST.DEMO_PAGES.MONEY2020]: ROUTES.MONEY2020, - // Sidebar [SCREENS.HOME]: { path: ROUTES.HOME, diff --git a/src/libs/Navigation/types.ts b/src/libs/Navigation/types.ts index 7f13640f0e9b..1217e2cfa6b1 100644 --- a/src/libs/Navigation/types.ts +++ b/src/libs/Navigation/types.ts @@ -400,16 +400,9 @@ type AuthScreensParamList = { reportID: string; source: string; }; - [CONST.DEMO_PAGES.SAASTR]: { - name: string; - }; - [CONST.DEMO_PAGES.SBE]: { - name: string; - }; [SCREENS.NOT_FOUND]: undefined; [NAVIGATORS.RIGHT_MODAL_NAVIGATOR]: NavigatorScreenParams; [SCREENS.DESKTOP_SIGN_IN_REDIRECT]: undefined; - [CONST.DEMO_PAGES.MONEY2020]: undefined; }; type RootStackParamList = PublicScreensParamList & AuthScreensParamList; diff --git a/src/libs/actions/DemoActions.js b/src/libs/actions/DemoActions.js deleted file mode 100644 index 245e475e7ca9..000000000000 --- a/src/libs/actions/DemoActions.js +++ /dev/null @@ -1,70 +0,0 @@ -import lodashGet from 'lodash/get'; -import Config from 'react-native-config'; -import Onyx from 'react-native-onyx'; -import * as API from '@libs/API'; -import Navigation from '@libs/Navigation/Navigation'; -import * as ReportUtils from '@libs/ReportUtils'; -import ONYXKEYS from '@src/ONYXKEYS'; -import ROUTES from '@src/ROUTES'; - -let currentUserEmail; -Onyx.connect({ - key: ONYXKEYS.SESSION, - callback: (val) => { - currentUserEmail = lodashGet(val, 'email', ''); - }, -}); - -function runMoney2020Demo() { - // Try to navigate to existing demo chat if it exists in Onyx - const money2020AccountID = Number(lodashGet(Config, 'EXPENSIFY_ACCOUNT_ID_MONEY2020', 15864555)); - const existingChatReport = ReportUtils.getChatByParticipants([money2020AccountID]); - if (existingChatReport) { - // We must call goBack() to remove the demo route from nav history - Navigation.goBack(); - Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(existingChatReport.reportID)); - return; - } - - // We use makeRequestWithSideEffects here because we need to get the chat report ID to navigate to it after it's created - // eslint-disable-next-line rulesdir/no-api-side-effects-method - API.makeRequestWithSideEffects('CreateChatReport', { - emailList: `${currentUserEmail},money2020@expensify.com`, - activationConference: 'money2020', - }).then((response) => { - // If there's no response or no reportID in the response, navigate the user home so user doesn't get stuck. - if (!response || !response.reportID) { - Navigation.goBack(); - Navigation.navigate(ROUTES.HOME); - return; - } - - // Get reportID & navigate to it - // Note: We must call goBack() to remove the demo route from history - const chatReportID = response.reportID; - Navigation.goBack(); - Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(chatReportID)); - }); -} - -/** - * Runs code for specific demos, based on the provided URL - * - * @param {String} url - URL user is navigating to via deep link (or regular link in web) - */ -function runDemoByURL(url = '') { - const cleanUrl = (url || '').toLowerCase(); - - if (cleanUrl.endsWith(ROUTES.MONEY2020)) { - Onyx.set(ONYXKEYS.DEMO_INFO, { - money2020: { - isBeginningDemo: true, - }, - }); - } else { - // No demo is being run, so clear out demo info - Onyx.set(ONYXKEYS.DEMO_INFO, {}); - } -} - -export {runMoney2020Demo, runDemoByURL}; diff --git a/src/pages/DemoSetupPage.js b/src/pages/DemoSetupPage.js deleted file mode 100644 index 9cf0f91906c9..000000000000 --- a/src/pages/DemoSetupPage.js +++ /dev/null @@ -1,40 +0,0 @@ -import {useFocusEffect} from '@react-navigation/native'; -import PropTypes from 'prop-types'; -import React, {useCallback} from 'react'; -import FullScreenLoadingIndicator from '@components/FullscreenLoadingIndicator'; -import Navigation from '@libs/Navigation/Navigation'; -import * as DemoActions from '@userActions/DemoActions'; -import CONST from '@src/CONST'; -import ROUTES from '@src/ROUTES'; - -const propTypes = { - /** Navigation route context info provided by react navigation */ - route: PropTypes.shape({ - /** The exact route name used to get to this screen */ - name: PropTypes.string.isRequired, - }).isRequired, -}; - -/* - * This is a "utility page", that used to call specific actions depending on the - * route that led the user here. Now, it's just used to route the user home so we - * don't show them a "Hmm... It's not here" message (which looks broken). - */ -function DemoSetupPage(props) { - useFocusEffect( - useCallback(() => { - if (props.route.name === CONST.DEMO_PAGES.MONEY2020) { - DemoActions.runMoney2020Demo(); - } else { - Navigation.goBack(ROUTES.HOME); - } - }, [props.route.name]), - ); - - return ; -} - -DemoSetupPage.propTypes = propTypes; -DemoSetupPage.displayName = 'DemoSetupPage'; - -export default DemoSetupPage; diff --git a/src/pages/home/sidebar/SidebarScreen/FloatingActionButtonAndPopover.js b/src/pages/home/sidebar/SidebarScreen/FloatingActionButtonAndPopover.js index 4a1072dc5196..9aeabefd645d 100644 --- a/src/pages/home/sidebar/SidebarScreen/FloatingActionButtonAndPopover.js +++ b/src/pages/home/sidebar/SidebarScreen/FloatingActionButtonAndPopover.js @@ -59,13 +59,6 @@ const propTypes = { /** Forwarded ref to FloatingActionButtonAndPopover */ innerRef: PropTypes.oneOfType([PropTypes.func, PropTypes.object]), - - /** Information about any currently running demos */ - demoInfo: PropTypes.shape({ - money2020: PropTypes.shape({ - isBeginningDemo: PropTypes.bool, - }), - }), }; const defaultProps = { onHideCreateMenu: () => {}, @@ -73,7 +66,6 @@ const defaultProps = { allPolicies: {}, isLoading: false, innerRef: null, - demoInfo: {}, }; /** @@ -157,9 +149,7 @@ function FloatingActionButtonAndPopover(props) { if (currentRoute && ![NAVIGATORS.CENTRAL_PANE_NAVIGATOR, SCREENS.HOME].includes(currentRoute.name)) { return; } - if (lodashGet(props.demoInfo, 'money2020.isBeginningDemo', false)) { - return; - } + Welcome.show({routes, showCreateMenu}); // eslint-disable-next-line react-hooks/exhaustive-deps }, [props.isLoading]); @@ -284,8 +274,5 @@ export default compose( isLoading: { key: ONYXKEYS.IS_LOADING_APP, }, - demoInfo: { - key: ONYXKEYS.DEMO_INFO, - }, }), )(FloatingActionButtonAndPopoverWithRef); diff --git a/src/types/onyx/DemoInfo.ts b/src/types/onyx/DemoInfo.ts deleted file mode 100644 index dcd7efc44d8d..000000000000 --- a/src/types/onyx/DemoInfo.ts +++ /dev/null @@ -1,8 +0,0 @@ -type DemoInfo = { - money2020: { - /** If the beginning demo should be shown */ - isBeginningDemo?: boolean; - }; -}; - -export default DemoInfo; diff --git a/src/types/onyx/index.ts b/src/types/onyx/index.ts index 229fd0a53158..3d4eef500f1d 100644 --- a/src/types/onyx/index.ts +++ b/src/types/onyx/index.ts @@ -7,7 +7,6 @@ import Card from './Card'; import Credentials from './Credentials'; import Currency from './Currency'; import CustomStatusDraft from './CustomStatusDraft'; -import DemoInfo from './DemoInfo'; import Download from './Download'; import Form, {AddDebitCardForm, DateOfBirthForm} from './Form'; import FrequentlyUsedEmoji from './FrequentlyUsedEmoji'; @@ -71,7 +70,6 @@ export type { Currency, CustomStatusDraft, DateOfBirthForm, - DemoInfo, Download, Form, FrequentlyUsedEmoji,