FIX: incorrect error handling when scanning invalid BC-UR data

This commit is contained in:
overtorment 2023-06-28 22:59:36 +01:00
parent 6c87d23d05
commit 9a26be1c80

View file

@ -156,16 +156,20 @@ const ScanQRCode = () => {
} catch (error) { } catch (error) {
console.warn(error); console.warn(error);
setIsLoading(true); setIsLoading(true);
Alert.alert(loc.send.scan_error, loc._.invalid_animated_qr_code_fragment, [ Alert.alert(
{ loc.send.scan_error,
text: loc._.ok, loc._.invalid_animated_qr_code_fragment,
onPress: () => { [
setIsLoading(false); {
text: loc._.ok,
onPress: () => {
setIsLoading(false);
},
style: 'default',
}, },
style: 'default', ],
},
{ cancelabe: false }, { cancelabe: false },
]); );
} }
}; };
@ -200,16 +204,20 @@ const ScanQRCode = () => {
} catch (error) { } catch (error) {
console.warn(error); console.warn(error);
setIsLoading(true); setIsLoading(true);
Alert.alert(loc.send.scan_error, loc._.invalid_animated_qr_code_fragment, [ Alert.alert(
{ loc.send.scan_error,
text: loc._.ok, loc._.invalid_animated_qr_code_fragment,
onPress: () => { [
setIsLoading(false); {
text: loc._.ok,
onPress: () => {
setIsLoading(false);
},
style: 'default',
}, },
style: 'default', ],
},
{ cancelabe: false }, { cancelabe: false },
]); );
} }
}; };
@ -229,6 +237,10 @@ const ScanQRCode = () => {
return _onReadUniformResourceV2(ret.data); return _onReadUniformResourceV2(ret.data);
} }
if (ret.data.toUpperCase().startsWith('UR:CRYPTO-OUTPUT')) {
return _onReadUniformResourceV2(ret.data);
}
if (ret.data.toUpperCase().startsWith('UR:BYTES')) { if (ret.data.toUpperCase().startsWith('UR:BYTES')) {
const splitted = ret.data.split('/'); const splitted = ret.data.split('/');
if (splitted.length === 3 && splitted[1].includes('-')) { if (splitted.length === 3 && splitted[1].includes('-')) {