Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
war-in committed Dec 5, 2024
1 parent f197b4b commit 7a1308a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
14 changes: 12 additions & 2 deletions src/libs/HybridApp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,13 @@ function shouldUseOldApp(tryNewDot?: TryNewDot) {
}

function handleChangeInHybridAppSignInFlow(hybridApp: OnyxEntry<HybridApp>, tryNewDot: OnyxEntry<TryNewDot>) {
if (!NativeModules.HybridAppModule || !hybridApp?.useNewDotSignInPage) {
if (!NativeModules.HybridAppModule) {
return;
}

if (!hybridApp?.useNewDotSignInPage) {
currentHybridApp = hybridApp;
currentTryNewDot = tryNewDot;
return;
}

Expand All @@ -79,7 +85,11 @@ function handleChangeInHybridAppSignInFlow(hybridApp: OnyxEntry<HybridApp>, tryN
);

if (shouldUseOldApp(tryNewDot)) {
NativeModules.HybridAppModule.closeReactNativeApp(false, false);
Onyx.merge(ONYXKEYS.HYBRID_APP, {
useNewDotSignInPage: false,
}).then(() => {
NativeModules.HybridAppModule.closeReactNativeApp(false, false);
});
}
}

Expand Down
10 changes: 7 additions & 3 deletions src/pages/settings/InitialSettingsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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);
});
},
}
: {
Expand Down

0 comments on commit 7a1308a

Please sign in to comment.