mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-01-03 17:40:43 +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.registerSingleton(TorViewModel(getIt.get<SettingsStore>(), getIt.get<SettingsStore>().nodes));
|
||||
getIt.registerSingleton(
|
||||
TorViewModel(getIt.get<SettingsStore>(), getIt.get<SettingsStore>().nodes));
|
||||
getIt.registerSingleton(ProxyWrapper(
|
||||
settingsStore: getIt.get<SettingsStore>(),
|
||||
torViewModel: getIt.get<TorViewModel>(),
|
||||
));
|
||||
|
||||
if (DeviceInfo.instance.isMobile &&
|
||||
(settingsStore.torConnectionMode == TorConnectionMode.enabled ||
|
||||
settingsStore.torConnectionMode == TorConnectionMode.torOnly)) {
|
||||
if (DeviceInfo.instance.isMobile) {
|
||||
// only await if torOnly:
|
||||
if (settingsStore.torConnectionMode == TorConnectionMode.enabled) {
|
||||
getIt.get<TorViewModel>().startTor();
|
||||
} else if (settingsStore.torConnectionMode == TorConnectionMode.torOnly) {
|
||||
await getIt.get<TorViewModel>().startTor();
|
||||
}
|
||||
}
|
||||
|
||||
getIt.registerFactory(() {
|
||||
|
|
|
@ -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>();
|
||||
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>();
|
||||
actionlistDisplayMode.addAll(deserializeActionlistDisplayModes(
|
||||
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_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({
|
||||
|
|
Loading…
Reference in a new issue