diff options
| author | Harsh Shandilya <msfjarvis@gmail.com> | 2020-08-27 14:27:55 +0530 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-08-27 14:27:55 +0530 |
| commit | 1ce3ef4ea3c55d4a6c4a79f8a6cca58387b240df (patch) | |
| tree | 6e9fbf27c8528637857d358fa9f4b21e96132ef3 /app/src/main/java/com/zeapo/pwdstore/Migrations.kt | |
| parent | 8ec3320df793b58d20f632038b0b2a37f37103e3 (diff) | |
| download | HardenedPass-1ce3ef4ea3c55d4a6c4a79f8a6cca58387b240df.tar.gz HardenedPass-1ce3ef4ea3c55d4a6c4a79f8a6cca58387b240df.zip | |
Expand show hidden folders to also cover files (#1059)
* PasswordItem: only strip .gpg suffixes
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
* Add preference key and migration for showing all hidden contents
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
* Allow showing both hidden files and directories
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
* Add tests for hidden folder setting migration
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
* Add changelog entry
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
* Slightly improve migration logic
Skip migration if old key is not found and always delete the previous key even if its set to false.
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
* Tweak wording
Suggested-by: Fabian Henneke <fabian@henneke.me>
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
* Assert previous key's removal in tests
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
Diffstat (limited to 'app/src/main/java/com/zeapo/pwdstore/Migrations.kt')
| -rw-r--r-- | app/src/main/java/com/zeapo/pwdstore/Migrations.kt | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/app/src/main/java/com/zeapo/pwdstore/Migrations.kt b/app/src/main/java/com/zeapo/pwdstore/Migrations.kt index 7148ad7e..f7cce784 100644 --- a/app/src/main/java/com/zeapo/pwdstore/Migrations.kt +++ b/app/src/main/java/com/zeapo/pwdstore/Migrations.kt @@ -19,6 +19,7 @@ import java.net.URI fun runMigrations(context: Context) { migrateToGitUrlBasedConfig(context) + migrateToHideAll(context) } private fun migrateToGitUrlBasedConfig(context: Context) { @@ -84,3 +85,12 @@ private fun migrateToGitUrlBasedConfig(context: Context) { e { "Failed to migrate to URL-based Git config, generated URL is invalid" } } } + +private fun migrateToHideAll(context: Context) { + context.sharedPrefs.all[PreferenceKeys.SHOW_HIDDEN_FOLDERS] ?: return + val isHidden = context.sharedPrefs.getBoolean(PreferenceKeys.SHOW_HIDDEN_FOLDERS, false) + context.sharedPrefs.edit { + remove(PreferenceKeys.SHOW_HIDDEN_FOLDERS) + putBoolean(PreferenceKeys.SHOW_HIDDEN_CONTENTS, isHidden) + } +} |
