From 9ac00e2ed0a1f8f8e7d0d0954ae7d495089ead65 Mon Sep 17 00:00:00 2001 From: sneurlax Date: Tue, 2 Jul 2024 23:08:37 -0500 Subject: [PATCH] add reuseAddress pref --- lib/utilities/prefs.dart | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/lib/utilities/prefs.dart b/lib/utilities/prefs.dart index 78a461ec7..585bdc1fc 100644 --- a/lib/utilities/prefs.dart +++ b/lib/utilities/prefs.dart @@ -1131,4 +1131,30 @@ class Prefs extends ChangeNotifier { ) as bool? ?? false; } + + // Reuse addresses (ie., don't generate new addresses by default). + + bool _reuseAddress = false; + + bool get reuseAddress => _reuseAddress; + + set reuseAddress(bool reuseAddress) { + if (_reuseAddress != reuseAddress) { + DB.instance.put( + boxName: DB.boxNamePrefs, + key: "reuseAddress", + value: reuseAddress, + ); + _reuseAddress = reuseAddress; + notifyListeners(); + } + } + + Future _getReuseAddress() async { + return await DB.instance.get( + boxName: DB.boxNamePrefs, + key: "reuseAddress", + ) as bool? ?? + true; + } }