mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-11-17 09:47:35 +00:00
Fixes for restore from backup file. Fixed restoring for pin length. Added new transaction priority keys to preferences dump.CAKE-197. CAKE-247
This commit is contained in:
parent
b75484594c
commit
b6215389d7
1 changed files with 18 additions and 11 deletions
|
@ -126,7 +126,6 @@ class BackupService {
|
||||||
Future<void> _importPreferencesDump() async {
|
Future<void> _importPreferencesDump() async {
|
||||||
final appDir = await getApplicationDocumentsDirectory();
|
final appDir = await getApplicationDocumentsDirectory();
|
||||||
final preferencesFile = File('${appDir.path}/~_preferences_dump');
|
final preferencesFile = File('${appDir.path}/~_preferences_dump');
|
||||||
const defaultSettingsMigrationVersionKey = PreferencesKey.currentDefaultSettingsMigrationVersion;
|
|
||||||
|
|
||||||
if (!preferencesFile.existsSync()) {
|
if (!preferencesFile.existsSync()) {
|
||||||
return;
|
return;
|
||||||
|
@ -157,14 +156,21 @@ class BackupService {
|
||||||
await _sharedPreferences.setInt(
|
await _sharedPreferences.setInt(
|
||||||
PreferencesKey.currentBitcoinElectrumSererIdKey,
|
PreferencesKey.currentBitcoinElectrumSererIdKey,
|
||||||
data[PreferencesKey.currentBitcoinElectrumSererIdKey] as int);
|
data[PreferencesKey.currentBitcoinElectrumSererIdKey] as int);
|
||||||
await _sharedPreferences.setInt(PreferencesKey.currentLanguageCode,
|
await _sharedPreferences.setString(PreferencesKey.currentLanguageCode,
|
||||||
data[PreferencesKey.currentLanguageCode] as int);
|
data[PreferencesKey.currentLanguageCode] as String);
|
||||||
await _sharedPreferences.setInt(PreferencesKey.displayActionListModeKey,
|
await _sharedPreferences.setInt(PreferencesKey.displayActionListModeKey,
|
||||||
data[PreferencesKey.displayActionListModeKey] as int);
|
data[PreferencesKey.displayActionListModeKey] as int);
|
||||||
|
await _sharedPreferences.setInt(PreferencesKey.currentPinLength,
|
||||||
|
data[PreferencesKey.currentPinLength] as int);
|
||||||
await _sharedPreferences.setInt(
|
await _sharedPreferences.setInt(
|
||||||
'current_theme', data['current_theme'] as int);
|
PreferencesKey.currentTheme, data[PreferencesKey.currentTheme] as int);
|
||||||
await _sharedPreferences.setInt(defaultSettingsMigrationVersionKey,
|
await _sharedPreferences.setInt(
|
||||||
data[defaultSettingsMigrationVersionKey] as int);
|
PreferencesKey.currentDefaultSettingsMigrationVersion,
|
||||||
|
data[PreferencesKey.currentDefaultSettingsMigrationVersion] as int);
|
||||||
|
await _sharedPreferences.setInt(PreferencesKey.moneroTransactionPriority,
|
||||||
|
data[PreferencesKey.moneroTransactionPriority] as int);
|
||||||
|
await _sharedPreferences.setInt(PreferencesKey.bitcoinTransactionPriority,
|
||||||
|
data[PreferencesKey.bitcoinTransactionPriority] as int);
|
||||||
|
|
||||||
await preferencesFile.delete();
|
await preferencesFile.delete();
|
||||||
}
|
}
|
||||||
|
@ -237,9 +243,6 @@ class BackupService {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<String> _exportPreferencesJSON() async {
|
Future<String> _exportPreferencesJSON() async {
|
||||||
const defaultSettingsMigrationVersionKey =
|
|
||||||
'current_default_settings_migration_version';
|
|
||||||
|
|
||||||
final preferences = <String, Object>{
|
final preferences = <String, Object>{
|
||||||
PreferencesKey.currentWalletName:
|
PreferencesKey.currentWalletName:
|
||||||
_sharedPreferences.getString(PreferencesKey.currentWalletName),
|
_sharedPreferences.getString(PreferencesKey.currentWalletName),
|
||||||
|
@ -269,8 +272,12 @@ class BackupService {
|
||||||
_sharedPreferences.getInt(PreferencesKey.displayActionListModeKey),
|
_sharedPreferences.getInt(PreferencesKey.displayActionListModeKey),
|
||||||
PreferencesKey.currentTheme:
|
PreferencesKey.currentTheme:
|
||||||
_sharedPreferences.getInt(PreferencesKey.currentTheme),
|
_sharedPreferences.getInt(PreferencesKey.currentTheme),
|
||||||
defaultSettingsMigrationVersionKey:
|
PreferencesKey.currentDefaultSettingsMigrationVersion: _sharedPreferences
|
||||||
_sharedPreferences.getInt(defaultSettingsMigrationVersionKey)
|
.getInt(PreferencesKey.currentDefaultSettingsMigrationVersion),
|
||||||
|
PreferencesKey.bitcoinTransactionPriority:
|
||||||
|
_sharedPreferences.getInt(PreferencesKey.bitcoinTransactionPriority),
|
||||||
|
PreferencesKey.moneroTransactionPriority:
|
||||||
|
_sharedPreferences.getInt(PreferencesKey.moneroTransactionPriority),
|
||||||
};
|
};
|
||||||
|
|
||||||
return json.encode(preferences);
|
return json.encode(preferences);
|
||||||
|
|
Loading…
Reference in a new issue