diff --git a/lib/account.dart b/lib/account.dart index c086c21..d91661e 100644 --- a/lib/account.dart +++ b/lib/account.dart @@ -166,9 +166,7 @@ class QRAddressState extends State { final shortAddress = centerTrim(address); final showTAddr = active.showTAddr; final hasTAddr = active.taddress.isNotEmpty; - final flat = settings.flat; final qrSize = getScreenSize(context) / 2.5; - final hide = settings.autoHide && flat; final coinDef = active.coinDef; return Column(children: [ @@ -181,7 +179,7 @@ class QRAddressState extends State { onTap: hasTAddr ? _onQRTap : null, onLongPress: _onUpdateTAddr, child: RotatedBox( - quarterTurns: hide ? 2 : 0, + quarterTurns: 0, child: QrImage( data: address, size: qrSize, @@ -313,7 +311,17 @@ class BalanceWidget extends StatelessWidget { final s = S.of(context); final theme = Theme.of(context); final flat = settings.flat; - final hide = settings.autoHide && flat; + final hide = () { + switch (settings.autoHide) { + case 0: + return false; + case 1: + return flat; + case 2: + return true; + } + return true; + }(); final showTAddr = active.showTAddr; final balance = showTAddr ? active.tbalance : active.balances.balance; final balanceColor = !showTAddr @@ -342,7 +350,7 @@ class BalanceWidget extends StatelessWidget { Text(' $balanceHi', style: balanceStyle), if (!hide) Text('${_getBalanceLo(balance)}'), ]), - if (hide) Text(s.tiltYourDeviceUpToRevealYourBalance), + if (hide && settings.autoHide == 1) Text(s.tiltYourDeviceUpToRevealYourBalance), if (!hide && fx != 0.0) Text("${decimalFormat(balanceFX, 2, symbol: settings.currency)}", style: theme.textTheme.titleLarge), diff --git a/lib/generated/intl/messages_en.dart b/lib/generated/intl/messages_en.dart index 3d99574..666f51c 100644 --- a/lib/generated/intl/messages_en.dart +++ b/lib/generated/intl/messages_en.dart @@ -110,6 +110,7 @@ class MessageLookup extends MessageLookupByLibrary { "advanced": MessageLookupByLibrary.simpleMessage("Advanced"), "advancedOptions": MessageLookupByLibrary.simpleMessage("Advanced Options"), + "always": MessageLookupByLibrary.simpleMessage("Always"), "amount": MessageLookupByLibrary.simpleMessage("Amount"), "amountInSettingscurrency": m0, "amountMustBeANumber": @@ -301,6 +302,7 @@ class MessageLookup extends MessageLookupByLibrary { "na": MessageLookupByLibrary.simpleMessage("N/A"), "name": MessageLookupByLibrary.simpleMessage("Name"), "nameIsEmpty": MessageLookupByLibrary.simpleMessage("Name is empty"), + "never": MessageLookupByLibrary.simpleMessage("Never"), "newAccount": MessageLookupByLibrary.simpleMessage("New Account"), "newLabel": MessageLookupByLibrary.simpleMessage("New"), "newPassword": MessageLookupByLibrary.simpleMessage("New Password"), diff --git a/lib/generated/intl/messages_es.dart b/lib/generated/intl/messages_es.dart index 105d0d1..1217aad 100644 --- a/lib/generated/intl/messages_es.dart +++ b/lib/generated/intl/messages_es.dart @@ -111,6 +111,7 @@ class MessageLookup extends MessageLookupByLibrary { "advanced": MessageLookupByLibrary.simpleMessage("Avanzado"), "advancedOptions": MessageLookupByLibrary.simpleMessage("Opciones Avanzadas"), + "always": MessageLookupByLibrary.simpleMessage("Always"), "amount": MessageLookupByLibrary.simpleMessage("Monto"), "amountInSettingscurrency": m0, "amountMustBeANumber": MessageLookupByLibrary.simpleMessage( @@ -306,6 +307,7 @@ class MessageLookup extends MessageLookupByLibrary { "na": MessageLookupByLibrary.simpleMessage("N/A"), "name": MessageLookupByLibrary.simpleMessage("Nombre"), "nameIsEmpty": MessageLookupByLibrary.simpleMessage("Nombre vacío"), + "never": MessageLookupByLibrary.simpleMessage("Never"), "newAccount": MessageLookupByLibrary.simpleMessage("Nueva cuenta"), "newLabel": MessageLookupByLibrary.simpleMessage("Nueva"), "newPassword": MessageLookupByLibrary.simpleMessage("New Password"), diff --git a/lib/generated/intl/messages_fr.dart b/lib/generated/intl/messages_fr.dart index 60fb86d..68d9904 100644 --- a/lib/generated/intl/messages_fr.dart +++ b/lib/generated/intl/messages_fr.dart @@ -111,6 +111,7 @@ class MessageLookup extends MessageLookupByLibrary { "advanced": MessageLookupByLibrary.simpleMessage("Avancé"), "advancedOptions": MessageLookupByLibrary.simpleMessage("Options avancées"), + "always": MessageLookupByLibrary.simpleMessage("Toujours"), "amount": MessageLookupByLibrary.simpleMessage("Montant"), "amountInSettingscurrency": m0, "amountMustBeANumber": MessageLookupByLibrary.simpleMessage( @@ -307,6 +308,7 @@ class MessageLookup extends MessageLookupByLibrary { "na": MessageLookupByLibrary.simpleMessage("N/D"), "name": MessageLookupByLibrary.simpleMessage("Nom"), "nameIsEmpty": MessageLookupByLibrary.simpleMessage("Le nom est vide"), + "never": MessageLookupByLibrary.simpleMessage("Jamais"), "newAccount": MessageLookupByLibrary.simpleMessage("Nouveau Compte"), "newLabel": MessageLookupByLibrary.simpleMessage("Nouveau"), "newPassword": diff --git a/lib/generated/l10n.dart b/lib/generated/l10n.dart index 7f301dd..094cfe4 100644 --- a/lib/generated/l10n.dart +++ b/lib/generated/l10n.dart @@ -3101,6 +3101,26 @@ class S { args: [], ); } + + /// `Never` + String get never { + return Intl.message( + 'Never', + name: 'never', + desc: '', + args: [], + ); + } + + /// `Always` + String get always { + return Intl.message( + 'Always', + name: 'always', + desc: '', + args: [], + ); + } } class AppLocalizationDelegate extends LocalizationsDelegate { diff --git a/lib/l10n/intl_en.arb b/lib/l10n/intl_en.arb index eb5c595..74c94ae 100644 --- a/lib/l10n/intl_en.arb +++ b/lib/l10n/intl_en.arb @@ -303,5 +303,7 @@ "newPasswordsDoNotMatch": "New passwords do not match", "databaseEncrypted": "Database Encrypted", "invalidPassword": "Invalid Password", - "databaseRestored": "Database Restored" + "databaseRestored": "Database Restored", + "never": "Never", + "always": "Always" } diff --git a/lib/l10n/intl_es.arb b/lib/l10n/intl_es.arb index 3b281dd..17f690c 100644 --- a/lib/l10n/intl_es.arb +++ b/lib/l10n/intl_es.arb @@ -301,5 +301,7 @@ "newPasswordsDoNotMatch": "New passwords do not match", "databaseEncrypted": "Database Encrypted. Please Restart the App.", "invalidPassword": "Invalid Password", - "databaseRestored": "Database Restored" + "databaseRestored": "Database Restored", + "never": "Never", + "always": "Always" } diff --git a/lib/l10n/intl_fr.arb b/lib/l10n/intl_fr.arb index 921596b..fb83208 100644 --- a/lib/l10n/intl_fr.arb +++ b/lib/l10n/intl_fr.arb @@ -302,5 +302,7 @@ "newPasswordsDoNotMatch": "Les nouveaux Mots de Passe ne correspondent pas", "databaseEncrypted": "BD encryptée", "invalidPassword": "Mot de Passe incorrect", - "databaseRestored": "BD Récupèrée" + "databaseRestored": "BD Récupèrée", + "never": "Jamais", + "always": "Toujours" } diff --git a/lib/settings.dart b/lib/settings.dart index cd5ea0f..a3b6630 100644 --- a/lib/settings.dart +++ b/lib/settings.dart @@ -206,11 +206,17 @@ class SettingsState extends State title: Text(s.retrieveTransactionDetails), initialValue: settings.getTx, onSaved: _onGetTx), - FormBuilderCheckbox( - name: 'auto_hide', - title: Text(s.autoHideBalance), - initialValue: settings.autoHide, - onSaved: _onAutoHide), + FormBuilderRadioGroup( + orientation: OptionsOrientation.horizontal, + name: 'auto_hide', + decoration: InputDecoration(labelText: s.autoHideBalance), + initialValue: settings.autoHide, + onSaved: _onAutoHide, + options: [ + FormBuilderFieldOption(child: Text(s.never), value: 0), + FormBuilderFieldOption(child: Text(s.auto), value: 1), + FormBuilderFieldOption(child: Text(s.always), value: 2), + ]), DropdownButtonFormField( decoration: InputDecoration(labelText: s.minPrivacy), @@ -347,8 +353,6 @@ class SettingsState extends State return r; } - - _onAutoHide(v) { settings.setAutoHide(v); } diff --git a/lib/store.dart b/lib/store.dart index 2b1af18..f386fd1 100644 --- a/lib/store.dart +++ b/lib/store.dart @@ -155,7 +155,7 @@ abstract class _Settings with Store { bool useUA = false; @observable - bool autoHide = true; + int autoHide = 1; @observable bool includeReplyTo = false; @@ -241,7 +241,8 @@ abstract class _Settings with Store { chartRange = prefs.getString('chart_range') ?? "1Y"; autoShieldThreshold = prefs.getDouble('autoshield_threshold') ?? 0.0; useUA = prefs.getBool('use_ua') ?? false; - autoHide = prefs.getBool('auto_hide') ?? true; + final autoHideOld = prefs.getBool('auto_hide') ?? true; + autoHide = prefs.getInt('auto_hide2') ?? (autoHideOld ? 1 : 0); protectSend = prefs.getBool('protect_send') ?? false; protectOpen = prefs.getBool('protect_open') ?? false; includeReplyTo = prefs.getBool('include_reply_to') ?? false; @@ -508,10 +509,10 @@ abstract class _Settings with Store { } @action - Future setAutoHide(bool v) async { + Future setAutoHide(int v) async { final prefs = await SharedPreferences.getInstance(); autoHide = v; - prefs.setBool('auto_hide', autoHide); + prefs.setInt('auto_hide2', autoHide); } @action diff --git a/pubspec.yaml b/pubspec.yaml index 372cbf4..aaa571f 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. # Read more about iOS versioning at # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html -version: 1.3.6+399 +version: 1.3.6+400 environment: sdk: ">=2.12.0 <3.0.0"