Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/model/available_currency.dart
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ class AvailableCurrency extends SettingSelectionItem {
static AvailableCurrency getBestForLocale(Locale locale) {
AvailableCurrencyEnum.values.forEach((value) {
AvailableCurrency currency = AvailableCurrency(value);
if (locale != null && locale.countryCode == null) {
if (locale != null && locale.countryCode != null) {
// Special cases
if (['AT', 'BE', 'CY', 'EE', 'FI', 'FR', 'DE', 'GR', 'IE', 'IT', 'LV', 'LT', 'LU', 'MT', 'NL', 'PT', 'SK', 'SI', 'ES'].contains(locale.countryCode)) {
return AvailableCurrency(AvailableCurrencyEnum.EUR);
Expand Down
25 changes: 19 additions & 6 deletions lib/ui/intro/intro_import_seed.dart
Original file line number Diff line number Diff line change
Expand Up @@ -171,15 +171,16 @@ class _IntroImportSeedState extends State<IntroImportSeedPage> {
autocorrect: false,
prefixButton: TextFieldButton(
icon: AppIcons.scan,
onPressed: () {
onPressed: () async {
if (NanoSeeds.isValidSeed(
_seedInputController
.text)) {
return;
}
// Scan QR for seed
UIUtil.cancelLockEvent();
BarcodeScanner.scan(StateContainer.of(context).curTheme.qrScanTheme).then((result) {
try {
String result = await BarcodeScanner.scan(StateContainer.of(context).curTheme.qrScanTheme);
if (result != null && NanoSeeds.isValidSeed(result)) {
_seedInputController.text = result;
setState(() {
Expand All @@ -197,7 +198,11 @@ class _IntroImportSeedState extends State<IntroImportSeedPage> {
} else {
UIUtil.showSnackbar(AppLocalization.of(context).qrInvalidSeed, context);
}
});
} on PlatformException catch(e){
if (e.code == BarcodeScanner.CameraAccessDenied) {
UIUtil.showSnackbar(AppLocalization.of(context).qrInvalidPermissions, context);
}
}
},
),
fadePrefixOnCondition: true,
Expand Down Expand Up @@ -273,14 +278,17 @@ class _IntroImportSeedState extends State<IntroImportSeedPage> {
autocorrect: false,
prefixButton: TextFieldButton(
icon: AppIcons.scan,
onPressed: () {
onPressed: () async {
if (NanoMnemomics.validateMnemonic(
_mnemonicController.text.split(' '))) {
return;
}
// Scan QR for mnemonic
UIUtil.cancelLockEvent();
BarcodeScanner.scan(StateContainer.of(context).curTheme.qrScanTheme).then((result) {
try {
String result = await BarcodeScanner.scan(StateContainer.of(context).curTheme.qrScanTheme);

// BarcodeScanner.scan(StateContainer.of(context).curTheme.qrScanTheme).then((result) {
if (result != null && NanoMnemomics.validateMnemonic(result.split(' '))) {
_mnemonicController.text = result;
setState(() {
Expand All @@ -298,7 +306,12 @@ class _IntroImportSeedState extends State<IntroImportSeedPage> {
} else {
UIUtil.showSnackbar(AppLocalization.of(context).qrMnemonicError, context);
}
});
// });
} on PlatformException catch(e) {
if (e.code == BarcodeScanner.CameraAccessDenied) {
UIUtil.showSnackbar(AppLocalization.of(context).qrInvalidPermissions, context);
}
}
},
),
fadePrefixOnCondition: true,
Expand Down