This commit is contained in:
Matthew Fosse 2024-01-02 12:31:05 -05:00
parent 533b978ac1
commit e93891682b
3 changed files with 19 additions and 9 deletions

View file

@ -48,6 +48,7 @@ class PreferencesKey {
static const moneroWalletPasswordUpdateV1Base = 'monero_wallet_update_v1';
static const syncModeKey = 'sync_mode';
static const syncAllKey = 'sync_all';
static const torConnectionKey = 'tor_connection';
static const pinTimeOutDuration = 'pin_timeout_duration';
static const lastAuthTimeMilliseconds = 'last_auth_time_milliseconds';
static const lastPopupDate = 'last_popup_date';

View file

@ -91,6 +91,11 @@ class ConnectionSyncPage extends BasePage {
const StandardListSeparator(padding: EdgeInsets.symmetric(horizontal: 24)),
],
if (FeatureFlag.isInAppTorEnabled) ...[
Container(
color: Colors.amber, // TODO: CW-519 change
padding: EdgeInsets.symmetric(horizontal: 24, vertical: 10),
child: Column(children: [
Observer(builder: (context) {
return SettingsPickerCell<TorConnection>(
title: S.current.background_sync_mode,
@ -100,9 +105,6 @@ class ConnectionSyncPage extends BasePage {
onItemSelected: dashboardViewModel.setTorConnection,
);
}),
Container(
color: Colors.amber, // TODO: CW-519 change
child: Column(children: [
SettingsCellWithArrow(
title: S.current.tor_connection,
handler: (context) => Navigator.of(context).pushNamed(Routes.torPage),

View file

@ -70,6 +70,7 @@ abstract class SettingsStoreBase with Store {
required String initialLanguageCode,
required SyncMode initialSyncMode,
required bool initialSyncAll,
required TorConnection initialTorConnection,
// required String initialCurrentLocale,
required this.appVersion,
required this.deviceName,
@ -151,6 +152,7 @@ abstract class SettingsStoreBase with Store {
initialShouldRequireTOTP2FAForAllSecurityAndBackupSettings,
currentSyncMode = initialSyncMode,
currentSyncAll = initialSyncAll,
currentTorConnection = initialTorConnection,
priority = ObservableMap<WalletType, TransactionPriority>(),
defaultBuyProviders = ObservableMap<WalletType, ProviderType>(),
defaultSellProviders = ObservableMap<WalletType, ProviderType>() {
@ -944,6 +946,10 @@ abstract class SettingsStoreBase with Store {
});
final savedSyncAll = sharedPreferences.getBool(PreferencesKey.syncAllKey) ?? true;
final savedTorConnection = TorConnection.all.firstWhere((element) {
return element.type.index == (sharedPreferences.getInt(PreferencesKey.torConnectionKey) ?? 0);
});
return SettingsStore(
sharedPreferences: sharedPreferences,
initialShouldShowMarketPlaceInDashboard: shouldShowMarketPlaceInDashboard,
@ -1011,6 +1017,7 @@ abstract class SettingsStoreBase with Store {
backgroundTasks: backgroundTasks,
initialSyncMode: savedSyncMode,
initialSyncAll: savedSyncAll,
initialTorConnection: savedTorConnection,
shouldShowYatPopup: shouldShowYatPopup);
}