-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Redirect user to concierge when onboarding completed #42087
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
2edff29
efc236a
3dfb293
3aa75e9
06706c4
9fef64b
37aaff4
f2758fc
fd3dd47
bfeb14b
b97b952
7a4c242
e4a2d44
2dd159d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,17 +1,21 @@ | ||
| import {createStackNavigator} from '@react-navigation/stack'; | ||
| import React, {useCallback} from 'react'; | ||
| import React, {useCallback, useEffect} from 'react'; | ||
| import {View} from 'react-native'; | ||
| import {useOnyx} from 'react-native-onyx'; | ||
| import NoDropZone from '@components/DragAndDrop/NoDropZone'; | ||
| import useKeyboardShortcut from '@hooks/useKeyboardShortcut'; | ||
| import useOnboardingLayout from '@hooks/useOnboardingLayout'; | ||
| import useThemeStyles from '@hooks/useThemeStyles'; | ||
| import OnboardingModalNavigatorScreenOptions from '@libs/Navigation/AppNavigator/OnboardingModalNavigatorScreenOptions'; | ||
| import Navigation from '@libs/Navigation/Navigation'; | ||
| import type {OnboardingModalNavigatorParamList} from '@libs/Navigation/types'; | ||
| import OnboardingRefManager from '@libs/OnboardingRefManager'; | ||
| import OnboardingPersonalDetails from '@pages/OnboardingPersonalDetails'; | ||
| import OnboardingPurpose from '@pages/OnboardingPurpose'; | ||
| import OnboardingWork from '@pages/OnboardingWork'; | ||
| import * as Report from '@userActions/Report'; | ||
| import CONST from '@src/CONST'; | ||
| import ONYXKEYS from '@src/ONYXKEYS'; | ||
| import SCREENS from '@src/SCREENS'; | ||
| import Overlay from './Overlay'; | ||
|
|
||
|
|
@@ -20,6 +24,21 @@ const Stack = createStackNavigator<OnboardingModalNavigatorParamList>(); | |
| function OnboardingModalNavigator() { | ||
| const styles = useThemeStyles(); | ||
| const {shouldUseNarrowLayout} = useOnboardingLayout(); | ||
| const [hasCompletedGuidedSetupFlow] = useOnyx(ONYXKEYS.NVP_ONBOARDING, { | ||
| selector: (onboarding) => !Array.isArray(onboarding) && (onboarding?.hasCompletedGuidedSetupFlow ?? true), | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This line caused this issue: #43561
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You mean, empty array means
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, thats a mistake. When the hasCompleted property is not defined it means the onboarding was completed given its old user and we do not want to show them the flow in that case
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As far as I remember,
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm, it should not be an empty array for new users. That is the case only for users that had account in OldDot before |
||
| }); | ||
|
|
||
| useEffect(() => { | ||
| if (!hasCompletedGuidedSetupFlow) { | ||
| return; | ||
| } | ||
| Navigation.isNavigationReady().then(() => { | ||
| // Need to go back to previous route and then redirect to Concierge, | ||
| // otherwise going back on Concierge will go to onboarding and then redirected to Concierge again | ||
| Navigation.goBack(); | ||
| Report.navigateToConciergeChat(); | ||
| }); | ||
| }, [hasCompletedGuidedSetupFlow]); | ||
|
|
||
| const outerViewRef = React.useRef<View>(null); | ||
|
|
||
|
|
@@ -29,6 +48,9 @@ function OnboardingModalNavigator() { | |
|
|
||
| useKeyboardShortcut(CONST.KEYBOARD_SHORTCUTS.ESCAPE, handleOuterClick, {shouldBubble: true}); | ||
|
|
||
| if (hasCompletedGuidedSetupFlow) { | ||
| return null; | ||
| } | ||
| return ( | ||
| <NoDropZone> | ||
| <Overlay /> | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.