mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-11-17 17:57:40 +00:00
add FROST enabled pref
a bool toggle from hidden settings menu
This commit is contained in:
parent
85cdb0cc09
commit
5e7c9ad65b
2 changed files with 53 additions and 1 deletions
|
@ -10,6 +10,7 @@
|
|||
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
|
@ -215,7 +216,6 @@ class HiddenSettings extends StatelessWidget {
|
|||
),
|
||||
);
|
||||
}),
|
||||
|
||||
const SizedBox(
|
||||
height: 12,
|
||||
),
|
||||
|
@ -252,6 +252,36 @@ class HiddenSettings extends StatelessWidget {
|
|||
}
|
||||
},
|
||||
),
|
||||
Consumer(
|
||||
builder: (_, ref, __) {
|
||||
return GestureDetector(
|
||||
onTap: () async {
|
||||
ref
|
||||
.read(prefsChangeNotifierProvider)
|
||||
.frostEnabled =
|
||||
!(ref
|
||||
.read(prefsChangeNotifierProvider)
|
||||
.frostEnabled);
|
||||
if (kDebugMode) {
|
||||
print(
|
||||
"FROST enabled: ${ref.read(prefsChangeNotifierProvider).frostEnabled}");
|
||||
}
|
||||
},
|
||||
child: RoundedWhiteContainer(
|
||||
child: Text(
|
||||
"Toggle FROST multisig",
|
||||
style: STextStyles.button(context).copyWith(
|
||||
color: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.accentColorDark),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
const SizedBox(
|
||||
height: 12,
|
||||
),
|
||||
Consumer(
|
||||
builder: (_, ref, __) {
|
||||
return GestureDetector(
|
||||
|
|
|
@ -68,6 +68,7 @@ class Prefs extends ChangeNotifier {
|
|||
await _setMaxDecimals();
|
||||
_useTor = await _getUseTor();
|
||||
_fusionServerInfo = await _getFusionServerInfo();
|
||||
_frostEnabled = await _getFrostEnabled();
|
||||
|
||||
_initialized = true;
|
||||
}
|
||||
|
@ -1008,4 +1009,25 @@ class Prefs extends ChangeNotifier {
|
|||
|
||||
return actualMap;
|
||||
}
|
||||
|
||||
// FROST multisig
|
||||
|
||||
bool _frostEnabled = false;
|
||||
|
||||
bool get frostEnabled => _frostEnabled;
|
||||
|
||||
set frostEnabled(bool frostEnabled) {
|
||||
if (_frostEnabled != frostEnabled) {
|
||||
DB.instance.put<dynamic>(
|
||||
boxName: DB.boxNamePrefs, key: "frostEnabled", value: frostEnabled);
|
||||
_frostEnabled = frostEnabled;
|
||||
notifyListeners();
|
||||
}
|
||||
}
|
||||
|
||||
Future<bool> _getFrostEnabled() async {
|
||||
return await DB.instance.get<dynamic>(
|
||||
boxName: DB.boxNamePrefs, key: "frostEnabled") as bool? ??
|
||||
false;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue