Remove obsolete Nextcloud preference migration path

This commit is contained in:
MM20 2021-09-28 15:46:07 +02:00
parent f4c7f54df1
commit deee2c2fc2
No known key found for this signature in database
GPG Key ID: 0B61A8F2DEAFA389

View File

@ -48,24 +48,7 @@ class NextcloudApiHelper(val context: Context) {
masterKey,
EncryptedSharedPreferences.PrefKeyEncryptionScheme.AES256_SIV,
EncryptedSharedPreferences.PrefValueEncryptionScheme.AES256_GCM
).also {
if (!it.getBoolean("encrypted", false)) {
val legacyPrefs =
context.getSharedPreferences("nextcloud", Context.MODE_PRIVATE)
val keys = arrayOf("server", "username", "token", "displayname")
it.edit {
for (k in keys) {
putString(k, legacyPrefs.getString(k, null))
}
putBoolean("encrypted", true)
}
legacyPrefs.edit {
for (k in keys) {
putString(k, null)
}
}
}
}
)
} catch (e: IOException) {
if (!catchErrors) throw e
File(context.filesDir, "../shared_prefs/nextcloud.xml").delete()