mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-12-23 03:49:22 +00:00
add warning dialog when clicking card of coin incompatible with Tor
TODO fix spacing/style.
This commit is contained in:
parent
3218216caa
commit
1090f5caa2
1 changed files with 32 additions and 0 deletions
|
@ -30,6 +30,7 @@ import 'package:stackwallet/wallets/wallet/wallet.dart';
|
|||
import 'package:stackwallet/wallets/wallet/wallet_mixin_interfaces/cw_based_interface.dart';
|
||||
import 'package:stackwallet/widgets/conditional_parent.dart';
|
||||
import 'package:stackwallet/widgets/desktop/primary_button.dart';
|
||||
import 'package:stackwallet/widgets/desktop/secondary_button.dart';
|
||||
import 'package:stackwallet/widgets/dialogs/basic_dialog.dart';
|
||||
import 'package:stackwallet/widgets/rounded_white_container.dart';
|
||||
import 'package:stackwallet/widgets/wallet_info_row/wallet_info_row.dart';
|
||||
|
@ -94,6 +95,37 @@ class SimpleWalletCard extends ConsumerWidget {
|
|||
|
||||
final wallet = ref.read(pWallets).getWallet(walletId);
|
||||
|
||||
// If Tor enabled, show a warning if opening a wallet incompatible with Tor.
|
||||
if (ref.read(prefsChangeNotifierProvider).useTor) {
|
||||
if (!wallet.cryptoCurrency.torSupport) {
|
||||
final shouldContinue = await showDialog<bool>(
|
||||
context: context,
|
||||
builder: (context) => BasicDialog(
|
||||
title: "Warning! Tor not supported.",
|
||||
message: "Stacky is not compatible with Tor."
|
||||
"\n\nBy using it, you will leak your IP address. Are you sure you "
|
||||
"want to continue?",
|
||||
// A PrimaryButton widget:
|
||||
leftButton: PrimaryButton(
|
||||
label: "Cancel",
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop(false);
|
||||
},
|
||||
),
|
||||
rightButton: SecondaryButton(
|
||||
label: "Continue",
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop(true);
|
||||
},
|
||||
),
|
||||
)) ??
|
||||
false;
|
||||
if (!shouldContinue) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (context.mounted) {
|
||||
final Future<void> loadFuture;
|
||||
if (wallet is CwBasedInterface) {
|
||||
|
|
Loading…
Reference in a new issue