From 9434684718032f0301399328fcd2ff02fea7290f Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Thu, 20 Jun 2024 11:34:53 +0800 Subject: [PATCH 1/2] fix: user can skipped onboarding process --- src/Expensify.tsx | 5 +---- src/libs/actions/Report.ts | 4 ++-- src/libs/actions/Welcome.ts | 1 - 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/Expensify.tsx b/src/Expensify.tsx index 458f1e3c5d249..d1927c86a057b 100644 --- a/src/Expensify.tsx +++ b/src/Expensify.tsx @@ -109,9 +109,6 @@ function Expensify({ const isAuthenticated = useMemo(() => !!(session?.authToken ?? null), [session]); const autoAuthState = useMemo(() => session?.autoAuthState ?? '', [session]); - const isAuthenticatedRef = useRef(false); - isAuthenticatedRef.current = isAuthenticated; - const contextValue = useMemo( () => ({ isSplashHidden, @@ -199,7 +196,7 @@ function Expensify({ // Open chat report from a deep link (only mobile native) Linking.addEventListener('url', (state) => { // We need to pass 'isAuthenticated' to avoid loading a non-existing profile page twice - Report.openReportFromDeepLink(state.url, !isAuthenticatedRef.current); + Report.openReportFromDeepLink(state.url); }); return () => { diff --git a/src/libs/actions/Report.ts b/src/libs/actions/Report.ts index b261bb0ade903..dda75f97318b4 100644 --- a/src/libs/actions/Report.ts +++ b/src/libs/actions/Report.ts @@ -2491,7 +2491,7 @@ function toggleEmojiReaction( addEmojiReaction(originalReportID, reportAction.reportActionID, emoji, skinTone); } -function openReportFromDeepLink(url: string, shouldNavigate = true) { +function openReportFromDeepLink(url: string) { const reportID = ReportUtils.getReportIDFromLink(url); const isAuthenticated = Session.hasAuthToken(); @@ -2535,7 +2535,7 @@ function openReportFromDeepLink(url: string, shouldNavigate = true) { return; } - if (!shouldNavigate) { + if (isAuthenticated) { return; } diff --git a/src/libs/actions/Welcome.ts b/src/libs/actions/Welcome.ts index 3f70dc0d962d4..2b25829a5c33e 100644 --- a/src/libs/actions/Welcome.ts +++ b/src/libs/actions/Welcome.ts @@ -78,7 +78,6 @@ function setOnboardingPolicyID(policyID?: string) { Onyx.connect({ key: ONYXKEYS.NVP_ONBOARDING, - initWithStoredValues: false, callback: (value) => { if (value === undefined) { return; From 7de4c88a9001960f8d48f84c5c4a0391e5a3a7a8 Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Sat, 22 Jun 2024 11:31:12 +0800 Subject: [PATCH 2/2] remove unnecessary comment --- src/Expensify.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Expensify.tsx b/src/Expensify.tsx index d1927c86a057b..d9287da5aae77 100644 --- a/src/Expensify.tsx +++ b/src/Expensify.tsx @@ -195,7 +195,6 @@ function Expensify({ // Open chat report from a deep link (only mobile native) Linking.addEventListener('url', (state) => { - // We need to pass 'isAuthenticated' to avoid loading a non-existing profile page twice Report.openReportFromDeepLink(state.url); });