Skip to content

Commit 10065aa

Browse files
feat: add unsupported QR code format error with translations
1 parent 48b8687 commit 10065aa

30 files changed

Lines changed: 50 additions & 15 deletions

lib/features/send/presentation/bloc/send_cubit.dart

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,10 @@ class SendCubit extends Cubit<SendState> {
236236
emit(
237237
state.copyWith(
238238
loadingBestWallet: false,
239-
invalidBitcoinStringException: InvalidBitcoinStringException(),
239+
invalidBitcoinStringException:
240+
state.scannedRawPaymentRequest.isNotEmpty
241+
? UnsupportedQrFormatException()
242+
: InvalidBitcoinStringException(),
240243
),
241244
);
242245
return;
@@ -260,7 +263,9 @@ class SendCubit extends Cubit<SendState> {
260263
emit(
261264
state.copyWith(
262265
loadingBestWallet: false,
263-
swapCreationException: AmountlessInvoiceException('Invoice has no amount'),
266+
swapCreationException: AmountlessInvoiceException(
267+
'Invoice has no amount',
268+
),
264269
),
265270
);
266271
return;
@@ -911,9 +916,7 @@ class SendCubit extends Cubit<SendState> {
911916

912917
if (state.blocksSwapDueToBitcoinHardwareWallet) {
913918
emit(
914-
state.copyWith(
915-
swapCreationException: HardwareWalletSwapException(),
916-
),
919+
state.copyWith(swapCreationException: HardwareWalletSwapException()),
917920
);
918921
return;
919922
}
@@ -1778,10 +1781,7 @@ class SendCubit extends Cubit<SendState> {
17781781
/// `manual: true` locks the pick so [updateBestWallet]'s auto-switching
17791782
/// (used as the user types an amount) doesn't override the user's choice —
17801783
/// the silent override regressed cold-wallet sends. See #1918.
1781-
Future<void> _setSelectedWallet(
1782-
Wallet wallet, {
1783-
required bool manual,
1784-
}) async {
1784+
Future<void> _setSelectedWallet(Wallet wallet, {required bool manual}) async {
17851785
emit(
17861786
state.copyWith(
17871787
selectedWallet: wallet,

lib/features/send/presentation/bloc/send_state.dart

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,8 @@ class AmountlessInvoiceException extends SwapCreationException {
472472
}
473473

474474
class HardwareWalletSwapException extends SwapCreationException {
475-
HardwareWalletSwapException() : super('Hardware wallets cannot be used for swaps');
475+
HardwareWalletSwapException()
476+
: super('Hardware wallets cannot be used for swaps');
476477
}
477478

478479
class ExpiredInvoiceException extends SwapCreationException {
@@ -491,6 +492,8 @@ class InvalidBitcoinStringException extends BullException {
491492
]);
492493
}
493494

495+
class UnsupportedQrFormatException extends InvalidBitcoinStringException {}
496+
494497
/// Exception for swap limit violations.
495498
/// Stored in SendState with min/max limit values for localized error messages.
496499
/// UI displays context-specific messages using sendErrorAmountBelowMinimum,

lib/features/send/ui/screens/send_screen.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,9 @@ class AddressErrorSection extends StatelessWidget {
261261
}
262262
if (invalidAddress != null) {
263263
return BBText(
264-
context.loc.sendErrorInvalidAddressOrInvoice,
264+
invalidAddress is UnsupportedQrFormatException
265+
? context.loc.sendErrorUnsupportedQrCodeFormat
266+
: context.loc.sendErrorInvalidAddressOrInvoice,
265267
style: context.font.bodyMedium,
266268
color: context.appColors.error,
267269
textAlign: .center,

localization/app_ar.arb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2345,6 +2345,7 @@
23452345
"@sendErrorInvalidAddressOrInvoice": {
23462346
"description": "Error when payment request is invalid"
23472347
},
2348+
"sendErrorUnsupportedQrCodeFormat": "تنسيق رمز QR غير مدعوم",
23482349
"transactionLabelAmountReceived": "المبلغ المستلم",
23492350
"@transactionLabelAmountReceived": {
23502351
"description": "Label for received amount"

localization/app_as.arb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4165,6 +4165,7 @@
41654165
"@sendErrorInvalidAddressOrInvoice": {
41664166
"description": "Error when payment request is invalid"
41674167
},
4168+
"sendErrorUnsupportedQrCodeFormat": "অসমৰ্থিত QR ক'ড ফৰ্মেট",
41684169
"sendErrorBuildFailed": "নিৰ্মাণ বিফল হৈছে",
41694170
"@sendErrorBuildFailed": {
41704171
"description": "Error title when transaction build fails"

localization/app_bg.arb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2125,6 +2125,7 @@
21252125
"@sendErrorInvalidAddressOrInvoice": {
21262126
"description": "Error when payment request is invalid"
21272127
},
2128+
"sendErrorUnsupportedQrCodeFormat": "Неподдържан формат на QR код",
21282129
"transactionLabelAmountReceived": "Получена сума",
21292130
"@transactionLabelAmountReceived": {
21302131
"description": "Label for received amount"

localization/app_bn.arb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2460,6 +2460,7 @@
24602460
"@sendErrorInvalidAddressOrInvoice": {
24612461
"description": "Error when payment request is invalid"
24622462
},
2463+
"sendErrorUnsupportedQrCodeFormat": "অসমর্থিত QR কোড ফরম্যাট",
24632464
"transactionLabelAmountReceived": "প্রাপ্ত পরিমাণ",
24642465
"@transactionLabelAmountReceived": {
24652466
"description": "Label for received amount"

localization/app_cs.arb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2691,6 +2691,7 @@
26912691
"@sendErrorInvalidAddressOrInvoice": {
26922692
"description": "Error when payment request is invalid"
26932693
},
2694+
"sendErrorUnsupportedQrCodeFormat": "Nepodporovaný formát QR kódu",
26942695
"transactionLabelAmountReceived": "Množství přijaté",
26952696
"@transactionLabelAmountReceived": {
26962697
"description": "Label for received amount"

localization/app_de.arb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -828,6 +828,7 @@
828828
"torSettingsConnectionStatus": "Verbindungsstatus",
829829
"backupInstruction1": "Wenn Sie Ihre 12 Wörter (Seed-Phrase) verlieren, können Sie den Zugriff auf die Bitcoin-Wallet nicht wiederherstellen.",
830830
"sendErrorInvalidAddressOrInvoice": "Ungültige Bitcoin-Adresse oder Rechnung.",
831+
"sendErrorUnsupportedQrCodeFormat": "Nicht unterstütztes QR-Code-Format",
831832
"transactionLabelAmountReceived": "Erhaltener Betrag",
832833
"recoverbullRecoveryTitle": "Recoverbull-Tresor-Wiederherstellung",
833834
"broadcastSignedTxScanQR": "Scannen Sie den QR-Code von Ihrer Hardware-Wallet.",

localization/app_el.arb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2088,6 +2088,7 @@
20882088
"@sendErrorInvalidAddressOrInvoice": {
20892089
"description": "Error when payment request is invalid"
20902090
},
2091+
"sendErrorUnsupportedQrCodeFormat": "Μη υποστηριζόμενη μορφή κωδικού QR",
20912092
"transactionLabelAmountReceived": "Ποσό που λαμβάνεται",
20922093
"@transactionLabelAmountReceived": {
20932094
"description": "Label for received amount"

0 commit comments

Comments
 (0)