Skip to content

Commit

Permalink
Merge pull request Expensify#26512 from Expensify/beaman-reinstateDem…
Browse files Browse the repository at this point in the history
…oRouteOnSignin

Fix demo page auto-route on signin
  • Loading branch information
mountiny authored Sep 1, 2023
2 parents a6a0572 + 5d5b956 commit 7d9708a
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/libs/Navigation/AppNavigator/AuthScreens.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};

Expand All @@ -115,6 +125,7 @@ const defaultProps = {
},
lastOpenedPublicRoomID: null,
lastUpdateIDAppliedToClient: null,
demoInfo: {},
};

class AuthScreens extends React.Component {
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -316,5 +333,8 @@ export default compose(
lastUpdateIDAppliedToClient: {
key: ONYXKEYS.ONYX_UPDATES_LAST_UPDATE_ID_APPLIED_TO_CLIENT,
},
demoInfo: {
key: ONYXKEYS.DEMO_INFO,
},
}),
)(AuthScreens);
3 changes: 3 additions & 0 deletions src/pages/signin/SignInPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ const propTypes = {
saastr: PropTypes.shape({
isBeginningDemo: PropTypes.bool,
}),
sbe: PropTypes.shape({
isBeginningDemo: PropTypes.bool,
}),
}),
};

Expand Down

0 comments on commit 7d9708a

Please sign in to comment.