diff --git a/lib/generated/intl/messages_en.dart b/lib/generated/intl/messages_en.dart index 5885176..abe846c 100644 --- a/lib/generated/intl/messages_en.dart +++ b/lib/generated/intl/messages_en.dart @@ -338,6 +338,7 @@ class MessageLookup extends MessageLookupByLibrary { "paymentMade": MessageLookupByLibrary.simpleMessage("Payment made"), "pink": MessageLookupByLibrary.simpleMessage("Pink"), "pl": MessageLookupByLibrary.simpleMessage("P/L"), + "playSound": MessageLookupByLibrary.simpleMessage("Play Sound"), "pleaseAuthenticateToSend": MessageLookupByLibrary.simpleMessage("Please authenticate to Send"), "pleaseAuthenticateToShowAccountSeed": diff --git a/lib/generated/intl/messages_es.dart b/lib/generated/intl/messages_es.dart index 66f62b0..709de43 100644 --- a/lib/generated/intl/messages_es.dart +++ b/lib/generated/intl/messages_es.dart @@ -343,6 +343,7 @@ class MessageLookup extends MessageLookupByLibrary { "paymentMade": MessageLookupByLibrary.simpleMessage("Pago enviado"), "pink": MessageLookupByLibrary.simpleMessage("Rosado"), "pl": MessageLookupByLibrary.simpleMessage("G/P"), + "playSound": MessageLookupByLibrary.simpleMessage("Sonido"), "pleaseAuthenticateToSend": MessageLookupByLibrary.simpleMessage( "Por favor autentíquese para enviar"), "pleaseAuthenticateToShowAccountSeed": diff --git a/lib/generated/intl/messages_fr.dart b/lib/generated/intl/messages_fr.dart index 98ba013..7f728d7 100644 --- a/lib/generated/intl/messages_fr.dart +++ b/lib/generated/intl/messages_fr.dart @@ -345,6 +345,7 @@ class MessageLookup extends MessageLookupByLibrary { "paymentMade": MessageLookupByLibrary.simpleMessage("Payment Envoyé"), "pink": MessageLookupByLibrary.simpleMessage("Rose"), "pl": MessageLookupByLibrary.simpleMessage("Profit/Perte"), + "playSound": MessageLookupByLibrary.simpleMessage("Effets Sonores"), "pleaseAuthenticateToSend": MessageLookupByLibrary.simpleMessage( "Veillez vous authentifier avant l\'envoi"), "pleaseAuthenticateToShowAccountSeed": diff --git a/lib/generated/l10n.dart b/lib/generated/l10n.dart index 3a8c3fa..90fc1a2 100644 --- a/lib/generated/l10n.dart +++ b/lib/generated/l10n.dart @@ -3161,6 +3161,16 @@ class S { args: [], ); } + + /// `Play Sound` + String get playSound { + return Intl.message( + 'Play Sound', + name: 'playSound', + desc: '', + args: [], + ); + } } class AppLocalizationDelegate extends LocalizationsDelegate { diff --git a/lib/l10n/intl_en.arb b/lib/l10n/intl_en.arb index 619e606..7539414 100644 --- a/lib/l10n/intl_en.arb +++ b/lib/l10n/intl_en.arb @@ -309,5 +309,6 @@ "scanTransparentAddresses": "Scan Transparent Addresses", "scanningAddresses": "Scanning addresses", "blockExplorer": "Block Explorer", - "tapQrCodeForSaplingAddress": "Tap QR Code for Sapling Address" + "tapQrCodeForSaplingAddress": "Tap QR Code for Sapling Address", + "playSound": "Play Sound" } diff --git a/lib/l10n/intl_es.arb b/lib/l10n/intl_es.arb index 596813a..c8d3b4b 100644 --- a/lib/l10n/intl_es.arb +++ b/lib/l10n/intl_es.arb @@ -307,5 +307,6 @@ "scanTransparentAddresses": "Scan Transparent Addresses", "scanningAddresses": "Scanning addresses", "blockExplorer": "Block Explorer", - "tapQrCodeForSaplingAddress": "Tap QR Code for Sapling Address" + "tapQrCodeForSaplingAddress": "Tap QR Code for Sapling Address", + "playSound": "Sonido" } diff --git a/lib/l10n/intl_fr.arb b/lib/l10n/intl_fr.arb index 3703068..88b63db 100644 --- a/lib/l10n/intl_fr.arb +++ b/lib/l10n/intl_fr.arb @@ -308,5 +308,6 @@ "scanTransparentAddresses": "Scan Transparent Addresses", "scanningAddresses": "Scanning addresses", "blockExplorer": "Block Explorer", - "tapQrCodeForSaplingAddress": "Tap QR Code for Sapling Address" + "tapQrCodeForSaplingAddress": "Tap QR Code for Sapling Address", + "playSound": "Effets Sonores" } diff --git a/lib/settings.dart b/lib/settings.dart index b2d99db..d35f9f0 100644 --- a/lib/settings.dart +++ b/lib/settings.dart @@ -304,6 +304,12 @@ class SettingsState extends State title: Text(s.antispamFilter), initialValue: settings.antispam, onSaved: _antispam), + if (!simpleMode) + FormBuilderCheckbox( + name: 'sound', + title: Text(s.playSound), + initialValue: settings.sound, + onSaved: _sound), if (!simpleMode && WarpApi.hasGPU()) FormBuilderCheckbox( name: 'gpu', @@ -406,6 +412,10 @@ class SettingsState extends State settings.setAntiSpam(v); } + _sound(v) { + settings.setSound(v); + } + _useGPU(v) { settings.setUseGPU(v); } diff --git a/lib/store.dart b/lib/store.dart index 0adb793..c23b1bf 100644 --- a/lib/store.dart +++ b/lib/store.dart @@ -196,6 +196,9 @@ abstract class _Settings with Store { @observable int minPrivacyLevel = 0; + @observable + bool sound = true; + String dbPasswd = ""; @action @@ -225,6 +228,7 @@ abstract class _Settings with Store { noteView = ViewStyle.values[(prefs.getInt('note_view') ?? 0)]; txView = ViewStyle.values[(prefs.getInt('tx_view') ?? 0)]; qrOffline = prefs.getBool('qr_offline') ?? true; + sound = prefs.getBool('sound') ?? true; primaryColorValue = prefs.getInt('primary') ?? Colors.blue.value; primaryVariantColorValue = @@ -308,6 +312,13 @@ abstract class _Settings with Store { prefs.setBool('antispam', v); } + @action + Future setSound(bool v) async { + final prefs = await SharedPreferences.getInstance(); + sound = v; + prefs.setBool('sound', v); + } + @action Future setUseMillis(bool v) async { final prefs = await SharedPreferences.getInstance(); diff --git a/lib/txplan.dart b/lib/txplan.dart index 26be81e..2c87d30 100644 --- a/lib/txplan.dart +++ b/lib/txplan.dart @@ -123,12 +123,14 @@ class TxPlanPage extends StatelessWidget { await WarpApi.signAndBroadcast(active.coin, active.id, plan); } showSnackBar(S.current.txId(txid)); - await player.play(AssetSource("success.mp3")); + if (settings.sound) + await player.play(AssetSource("success.mp3")); active.setDraftRecipient(null); active.update(); } on String catch (message) { showSnackBar(message, error: true); - await player.play(AssetSource("fail.mp3")); + if (settings.sound) + await player.play(AssetSource("fail.mp3")); } finally { active.setBanner(""); } diff --git a/pubspec.yaml b/pubspec.yaml index 1da32b9..4d8375b 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.4.0+434 +version: 1.4.0+435 environment: sdk: ">=2.12.0 <3.0.0"