mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-12-22 19:49:22 +00:00
small review changes
This commit is contained in:
parent
a97b84ee82
commit
e737116402
6 changed files with 4 additions and 35 deletions
|
@ -219,7 +219,6 @@ class BackupService {
|
|||
final displayActionListMode = data[PreferencesKey.displayActionListModeKey] as int?;
|
||||
final fiatApiMode = data[PreferencesKey.currentFiatApiModeKey] as int?;
|
||||
final torConnectionMode = data[PreferencesKey.currentTorConnectionModeKey] as int?;
|
||||
final shouldStartTorOnLaunch = data[PreferencesKey.shouldStartTorOnLaunch] as bool?;
|
||||
final currentPinLength = data[PreferencesKey.currentPinLength] as int?;
|
||||
final currentTheme = data[PreferencesKey.currentTheme] as int?;
|
||||
final exchangeStatus = data[PreferencesKey.exchangeStatusKey] as int?;
|
||||
|
@ -295,10 +294,6 @@ class BackupService {
|
|||
if (torConnectionMode != null)
|
||||
await _sharedPreferences.setInt(PreferencesKey.currentTorConnectionModeKey, torConnectionMode);
|
||||
|
||||
if (shouldStartTorOnLaunch != null)
|
||||
await _sharedPreferences.setBool(
|
||||
PreferencesKey.shouldStartTorOnLaunch, shouldStartTorOnLaunch);
|
||||
|
||||
if (autoGenerateSubaddressStatus != null)
|
||||
await _sharedPreferences.setInt(
|
||||
PreferencesKey.autoGenerateSubaddressStatusKey, autoGenerateSubaddressStatus);
|
||||
|
@ -495,8 +490,6 @@ class BackupService {
|
|||
_sharedPreferences.getInt(PreferencesKey.currentFiatApiModeKey),
|
||||
PreferencesKey.currentTorConnectionModeKey:
|
||||
_sharedPreferences.getInt(PreferencesKey.currentTorConnectionModeKey),
|
||||
PreferencesKey.shouldStartTorOnLaunch:
|
||||
_sharedPreferences.getBool(PreferencesKey.shouldStartTorOnLaunch),
|
||||
PreferencesKey.sortBalanceBy: _sharedPreferences.getInt(PreferencesKey.sortBalanceBy),
|
||||
PreferencesKey.pinNativeTokenAtTop:
|
||||
_sharedPreferences.getBool(PreferencesKey.pinNativeTokenAtTop),
|
||||
|
|
|
@ -13,6 +13,7 @@ import 'package:cake_wallet/core/yat_service.dart';
|
|||
import 'package:cake_wallet/entities/background_tasks.dart';
|
||||
import 'package:cake_wallet/entities/exchange_api_mode.dart';
|
||||
import 'package:cake_wallet/entities/parse_address_from_domain.dart';
|
||||
import 'package:cake_wallet/view_model/settings/tor_connection.dart';
|
||||
import 'package:cw_core/receive_page_option.dart';
|
||||
import 'package:cake_wallet/ethereum/ethereum.dart';
|
||||
import 'package:cake_wallet/nano/nano.dart';
|
||||
|
@ -730,7 +731,9 @@ Future<void> setup({
|
|||
torViewModel: getIt.get<TorViewModel>(),
|
||||
));
|
||||
|
||||
if (DeviceInfo.instance.isMobile && settingsStore.shouldStartTorOnLaunch) {
|
||||
if (DeviceInfo.instance.isMobile &&
|
||||
(settingsStore.torConnectionMode == TorConnectionMode.enabled ||
|
||||
settingsStore.torConnectionMode == TorConnectionMode.torOnly)) {
|
||||
getIt.get<TorViewModel>().startTor();
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,6 @@ class PreferencesKey {
|
|||
static const walletListOrder = 'wallet_list_order';
|
||||
static const walletListAscending = 'wallet_list_ascending';
|
||||
static const currentFiatApiModeKey = 'current_fiat_api_mode';
|
||||
static const shouldStartTorOnLaunch = 'start_tor_on_launch';
|
||||
static const currentTorConnectionModeKey = 'current_tor_connection_mode';
|
||||
static const failedTotpTokenTrials = 'failed_token_trials';
|
||||
static const disableExchangeKey = 'disable_exchange';
|
||||
|
|
|
@ -64,7 +64,6 @@ abstract class SettingsStoreBase with Store {
|
|||
required bool initialWalletListAscending,
|
||||
required FiatApiMode initialFiatMode,
|
||||
required TorConnectionMode initialTorConnectionMode,
|
||||
required bool initialShouldStartTorOnLaunch,
|
||||
required bool initialAllowBiometricalAuthentication,
|
||||
required String initialTotpSecretKey,
|
||||
required bool initialUseTOTP2FA,
|
||||
|
@ -126,7 +125,6 @@ abstract class SettingsStoreBase with Store {
|
|||
moneroSeedType = initialMoneroSeedType,
|
||||
fiatApiMode = initialFiatMode,
|
||||
torConnectionMode = initialTorConnectionMode,
|
||||
shouldStartTorOnLaunch = initialShouldStartTorOnLaunch,
|
||||
allowBiometricalAuthentication = initialAllowBiometricalAuthentication,
|
||||
selectedCake2FAPreset = initialCake2FAPresetOptions,
|
||||
totpSecretKey = initialTotpSecretKey,
|
||||
|
@ -325,9 +323,6 @@ abstract class SettingsStoreBase with Store {
|
|||
await sharedPreferences.setInt(PreferencesKey.currentTorConnectionModeKey, mode.serialize());
|
||||
});
|
||||
|
||||
reaction((_) => shouldStartTorOnLaunch,
|
||||
(bool value) => sharedPreferences.setBool(PreferencesKey.shouldStartTorOnLaunch, value));
|
||||
|
||||
reaction((_) => currentTheme,
|
||||
(ThemeBase theme) => sharedPreferences.setInt(PreferencesKey.currentTheme, theme.raw));
|
||||
|
||||
|
@ -550,9 +545,6 @@ abstract class SettingsStoreBase with Store {
|
|||
@observable
|
||||
TorConnectionMode torConnectionMode;
|
||||
|
||||
@observable
|
||||
bool shouldStartTorOnLaunch;
|
||||
|
||||
@observable
|
||||
bool shouldSaveRecipientAddress;
|
||||
|
||||
|
@ -805,8 +797,6 @@ abstract class SettingsStoreBase with Store {
|
|||
final currentTorConnectionMode = TorConnectionMode.deserialize(
|
||||
raw: sharedPreferences.getInt(PreferencesKey.currentTorConnectionModeKey) ??
|
||||
TorConnectionMode.disabled.raw);
|
||||
final shouldStartTorOnLaunch =
|
||||
sharedPreferences.getBool(PreferencesKey.shouldStartTorOnLaunch) ?? false;
|
||||
final tokenTrialNumber = sharedPreferences.getInt(PreferencesKey.failedTotpTokenTrials) ?? 0;
|
||||
final shouldShowMarketPlaceInDashboard =
|
||||
sharedPreferences.getBool(PreferencesKey.shouldShowMarketPlaceInDashboard) ?? true;
|
||||
|
@ -1049,7 +1039,6 @@ abstract class SettingsStoreBase with Store {
|
|||
initialWalletListAscending: walletListAscending,
|
||||
initialFiatMode: currentFiatApiMode,
|
||||
initialTorConnectionMode: currentTorConnectionMode,
|
||||
initialShouldStartTorOnLaunch: shouldStartTorOnLaunch,
|
||||
initialAllowBiometricalAuthentication: allowBiometricalAuthentication,
|
||||
initialCake2FAPresetOptions: selectedCake2FAPreset,
|
||||
initialUseTOTP2FA: useTOTP2FA,
|
||||
|
|
|
@ -83,9 +83,6 @@ abstract class PrivacySettingsViewModelBase with Store {
|
|||
@computed
|
||||
bool get looksUpENS => _settingsStore.lookupsENS;
|
||||
|
||||
@computed
|
||||
bool get shouldStartTorOnLaunch => _settingsStore.shouldStartTorOnLaunch;
|
||||
|
||||
bool get canUseEtherscan => _wallet.type == WalletType.ethereum;
|
||||
|
||||
bool get canUsePolygonScan => _wallet.type == WalletType.polygon;
|
||||
|
@ -127,9 +124,6 @@ abstract class PrivacySettingsViewModelBase with Store {
|
|||
@action
|
||||
void setLookupsOpenAlias(bool value) => _settingsStore.lookupsOpenAlias = value;
|
||||
|
||||
@action
|
||||
void setShouldStartTorOnLaunch(bool value) => _settingsStore.shouldStartTorOnLaunch = value;
|
||||
|
||||
@action
|
||||
void setUseEtherscan(bool value) {
|
||||
_settingsStore.useEtherscan = value;
|
||||
|
|
|
@ -33,11 +33,6 @@ abstract class TorViewModelBase with Store {
|
|||
final SettingsStore _settingsStore;
|
||||
Tor torInstance = Tor.instance;
|
||||
|
||||
@action
|
||||
Future<void> updateStartOnLaunch(bool value) async {
|
||||
_settingsStore.shouldStartTorOnLaunch = value;
|
||||
}
|
||||
|
||||
@computed
|
||||
TorConnectionMode get torConnectionMode => _settingsStore.torConnectionMode;
|
||||
|
||||
|
@ -86,8 +81,6 @@ abstract class TorViewModelBase with Store {
|
|||
|
||||
await torInstance.enable();
|
||||
|
||||
_settingsStore.shouldStartTorOnLaunch = true;
|
||||
|
||||
SocksTCPClient.setProxy(proxies: [
|
||||
ProxySettings(
|
||||
InternetAddress.loopbackIPv4,
|
||||
|
@ -108,8 +101,6 @@ abstract class TorViewModelBase with Store {
|
|||
@action
|
||||
Future<void> stopTor() async {
|
||||
torInstance.disable();
|
||||
// setting the torConnectionMode to disabled will prevent anything from actually using the proxy
|
||||
_settingsStore.shouldStartTorOnLaunch = false;
|
||||
torConnectionStatus = TorConnectionStatus.disconnected;
|
||||
SocksTCPClient.removeProxy();
|
||||
await connectOrDisconnectNodeToProxy(connect: false);
|
||||
|
|
Loading…
Reference in a new issue