mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2025-03-13 19:16:52 +01:00
Merge branch 'master' into psbt
This commit is contained in:
commit
59f2835cb8
2 changed files with 24 additions and 13 deletions
|
@ -258,7 +258,7 @@ class AmountInput extends Component {
|
|||
accessibilityRole="button"
|
||||
accessibilityLabel={loc._.enter_amount}
|
||||
disabled={this.props.pointerEvents === 'none'}
|
||||
onPress={() => this.textInput.focus()}
|
||||
onPress={() => this.textInput.current.focus()}
|
||||
>
|
||||
<>
|
||||
<View style={styles.root}>
|
||||
|
|
|
@ -7,7 +7,12 @@ import { requestCameraAuthorization } from '../helpers/scan-qr';
|
|||
import { useCallback, useMemo } from 'react';
|
||||
|
||||
// List of screens that require biometrics
|
||||
const requiresBiometrics = ['WalletExportRoot', 'WalletXpubRoot', 'ViewEditMultisigCosignersRoot', 'ExportMultisigCoordinationSetupRoot'];
|
||||
const requiresBiometrics = [
|
||||
'WalletExportRoot',
|
||||
'WalletXpubRoot',
|
||||
'ViewEditMultisigCosignersRoot',
|
||||
'ExportMultisigCoordinationSetupRoot',
|
||||
];
|
||||
|
||||
// List of screens that require wallet export to be saved
|
||||
const requiresWalletExportIsSaved = ['ReceiveDetailsRoot', 'WalletAddresses'];
|
||||
|
@ -44,6 +49,13 @@ export const useExtendedNavigation = <T extends NavigationProp<ParamListBase>>()
|
|||
};
|
||||
|
||||
(async () => {
|
||||
// NEW: If the current (active) screen is 'ScanQRCode', bypass all checks.
|
||||
const currentRouteName = navigationRef.current?.getCurrentRoute()?.name;
|
||||
if (currentRouteName === 'ScanQRCode') {
|
||||
proceedWithNavigation();
|
||||
return;
|
||||
}
|
||||
|
||||
if (isRequiresBiometrics) {
|
||||
const isBiometricsEnabled = await isBiometricUseEnabled();
|
||||
if (isBiometricsEnabled) {
|
||||
|
@ -53,8 +65,8 @@ export const useExtendedNavigation = <T extends NavigationProp<ParamListBase>>()
|
|||
return;
|
||||
} else {
|
||||
console.error('Biometric authentication failed');
|
||||
// Decide if navigation should proceed or not after failed authentication
|
||||
return; // Prevent proceeding with the original navigation if bio fails
|
||||
// Do not proceed if authentication fails.
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -78,18 +90,17 @@ export const useExtendedNavigation = <T extends NavigationProp<ParamListBase>>()
|
|||
await saveToDisk();
|
||||
proceedWithNavigation();
|
||||
} catch (error) {
|
||||
if (error) {
|
||||
originalNavigation.navigate('WalletExportRoot', {
|
||||
screen: 'WalletExport',
|
||||
params: { walletID },
|
||||
});
|
||||
}
|
||||
// If there was an error (or the user cancelled), navigate to the wallet export screen.
|
||||
originalNavigation.navigate('WalletExportRoot', {
|
||||
screen: 'WalletExport',
|
||||
params: { walletID },
|
||||
});
|
||||
}
|
||||
|
||||
return; // Prevent proceeding with the original navigation if the reminder is shown
|
||||
return; // Do not proceed with the original navigation if reminder was shown.
|
||||
}
|
||||
}
|
||||
|
||||
// If the target screen is ScanQRCode, request camera authorization.
|
||||
if (screenName === 'ScanQRCode') {
|
||||
await requestCameraAuthorization();
|
||||
}
|
||||
|
@ -115,4 +126,4 @@ export const useExtendedNavigation = <T extends NavigationProp<ParamListBase>>()
|
|||
|
||||
// Usage example:
|
||||
// type NavigationProps = NativeStackNavigationProp<SendDetailsStackParamList, 'SendDetails'>;
|
||||
// const navigation = useExtendedNavigation<NavigationProps>();
|
||||
// const navigation = useExtendedNavigation<NavigationProps>();
|
Loading…
Add table
Reference in a new issue