From 1bbd0bce3df28b94aee2fb6cc541e7a91340ed7c Mon Sep 17 00:00:00 2001 From: Alex Beaman Date: Fri, 1 Sep 2023 21:53:34 +0300 Subject: [PATCH 1/2] Add auto-route to demo pages --- .../Navigation/AppNavigator/AuthScreens.js | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/libs/Navigation/AppNavigator/AuthScreens.js b/src/libs/Navigation/AppNavigator/AuthScreens.js index bb3bb7076b51..26282cebc398 100644 --- a/src/libs/Navigation/AppNavigator/AuthScreens.js +++ b/src/libs/Navigation/AppNavigator/AuthScreens.js @@ -105,6 +105,16 @@ const propTypes = { /** The last Onyx update ID was applied to the client */ lastUpdateIDAppliedToClient: PropTypes.number, + /** Information about any currently running demos */ + demoInfo: PropTypes.shape({ + saastr: PropTypes.shape({ + isBeginningDemo: PropTypes.bool, + }), + sbe: PropTypes.shape({ + isBeginningDemo: PropTypes.bool, + }), + }), + ...windowDimensionsPropTypes, }; @@ -115,6 +125,7 @@ const defaultProps = { }, lastOpenedPublicRoomID: null, lastUpdateIDAppliedToClient: null, + demoInfo: {}, }; class AuthScreens extends React.Component { @@ -151,6 +162,12 @@ class AuthScreens extends React.Component { App.setUpPoliciesAndNavigate(this.props.session, !this.props.isSmallScreenWidth); App.redirectThirdPartyDesktopSignIn(); + // Check if we should be running any demos immediately after signing in. + if (lodashGet(this.props.demoInfo, 'saastr.isBeginningDemo', false)) { + Navigation.navigate(ROUTES.SAASTR); + } else if (lodashGet(this.props.demoInfo, 'sbe.isBeginningDemo', false)) { + Navigation.navigate(ROUTES.SBE); + } if (this.props.lastOpenedPublicRoomID) { // Re-open the last opened public room if the user logged in from a public room link Report.openLastOpenedPublicRoom(this.props.lastOpenedPublicRoomID); @@ -316,5 +333,8 @@ export default compose( lastUpdateIDAppliedToClient: { key: ONYXKEYS.ONYX_UPDATES_LAST_UPDATE_ID_APPLIED_TO_CLIENT, }, + demoInfo: { + key: ONYXKEYS.DEMO_INFO, + }, }), )(AuthScreens); From 5d5b956dfba80629f17e95a3eeb753dc37ca5580 Mon Sep 17 00:00:00 2001 From: Alex Beaman Date: Fri, 1 Sep 2023 21:53:46 +0300 Subject: [PATCH 2/2] Update missing prop --- src/pages/signin/SignInPage.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/pages/signin/SignInPage.js b/src/pages/signin/SignInPage.js index 892c2e0faaed..75ee4de65a5c 100644 --- a/src/pages/signin/SignInPage.js +++ b/src/pages/signin/SignInPage.js @@ -55,6 +55,9 @@ const propTypes = { saastr: PropTypes.shape({ isBeginningDemo: PropTypes.bool, }), + sbe: PropTypes.shape({ + isBeginningDemo: PropTypes.bool, + }), }), };