Proper warning about not yet supported QR code format, Wallet buttons style fix

This commit is contained in:
minibits-cash
2024-07-08 14:26:19 +02:00
parent 933480c68b
commit 463f3c8f83
4 changed files with 36 additions and 14 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "minibits_wallet",
"version": "0.1.8-beta.34",
"version": "0.1.8-beta.35",
"private": true,
"scripts": {
"android:clean": "cd android && ./gradlew clean",
+13 -3
View File
@@ -86,9 +86,9 @@ export const ScanScreen: FC<WalletStackScreenProps<'Scan'>> = function ScanScree
const {preferredUnit: unit} = userSettingsStore
switch (prevRouteName) {
case 'ReceiveOptions':
log.trace('ReceiveOptions')
try {
case 'TokenReceive':
log.trace('TokenReceive')
try {
const tokenResult = IncomingParser.findAndExtract(incoming, IncomingDataType.CASHU)
return IncomingParser.navigateWithIncomingData(tokenResult, navigation, unit)
@@ -113,6 +113,16 @@ export const ScanScreen: FC<WalletStackScreenProps<'Scan'>> = function ScanScree
}
}
// temp validation
if(incoming.startsWith('ur:bytes')) {
log.trace('[findAndExtract] Got animated QR', incoming)
e.params = incoming
e.message = 'Minibits does not yet support animated QR codes.'
handleError(e)
break
}
e.params = incoming
e.message = translate("scanReceiveExtractFail")
handleError(e)
+3 -3
View File
@@ -529,7 +529,7 @@ export const WalletScreen: FC<WalletScreenProps> = observer(
)}
onPress={toggleSendModal}
style={[{backgroundColor: mainButtonColor, borderWidth: 1, borderColor: screenBg}, $buttonTopup]}
preset='tertiary'
preset='secondary'
tx='payCommon.send'
/>
<Button
@@ -543,7 +543,7 @@ export const WalletScreen: FC<WalletScreenProps> = observer(
)}
onPress={gotoScan}
style={[{backgroundColor: mainButtonColor, borderWidth: 1, borderColor: screenBg}, $buttonScan]}
preset='tertiary'
preset='secondary'
/>
<Button
RightAccessory={() => (
@@ -556,7 +556,7 @@ export const WalletScreen: FC<WalletScreenProps> = observer(
onPress={toggleReceiveModal}
tx='payCommon.receive'
style={[{backgroundColor: mainButtonColor, borderWidth: 1, borderColor: screenBg}, $buttonPay]}
preset='tertiary'
preset='secondary'
/>
</View>
</View>
+19 -7
View File
@@ -65,7 +65,6 @@ const findAndExtract = function (
throw new AppError(Err.NOTFOUND_ERROR, 'Unknown expectedType', {expectedType})
}
}
const maybeToken = CashuUtils.findEncodedCashuToken(incomingData)
@@ -78,7 +77,6 @@ const findAndExtract = function (
}
}
const maybeInvoice = LightningUtils.findEncodedLightningInvoice(incomingData)
if(maybeInvoice) {
@@ -105,7 +103,6 @@ const findAndExtract = function (
}
}
const maybeLnurlAddress = LnurlUtils.findEncodedLnurlAddress(incomingData)
if(maybeLnurlAddress) {
@@ -121,12 +118,27 @@ const findAndExtract = function (
const maybeMintUrl = new URL(incomingData) // throws
log.trace('[findAndExtract] Got maybeMintUrl', incomingData)
if(incomingData.startsWith('http')) {
log.trace('[findAndExtract] Got maybeMintUrl', incomingData)
return {
type: IncomingDataType.MINT_URL,
encoded: incomingData
return {
type: IncomingDataType.MINT_URL,
encoded: incomingData
}
}
if(incomingData.startsWith('ur:bytes')) {
log.trace('[findAndExtract] Got animated QR', incomingData)
throw new AppError(Err.VALIDATION_ERROR, 'Minibits does not yet support animated QR codes.', {
caller: 'findAndExtract'
})
}
throw new AppError(Err.VALIDATION_ERROR, 'Unknown incoming data type.', {
caller: 'findAndExtract'
})
}