mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-12-23 03:59:23 +00:00
save
This commit is contained in:
parent
533b978ac1
commit
e93891682b
3 changed files with 19 additions and 9 deletions
|
@ -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';
|
||||
|
|
|
@ -91,18 +91,20 @@ class ConnectionSyncPage extends BasePage {
|
|||
const StandardListSeparator(padding: EdgeInsets.symmetric(horizontal: 24)),
|
||||
],
|
||||
if (FeatureFlag.isInAppTorEnabled) ...[
|
||||
Observer(builder: (context) {
|
||||
return SettingsPickerCell<TorConnection>(
|
||||
title: S.current.background_sync_mode,
|
||||
items: TorConnection.all,
|
||||
displayItem: (TorConnection torConnection) => torConnection.name,
|
||||
selectedItem: dashboardViewModel.torConnection,
|
||||
onItemSelected: dashboardViewModel.setTorConnection,
|
||||
);
|
||||
}),
|
||||
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,
|
||||
items: TorConnection.all,
|
||||
displayItem: (TorConnection torConnection) => torConnection.name,
|
||||
selectedItem: dashboardViewModel.torConnection,
|
||||
onItemSelected: dashboardViewModel.setTorConnection,
|
||||
);
|
||||
}),
|
||||
SettingsCellWithArrow(
|
||||
title: S.current.tor_connection,
|
||||
handler: (context) => Navigator.of(context).pushNamed(Routes.torPage),
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue