mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-12-22 19:49:22 +00:00
make tor warning appear everytime and proxy act like torOnly is enabled
This commit is contained in:
parent
ecdb49adea
commit
2cf257d194
2 changed files with 41 additions and 6 deletions
|
@ -1,6 +1,7 @@
|
|||
import 'package:cake_wallet/generated/i18n.dart';
|
||||
import 'package:cake_wallet/routes.dart';
|
||||
import 'package:cake_wallet/src/widgets/alert_with_one_action.dart';
|
||||
import 'package:cake_wallet/src/widgets/alert_with_two_actions.dart';
|
||||
import 'package:cake_wallet/utils/show_pop_up.dart';
|
||||
import 'package:cake_wallet/view_model/dashboard/dashboard_view_model.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
@ -44,9 +45,13 @@ class MainActions {
|
|||
return;
|
||||
}
|
||||
|
||||
if (viewModel.isTorEnabled && viewModel.settingsStore.shouldShowTorBuyWarning) {
|
||||
if (viewModel.isTorEnabled /*&& viewModel.settingsStore.shouldShowTorBuyWarning*/) {
|
||||
viewModel.settingsStore.shouldShowTorBuyWarning = false;
|
||||
await _showErrorDialog(context, S.of(context).warning, S.of(context).tor_enabled_warning);
|
||||
bool cont = await _showWarningDialog(
|
||||
context, S.of(context).warning, S.of(context).tor_enabled_warning);
|
||||
if (!cont) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
final defaultBuyProvider = viewModel.defaultBuyProvider;
|
||||
|
@ -105,9 +110,13 @@ class MainActions {
|
|||
return;
|
||||
}
|
||||
|
||||
if (viewModel.isTorEnabled && viewModel.settingsStore.shouldShowTorSellWarning) {
|
||||
if (viewModel.isTorEnabled /*&& viewModel.settingsStore.shouldShowTorSellWarning*/) {
|
||||
viewModel.settingsStore.shouldShowTorSellWarning = false;
|
||||
await _showErrorDialog(context, S.of(context).warning, S.of(context).tor_enabled_warning);
|
||||
bool cont = await _showWarningDialog(
|
||||
context, S.of(context).warning, S.of(context).tor_enabled_warning);
|
||||
if (!cont) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
final defaultSellProvider = viewModel.defaultSellProvider;
|
||||
|
@ -135,4 +144,22 @@ class MainActions {
|
|||
},
|
||||
);
|
||||
}
|
||||
|
||||
static Future<bool> _showWarningDialog(
|
||||
BuildContext context, String title, String errorMessage) async {
|
||||
bool? response = await showPopUp<bool>(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return AlertWithTwoActions(
|
||||
alertTitle: title,
|
||||
alertContent: errorMessage,
|
||||
rightButtonText: S.of(context).ok,
|
||||
actionRightButton: () => Navigator.of(context).pop(true),
|
||||
leftButtonText: S.of(context).cancel,
|
||||
actionLeftButton: () => Navigator.of(context).pop(false),
|
||||
);
|
||||
},
|
||||
);
|
||||
return response ?? false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -96,7 +96,11 @@ class ProxyWrapper {
|
|||
torEnabled = false;
|
||||
}
|
||||
|
||||
if (torEnabled && torConnectionStatus == TorConnectionStatus.connecting) {
|
||||
if (torEnabled) {
|
||||
torConnectionMode = TorConnectionMode.torOnly;
|
||||
}
|
||||
|
||||
if (torEnabled && torConnectionStatus == TorConnectionStatus.connecting) {
|
||||
throw Exception("Tor is still connecting");
|
||||
}
|
||||
|
||||
|
@ -168,7 +172,11 @@ class ProxyWrapper {
|
|||
torEnabled = false;
|
||||
}
|
||||
|
||||
if (torEnabled && torConnectionStatus == TorConnectionStatus.connecting) {
|
||||
if (torEnabled) {
|
||||
torConnectionMode = TorConnectionMode.torOnly;
|
||||
}
|
||||
|
||||
if (torEnabled && torConnectionStatus == TorConnectionStatus.connecting) {
|
||||
throw Exception("Tor is still connecting");
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue