diff --git a/lib/di.dart b/lib/di.dart index 688afd749..8eb6b5608 100644 --- a/lib/di.dart +++ b/lib/di.dart @@ -725,16 +725,20 @@ Future setup({ getIt.registerFactory(() => TrocadorProvidersViewModel(getIt.get())); - getIt.registerSingleton(TorViewModel(getIt.get(), getIt.get().nodes)); + getIt.registerSingleton( + TorViewModel(getIt.get(), getIt.get().nodes)); getIt.registerSingleton(ProxyWrapper( settingsStore: getIt.get(), torViewModel: getIt.get(), )); - if (DeviceInfo.instance.isMobile && - (settingsStore.torConnectionMode == TorConnectionMode.enabled || - settingsStore.torConnectionMode == TorConnectionMode.torOnly)) { - getIt.get().startTor(); + if (DeviceInfo.instance.isMobile) { + // only await if torOnly: + if (settingsStore.torConnectionMode == TorConnectionMode.enabled) { + getIt.get().startTor(); + } else if (settingsStore.torConnectionMode == TorConnectionMode.torOnly) { + await getIt.get().startTor(); + } } getIt.registerFactory(() { diff --git a/lib/store/settings_store.dart b/lib/store/settings_store.dart index 97e9be6d9..0508bfb6e 100644 --- a/lib/store/settings_store.dart +++ b/lib/store/settings_store.dart @@ -805,7 +805,8 @@ abstract class SettingsStoreBase with Store { ExchangeApiMode.enabled.raw); final savedTheme = initialTheme ?? 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.addAll(deserializeActionlistDisplayModes( sharedPreferences.getInt(PreferencesKey.displayActionListModeKey) ?? defaultActionsMode)); @@ -1165,7 +1166,8 @@ abstract class SettingsStoreBase with Store { raw: sharedPreferences.getInt(PreferencesKey.exchangeStatusKey) ?? ExchangeApiMode.enabled.raw); 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.addAll(deserializeActionlistDisplayModes( sharedPreferences.getInt(PreferencesKey.displayActionListModeKey) ?? defaultActionsMode)); diff --git a/lib/utils/proxy_wrapper.dart b/lib/utils/proxy_wrapper.dart index 40e6b710a..58b54f621 100644 --- a/lib/utils/proxy_wrapper.dart +++ b/lib/utils/proxy_wrapper.dart @@ -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_view_model.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 { ProxyWrapper({