Skip to content

Commit 85b08e7

Browse files
authored
Revert "Show migrated user welcome modal immediately and navigate to Home on dismiss"
1 parent 4cfb6a6 commit 85b08e7

3 files changed

Lines changed: 3 additions & 44 deletions

File tree

src/components/MigratedUserWelcomeModal.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,8 @@ import {openExternalLink} from '@libs/actions/Link';
1111
import {dismissProductTraining} from '@libs/actions/Welcome';
1212
import convertToLTR from '@libs/convertToLTR';
1313
import Log from '@libs/Log';
14-
import Navigation from '@libs/Navigation/Navigation';
15-
import {buildCannedSearchQuery} from '@libs/SearchQueryUtils';
1614
import variables from '@styles/variables';
1715
import CONST from '@src/CONST';
18-
import ROUTES from '@src/ROUTES';
1916
import type {FeatureListItem} from './FeatureList';
2017
import FeatureTrainingModal from './FeatureTrainingModal';
2118
import Icon from './Icon';
@@ -61,7 +58,6 @@ function MigratedUserWelcomeModal() {
6158
const onClose = () => {
6259
Log.hmmm('[MigratedUserWelcomeModal] onClose called, dismissing product training');
6360
dismissProductTraining(CONST.MIGRATED_USER_WELCOME_MODAL);
64-
Navigation.navigate(ROUTES.SEARCH_ROOT.getRoute({query: buildCannedSearchQuery({type: CONST.SEARCH.DATA_TYPES.EXPENSE_REPORT})}));
6561
};
6662

6763
const featureListContent = (

src/libs/Navigation/guards/MigratedUserWelcomeModalGuard.ts

Lines changed: 2 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -4,64 +4,29 @@ import {tryNewDotOnyxSelector} from '@selectors/Onboarding';
44
import Onyx from 'react-native-onyx';
55
import type {OnyxEntry} from 'react-native-onyx';
66
import Log from '@libs/Log';
7-
import Navigation from '@libs/Navigation/Navigation';
87
import isProductTrainingElementDismissed from '@libs/TooltipUtils';
98
import CONST from '@src/CONST';
109
import NAVIGATORS from '@src/NAVIGATORS';
1110
import ONYXKEYS from '@src/ONYXKEYS';
1211
import ROUTES from '@src/ROUTES';
1312
import SCREENS from '@src/SCREENS';
14-
import type {DismissedProductTraining, Session} from '@src/types/onyx';
13+
import type {DismissedProductTraining} from '@src/types/onyx';
1514
import type {GuardResult, NavigationGuard} from './types';
1615

1716
let hasBeenAddedToNudgeMigration = false;
1817
let dismissedProductTraining: OnyxEntry<DismissedProductTraining>;
19-
let session: OnyxEntry<Session>;
20-
let isLoadingApp = true;
2118

2219
let hasRedirectedToMigratedUserModal = false;
2320

2421
function resetSessionFlag() {
2522
hasRedirectedToMigratedUserModal = false;
2623
}
2724

28-
/**
29-
* Proactively navigate to the migrated user welcome modal when all conditions are met,
30-
* without waiting for a user-initiated navigation action.
31-
*/
32-
function navigateToMigratedUserWelcomeModalIfReady() {
33-
if (
34-
!session?.authToken ||
35-
isLoadingApp ||
36-
hasRedirectedToMigratedUserModal ||
37-
!hasBeenAddedToNudgeMigration ||
38-
isProductTrainingElementDismissed('migratedUserWelcomeModal', dismissedProductTraining)
39-
) {
40-
return;
41-
}
42-
43-
Log.info('[MigratedUserWelcomeModalGuard] Proactively navigating to migrated user welcome modal');
44-
hasRedirectedToMigratedUserModal = true;
45-
Navigation.navigate(ROUTES.MIGRATED_USER_WELCOME_MODAL.getRoute());
46-
}
47-
48-
/**
49-
* Called by guards/index.ts when session or loading app state changes.
50-
* Reuses the shared Onyx subscriptions from guards/index.ts to avoid duplicate connections
51-
* that cause extra renders in performance tests.
52-
*/
53-
function onSessionOrLoadingAppChanged(sessionValue: OnyxEntry<Session>, isLoadingAppValue: boolean) {
54-
session = sessionValue;
55-
isLoadingApp = isLoadingAppValue;
56-
navigateToMigratedUserWelcomeModalIfReady();
57-
}
58-
5925
Onyx.connectWithoutView({
6026
key: ONYXKEYS.NVP_TRY_NEW_DOT,
6127
callback: (value) => {
6228
const result = value ? tryNewDotOnyxSelector(value) : undefined;
6329
hasBeenAddedToNudgeMigration = result?.hasBeenAddedToNudgeMigration ?? false;
64-
navigateToMigratedUserWelcomeModalIfReady();
6530
},
6631
});
6732

@@ -133,4 +98,4 @@ const MigratedUserWelcomeModalGuard: NavigationGuard = {
13398
};
13499

135100
export default MigratedUserWelcomeModalGuard;
136-
export {resetSessionFlag, onSessionOrLoadingAppChanged};
101+
export {resetSessionFlag};

src/libs/Navigation/guards/index.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import type {OnyxEntry} from 'react-native-onyx';
44
import getCurrentUrl from '@libs/Navigation/currentUrl';
55
import ONYXKEYS from '@src/ONYXKEYS';
66
import type {Session} from '@src/types/onyx';
7-
import MigratedUserWelcomeModalGuard, {onSessionOrLoadingAppChanged} from './MigratedUserWelcomeModalGuard';
7+
import MigratedUserWelcomeModalGuard from './MigratedUserWelcomeModalGuard';
88
import OnboardingGuard from './OnboardingGuard';
99
import type {GuardContext, GuardResult, NavigationGuard} from './types';
1010

@@ -19,15 +19,13 @@ Onyx.connectWithoutView({
1919
key: ONYXKEYS.SESSION,
2020
callback: (value) => {
2121
session = value;
22-
onSessionOrLoadingAppChanged(session, isLoadingApp);
2322
},
2423
});
2524

2625
Onyx.connectWithoutView({
2726
key: ONYXKEYS.IS_LOADING_APP,
2827
callback: (value) => {
2928
isLoadingApp = value ?? true;
30-
onSessionOrLoadingAppChanged(session, isLoadingApp);
3129
},
3230
});
3331

0 commit comments

Comments
 (0)