diff --git a/stores/SettingsStore.ts b/stores/SettingsStore.ts index e66d23ba9..8b1cdbfec 100644 --- a/stores/SettingsStore.ts +++ b/stores/SettingsStore.ts @@ -1210,6 +1210,7 @@ export default class SettingsStore { selectNodeOnStartup: false }; @observable public posStatus: string = 'unselected'; + @observable public posWasEnabled: boolean = false; @observable public loading = false; @observable btcPayError: string | null; @observable sponsorsError: string | null; @@ -1225,6 +1226,7 @@ export default class SettingsStore { @observable implementation: Implementations; @observable certVerification: boolean | undefined; @observable public loggedIn = false; + @observable public comingFromLockscreen: boolean = false; @observable public connecting = true; @observable public lurkerExposed = false; // LNDHub @@ -1661,6 +1663,13 @@ export default class SettingsStore { ...newSetting }; + if ( + newSetting.pos?.posEnabled && + newSetting.pos.posEnabled !== PosEnabled.Disabled + ) { + this.posWasEnabled = true; + } + await this.setSettings(JSON.stringify(newSettings)); // ensure we get the enhanced settings set const settings = await this.getSettings(true); diff --git a/views/Lockscreen.tsx b/views/Lockscreen.tsx index 333b8c861..24b14db47 100644 --- a/views/Lockscreen.tsx +++ b/views/Lockscreen.tsx @@ -249,8 +249,14 @@ export default class Lockscreen extends React.Component< } else if (deleteDuressPin) { this.deleteDuressPin(); } else { - setPosStatus('inactive'); + if ( + (SettingsStore.settings?.pos?.posEnabled || + PosEnabled.Disabled) !== PosEnabled.Disabled + ) { + setPosStatus('inactive'); + } this.resetAuthenticationAttempts(); + SettingsStore.comingFromLockscreen = true; this.proceed(); } } else if ( diff --git a/views/Wallet/Wallet.tsx b/views/Wallet/Wallet.tsx index 91659bceb..5788dfdff 100644 --- a/views/Wallet/Wallet.tsx +++ b/views/Wallet/Wallet.tsx @@ -201,7 +201,18 @@ export default class Wallet extends React.Component { 'hardwareBackPress', this.handleBackButton.bind(this) ); - this.getSettingsAndNavigate(); + + const { SettingsStore } = this.props; + + if ( + this.state.initialLoad || + SettingsStore.posWasEnabled || + SettingsStore.comingFromLockscreen + ) { + this.getSettingsAndNavigate(); + SettingsStore.posWasEnabled = false; + SettingsStore.comingFromLockscreen = false; + } }; private handleBlur = () => this.backPressSubscription?.remove(); @@ -235,8 +246,12 @@ export default class Wallet extends React.Component { loginBackground ) { SettingsStore.setLoginStatus(false); - } else if (nextAppState === 'active' && SettingsStore.loginRequired()) { - this.props.navigation.navigate('Lockscreen'); + } else if (nextAppState === 'active') { + if (SettingsStore.loginRequired()) { + this.props.navigation.navigate('Lockscreen'); + } else { + this.getSettingsAndNavigate(); + } } };