mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-02-02 03:06:29 +00:00
respect the coin control setting
This commit is contained in:
parent
8706a6350c
commit
a2f75a2c7b
2 changed files with 68 additions and 19 deletions
|
@ -319,8 +319,13 @@ class _SendViewState extends ConsumerState<SendView> {
|
|||
Format.decimalAmountToSatoshis(manager.balance.getSpendable(), coin);
|
||||
}
|
||||
|
||||
if (!manager.hasCoinControlSupport ||
|
||||
(manager.hasCoinControlSupport && selectedUTXOs.isEmpty)) {
|
||||
final coinControlEnabled =
|
||||
ref.read(prefsChangeNotifierProvider).enableCoinControl;
|
||||
|
||||
if (!(manager.hasCoinControlSupport && coinControlEnabled) ||
|
||||
(manager.hasCoinControlSupport &&
|
||||
coinControlEnabled &&
|
||||
selectedUTXOs.isEmpty)) {
|
||||
// confirm send all
|
||||
if (amount == availableBalance) {
|
||||
final bool? shouldSendAll = await showDialog<bool>(
|
||||
|
@ -404,7 +409,9 @@ class _SendViewState extends ConsumerState<SendView> {
|
|||
satoshiAmount: amount,
|
||||
args: {
|
||||
"feeRate": feeRate,
|
||||
"UTXOs": (manager.hasCoinControlSupport && selectedUTXOs.isNotEmpty)
|
||||
"UTXOs": (manager.hasCoinControlSupport &&
|
||||
coinControlEnabled &&
|
||||
selectedUTXOs.isNotEmpty)
|
||||
? selectedUTXOs
|
||||
: null,
|
||||
},
|
||||
|
@ -423,7 +430,9 @@ class _SendViewState extends ConsumerState<SendView> {
|
|||
satoshiAmount: amount,
|
||||
args: {
|
||||
"feeRate": ref.read(feeRateTypeStateProvider),
|
||||
"UTXOs": (manager.hasCoinControlSupport && selectedUTXOs.isNotEmpty)
|
||||
"UTXOs": (manager.hasCoinControlSupport &&
|
||||
coinControlEnabled &&
|
||||
selectedUTXOs.isNotEmpty)
|
||||
? selectedUTXOs
|
||||
: null,
|
||||
},
|
||||
|
@ -585,10 +594,15 @@ class _SendViewState extends ConsumerState<SendView> {
|
|||
localeServiceChangeNotifierProvider.select((value) => value.locale));
|
||||
|
||||
final showCoinControl = ref.watch(
|
||||
walletsChangeNotifierProvider.select(
|
||||
(value) => value.getManager(walletId).hasCoinControlSupport,
|
||||
),
|
||||
);
|
||||
walletsChangeNotifierProvider.select(
|
||||
(value) => value.getManager(walletId).hasCoinControlSupport,
|
||||
),
|
||||
) &&
|
||||
ref.watch(
|
||||
prefsChangeNotifierProvider.select(
|
||||
(value) => value.enableCoinControl,
|
||||
),
|
||||
);
|
||||
|
||||
if (coin == Coin.firo || coin == Coin.firoTestNet) {
|
||||
ref.listen(publicPrivateBalanceStateProvider, (previous, next) {
|
||||
|
|
|
@ -7,6 +7,7 @@ import 'package:stackwallet/pages/coin_control/coin_control_view.dart';
|
|||
import 'package:stackwallet/pages/paynym/paynym_claim_view.dart';
|
||||
import 'package:stackwallet/pages/paynym/paynym_home_view.dart';
|
||||
import 'package:stackwallet/providers/global/paynym_api_provider.dart';
|
||||
import 'package:stackwallet/providers/global/prefs_provider.dart';
|
||||
import 'package:stackwallet/providers/global/wallets_provider.dart';
|
||||
import 'package:stackwallet/providers/wallet/my_paynym_account_state_provider.dart';
|
||||
import 'package:stackwallet/services/mixins/paynym_wallet_interface.dart';
|
||||
|
@ -52,10 +53,22 @@ class _WalletNavigationBarState extends ConsumerState<WalletNavigationBar> {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final showMore = ref.watch(walletsChangeNotifierProvider.select(
|
||||
(value) => value.getManager(widget.walletId).hasPaynymSupport)) ||
|
||||
ref.watch(walletsChangeNotifierProvider.select((value) =>
|
||||
value.getManager(widget.walletId).hasCoinControlSupport));
|
||||
final showMore = ref.watch(
|
||||
walletsChangeNotifierProvider.select(
|
||||
(value) => value.getManager(widget.walletId).hasPaynymSupport,
|
||||
),
|
||||
) ||
|
||||
(ref.watch(
|
||||
walletsChangeNotifierProvider.select(
|
||||
(value) =>
|
||||
value.getManager(widget.walletId).hasCoinControlSupport,
|
||||
),
|
||||
) &&
|
||||
ref.watch(
|
||||
prefsChangeNotifierProvider.select(
|
||||
(value) => value.enableCoinControl,
|
||||
),
|
||||
));
|
||||
|
||||
return Column(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
|
@ -104,8 +117,18 @@ class _WalletNavigationBarState extends ConsumerState<WalletNavigationBar> {
|
|||
// const SizedBox(
|
||||
// height: 8,
|
||||
// ),
|
||||
if (ref.watch(walletsChangeNotifierProvider.select((value) =>
|
||||
value.getManager(widget.walletId).hasCoinControlSupport)))
|
||||
if (ref.watch(
|
||||
walletsChangeNotifierProvider.select(
|
||||
(value) => value
|
||||
.getManager(widget.walletId)
|
||||
.hasCoinControlSupport,
|
||||
),
|
||||
) &&
|
||||
ref.watch(
|
||||
prefsChangeNotifierProvider.select(
|
||||
(value) => value.enableCoinControl,
|
||||
),
|
||||
))
|
||||
AnimatedOpacity(
|
||||
opacity: scale,
|
||||
duration: duration,
|
||||
|
@ -164,12 +187,24 @@ class _WalletNavigationBarState extends ConsumerState<WalletNavigationBar> {
|
|||
),
|
||||
),
|
||||
),
|
||||
if (ref.watch(walletsChangeNotifierProvider.select((value) =>
|
||||
value
|
||||
if (ref.watch(
|
||||
walletsChangeNotifierProvider.select(
|
||||
(value) => value
|
||||
.getManager(widget.walletId)
|
||||
.hasCoinControlSupport)) &&
|
||||
ref.watch(walletsChangeNotifierProvider.select((value) =>
|
||||
value.getManager(widget.walletId).hasPaynymSupport)))
|
||||
.hasCoinControlSupport,
|
||||
),
|
||||
) &&
|
||||
ref.watch(
|
||||
prefsChangeNotifierProvider.select(
|
||||
(value) => value.enableCoinControl,
|
||||
),
|
||||
) &&
|
||||
ref.watch(
|
||||
walletsChangeNotifierProvider.select(
|
||||
(value) =>
|
||||
value.getManager(widget.walletId).hasPaynymSupport,
|
||||
),
|
||||
))
|
||||
const SizedBox(
|
||||
height: 8,
|
||||
),
|
||||
|
|
Loading…
Reference in a new issue