mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-01-05 10:29:23 +00:00
only await if tor only
This commit is contained in:
parent
0cc1f0806e
commit
de4200eb29
3 changed files with 13 additions and 18 deletions
12
lib/di.dart
12
lib/di.dart
|
@ -725,16 +725,20 @@ Future<void> setup({
|
||||||
|
|
||||||
getIt.registerFactory(() => TrocadorProvidersViewModel(getIt.get<SettingsStore>()));
|
getIt.registerFactory(() => TrocadorProvidersViewModel(getIt.get<SettingsStore>()));
|
||||||
|
|
||||||
getIt.registerSingleton(TorViewModel(getIt.get<SettingsStore>(), getIt.get<SettingsStore>().nodes));
|
getIt.registerSingleton(
|
||||||
|
TorViewModel(getIt.get<SettingsStore>(), getIt.get<SettingsStore>().nodes));
|
||||||
getIt.registerSingleton(ProxyWrapper(
|
getIt.registerSingleton(ProxyWrapper(
|
||||||
settingsStore: getIt.get<SettingsStore>(),
|
settingsStore: getIt.get<SettingsStore>(),
|
||||||
torViewModel: getIt.get<TorViewModel>(),
|
torViewModel: getIt.get<TorViewModel>(),
|
||||||
));
|
));
|
||||||
|
|
||||||
if (DeviceInfo.instance.isMobile &&
|
if (DeviceInfo.instance.isMobile) {
|
||||||
(settingsStore.torConnectionMode == TorConnectionMode.enabled ||
|
// only await if torOnly:
|
||||||
settingsStore.torConnectionMode == TorConnectionMode.torOnly)) {
|
if (settingsStore.torConnectionMode == TorConnectionMode.enabled) {
|
||||||
getIt.get<TorViewModel>().startTor();
|
getIt.get<TorViewModel>().startTor();
|
||||||
|
} else if (settingsStore.torConnectionMode == TorConnectionMode.torOnly) {
|
||||||
|
await getIt.get<TorViewModel>().startTor();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getIt.registerFactory(() {
|
getIt.registerFactory(() {
|
||||||
|
|
|
@ -805,7 +805,8 @@ abstract class SettingsStoreBase with Store {
|
||||||
ExchangeApiMode.enabled.raw);
|
ExchangeApiMode.enabled.raw);
|
||||||
final savedTheme = initialTheme ??
|
final savedTheme = initialTheme ??
|
||||||
ThemeList.deserialize(
|
ThemeList.deserialize(
|
||||||
raw: sharedPreferences.getInt(PreferencesKey.currentTheme) ?? (isMoneroOnly ? ThemeList.moneroDarkTheme.raw : ThemeList.cakeDarkTheme.raw));
|
raw: sharedPreferences.getInt(PreferencesKey.currentTheme) ??
|
||||||
|
(isMoneroOnly ? ThemeList.moneroDarkTheme.raw : ThemeList.cakeDarkTheme.raw));
|
||||||
final actionListDisplayMode = ObservableList<ActionListDisplayMode>();
|
final actionListDisplayMode = ObservableList<ActionListDisplayMode>();
|
||||||
actionListDisplayMode.addAll(deserializeActionlistDisplayModes(
|
actionListDisplayMode.addAll(deserializeActionlistDisplayModes(
|
||||||
sharedPreferences.getInt(PreferencesKey.displayActionListModeKey) ?? defaultActionsMode));
|
sharedPreferences.getInt(PreferencesKey.displayActionListModeKey) ?? defaultActionsMode));
|
||||||
|
@ -1165,7 +1166,8 @@ abstract class SettingsStoreBase with Store {
|
||||||
raw: sharedPreferences.getInt(PreferencesKey.exchangeStatusKey) ??
|
raw: sharedPreferences.getInt(PreferencesKey.exchangeStatusKey) ??
|
||||||
ExchangeApiMode.enabled.raw);
|
ExchangeApiMode.enabled.raw);
|
||||||
currentTheme = ThemeList.deserialize(
|
currentTheme = ThemeList.deserialize(
|
||||||
raw: sharedPreferences.getInt(PreferencesKey.currentTheme) ?? (isMoneroOnly ? ThemeList.moneroDarkTheme.raw : ThemeList.cakeDarkTheme.raw));
|
raw: sharedPreferences.getInt(PreferencesKey.currentTheme) ??
|
||||||
|
(isMoneroOnly ? ThemeList.moneroDarkTheme.raw : ThemeList.cakeDarkTheme.raw));
|
||||||
actionlistDisplayMode = ObservableList<ActionListDisplayMode>();
|
actionlistDisplayMode = ObservableList<ActionListDisplayMode>();
|
||||||
actionlistDisplayMode.addAll(deserializeActionlistDisplayModes(
|
actionlistDisplayMode.addAll(deserializeActionlistDisplayModes(
|
||||||
sharedPreferences.getInt(PreferencesKey.displayActionListModeKey) ?? defaultActionsMode));
|
sharedPreferences.getInt(PreferencesKey.displayActionListModeKey) ?? defaultActionsMode));
|
||||||
|
|
|
@ -4,17 +4,6 @@ import 'package:cake_wallet/store/settings_store.dart';
|
||||||
import 'package:cake_wallet/view_model/settings/tor_connection.dart';
|
import 'package:cake_wallet/view_model/settings/tor_connection.dart';
|
||||||
import 'package:cake_wallet/view_model/settings/tor_view_model.dart';
|
import 'package:cake_wallet/view_model/settings/tor_view_model.dart';
|
||||||
import 'package:socks5_proxy/socks.dart';
|
import 'package:socks5_proxy/socks.dart';
|
||||||
import 'package:tor/tor.dart';
|
|
||||||
|
|
||||||
// this is the only way to ensure we're making a non-tor connection:
|
|
||||||
class NullOverrides extends HttpOverrides {
|
|
||||||
NullOverrides();
|
|
||||||
|
|
||||||
@override
|
|
||||||
HttpClient createHttpClient(SecurityContext? context) {
|
|
||||||
return super.createHttpClient(context);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class ProxyWrapper {
|
class ProxyWrapper {
|
||||||
ProxyWrapper({
|
ProxyWrapper({
|
||||||
|
|
Loading…
Reference in a new issue