Skip to content

Commit

Permalink
Put LoginWithPinOrBiometryScreen as overlay on WalletScreenStack (#1101)
Browse files Browse the repository at this point in the history
  • Loading branch information
neven-s authored Dec 11, 2023
1 parent 697b1e3 commit fb82081
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
3 changes: 1 addition & 2 deletions packages/core-mobile/app/navigation/AppNavigation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ enum Root {
Onboard = 'Root.Onboard',
RefreshToken = 'Root.RefreshToken',
CopyPhraseWarning = 'Root.CopyPhraseWarning',
ForgotPin = 'Root.ForgotPin',
Login = 'Root.Login'
ForgotPin = 'Root.ForgotPin'
}

enum OnboardScreens {
Expand Down
10 changes: 3 additions & 7 deletions packages/core-mobile/app/navigation/RootScreenStack.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@ export type RootScreenStackParamList = {
title: string
message: string
}
[AppNavigation.Root.Login]: undefined
}

const RootStack = createStackNavigator<RootScreenStackParamList>()

const WalletScreenStackWithContext: FC = () => {
const { onExit } = useApplicationContext().appHook
const { inBackground } = useBgDetect()
const walletState = useSelector(selectWalletState)

const doExit = useCallback(() => {
onExit((confirmExit, cancel) => {
Expand All @@ -75,6 +75,7 @@ const WalletScreenStackWithContext: FC = () => {
return (
<>
<WalletScreenStack onExit={doExit} />
{walletState === WalletState.INACTIVE && <LoginWithPinOrBiometryScreen />}

{/* This protects from leaking last screen in "recent apps" list. */}
{/* For Android it is additionally implemented natively in MainActivity.java because react-native */}
Expand All @@ -101,7 +102,7 @@ const RootScreenStack: FC = () => {
animationEnabled: false
}}
/>
) : walletState === WalletState.ACTIVE ? (
) : (
<RootStack.Screen
name={AppNavigation.Root.Wallet}
component={WalletScreenStackWithContext}
Expand All @@ -110,11 +111,6 @@ const RootScreenStack: FC = () => {
presentation: 'card'
}}
/>
) : (
<RootStack.Screen
name={AppNavigation.Root.Login}
component={LoginWithPinOrBiometryScreen}
/>
)}
<RootStack.Screen
name={AppNavigation.Root.RefreshToken}
Expand Down

0 comments on commit fb82081

Please sign in to comment.