From 7a1308abb5a09d2ab83b06e6b82e77dbd2902363 Mon Sep 17 00:00:00 2001 From: war-in Date: Thu, 5 Dec 2024 17:02:32 +0100 Subject: [PATCH] wip --- src/libs/HybridApp.ts | 14 ++++++++++++-- src/pages/settings/InitialSettingsPage.tsx | 10 +++++++--- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/src/libs/HybridApp.ts b/src/libs/HybridApp.ts index da4871c80083..257516ddef74 100644 --- a/src/libs/HybridApp.ts +++ b/src/libs/HybridApp.ts @@ -57,7 +57,13 @@ function shouldUseOldApp(tryNewDot?: TryNewDot) { } function handleChangeInHybridAppSignInFlow(hybridApp: OnyxEntry, tryNewDot: OnyxEntry) { - if (!NativeModules.HybridAppModule || !hybridApp?.useNewDotSignInPage) { + if (!NativeModules.HybridAppModule) { + return; + } + + if (!hybridApp?.useNewDotSignInPage) { + currentHybridApp = hybridApp; + currentTryNewDot = tryNewDot; return; } @@ -79,7 +85,11 @@ function handleChangeInHybridAppSignInFlow(hybridApp: OnyxEntry, tryN ); if (shouldUseOldApp(tryNewDot)) { - NativeModules.HybridAppModule.closeReactNativeApp(false, false); + Onyx.merge(ONYXKEYS.HYBRID_APP, { + useNewDotSignInPage: false, + }).then(() => { + NativeModules.HybridAppModule.closeReactNativeApp(false, false); + }); } } diff --git a/src/pages/settings/InitialSettingsPage.tsx b/src/pages/settings/InitialSettingsPage.tsx index e35518ef5ce7..85c85ecbaf2b 100755 --- a/src/pages/settings/InitialSettingsPage.tsx +++ b/src/pages/settings/InitialSettingsPage.tsx @@ -3,7 +3,7 @@ import React, {useCallback, useContext, useEffect, useLayoutEffect, useMemo, use // eslint-disable-next-line no-restricted-imports import type {GestureResponderEvent, ScrollView as RNScrollView, ScrollViewProps, StyleProp, ViewStyle} from 'react-native'; import {NativeModules, View} from 'react-native'; -import {useOnyx} from 'react-native-onyx'; +import Onyx, {useOnyx} from 'react-native-onyx'; import type {ValueOf} from 'type-fest'; import AccountSwitcher from '@components/AccountSwitcher'; import AccountSwitcherSkeletonView from '@components/AccountSwitcherSkeletonView'; @@ -239,8 +239,12 @@ function InitialSettingsPage({currentUserPersonalDetails}: InitialSettingsPagePr ...(NativeModules.HybridAppModule ? { action: () => { - NativeModules.HybridAppModule.closeReactNativeApp(false, true); - setInitialURL(undefined); + Onyx.merge(ONYXKEYS.HYBRID_APP, { + useNewDotSignInPage: false, + }).then(() => { + NativeModules.HybridAppModule.closeReactNativeApp(false, true); + setInitialURL(undefined); + }); }, } : {