mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2025-02-22 23:08:07 +01:00
FIX: crash when editing multisig cosigners and providing malformed data
This commit is contained in:
parent
0f8a74ba8a
commit
67f58b7992
2 changed files with 10 additions and 24 deletions
|
@ -9,10 +9,11 @@ import { check, request, PERMISSIONS, RESULTS } from 'react-native-permissions';
|
|||
* @param currentScreenName {string}
|
||||
* @param showFileImportButton {boolean}
|
||||
*
|
||||
* @param onDismiss {function} - if camera is closed via X button it gets triggered
|
||||
* @return {Promise<string>}
|
||||
*/
|
||||
function scanQrHelper(
|
||||
navigateFunc: (scr: string, params?: any) => void,
|
||||
navigateFunc: (scr: string | any, params?: any) => void,
|
||||
currentScreenName: string,
|
||||
showFileImportButton = true,
|
||||
onDismiss?: () => void,
|
||||
|
@ -28,14 +29,15 @@ function scanQrHelper(
|
|||
params.onBarScanned = function (data: any) {
|
||||
setTimeout(() => resolve(data.data || data), 1);
|
||||
navigateFunc(currentScreenName);
|
||||
navigateFunc({ name: currentScreenName, params: {}, merge: true });
|
||||
};
|
||||
|
||||
navigateFunc('ScanQRCodeRoot', {
|
||||
screen: 'ScanQRCode',
|
||||
params,
|
||||
});
|
||||
})}
|
||||
);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
const isCameraAuthorizationStatusGranted = async () => {
|
||||
|
|
|
@ -42,7 +42,7 @@ import { SquareButton } from '../../components/SquareButton';
|
|||
import { encodeUR } from '../../blue_modules/ur';
|
||||
import QRCodeComponent from '../../components/QRCodeComponent';
|
||||
import alert from '../../components/Alert';
|
||||
import { requestCameraAuthorization } from '../../helpers/scan-qr';
|
||||
import { scanQrHelper } from '../../helpers/scan-qr';
|
||||
import { useTheme } from '../../components/themes';
|
||||
import Button from '../../components/Button';
|
||||
const fs = require('../../blue_modules/fs');
|
||||
|
@ -436,27 +436,11 @@ const ViewEditMultisigCosigners = () => {
|
|||
});
|
||||
};
|
||||
|
||||
const scanOrOpenFile = () => {
|
||||
const scanOrOpenFile = async () => {
|
||||
setIsProvideMnemonicsModalVisible(false);
|
||||
setTimeout(
|
||||
() =>
|
||||
requestCameraAuthorization().then(() => {
|
||||
NavigationService.navigate('ScanQRCodeRoot', {
|
||||
screen: 'ScanQRCode',
|
||||
params: {
|
||||
launchedBy: route.name,
|
||||
onBarScanned: result => {
|
||||
// Triggers FlatList re-render
|
||||
setImportText(result);
|
||||
//
|
||||
_handleUseMnemonicPhrase(result);
|
||||
},
|
||||
showFileImportButton: true,
|
||||
},
|
||||
});
|
||||
}),
|
||||
650,
|
||||
);
|
||||
const scanned = await scanQrHelper(NavigationService.navigate, route.name, true);
|
||||
setImportText(String(scanned));
|
||||
setIsProvideMnemonicsModalVisible(true);
|
||||
};
|
||||
|
||||
const hideProvideMnemonicsModal = () => {
|
||||
|
|
Loading…
Add table
Reference in a new issue