mirror of
https://github.com/M66B/FairEmail.git
synced 2026-04-03 07:36:31 +02:00
Remember last used encryption method per identity
This commit is contained in:
@@ -60,7 +60,7 @@ import io.requery.android.database.sqlite.SQLiteDatabase;
|
||||
// https://developer.android.com/topic/libraries/architecture/room.html
|
||||
|
||||
@Database(
|
||||
version = 160,
|
||||
version = 161,
|
||||
entities = {
|
||||
EntityIdentity.class,
|
||||
EntityAccount.class,
|
||||
@@ -1590,6 +1590,16 @@ public abstract class DB extends RoomDatabase {
|
||||
db.execSQL("DROP TRIGGER attachment_delete");
|
||||
createTriggers(db);
|
||||
}
|
||||
})
|
||||
.addMigrations(new Migration(160, 161) {
|
||||
@Override
|
||||
public void migrate(@NonNull SupportSQLiteDatabase db) {
|
||||
Log.i("DB migration from version " + startVersion + " to " + endVersion);
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
String encrypt_method = prefs.getString("default_encrypt_method", "pgp");
|
||||
db.execSQL("UPDATE identity SET encrypt = " + ("pgp".equals(encrypt_method) ? 0 : 1));
|
||||
prefs.edit().remove("default_encrypt_method").apply();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user