Added suffix to raw message files

pull/169/head
M66B 5 years ago
parent f7ade59779
commit d0f4c89233

File diff suppressed because it is too large Load Diff

@ -56,7 +56,7 @@ import io.requery.android.database.sqlite.RequerySQLiteOpenHelperFactory;
// https://developer.android.com/topic/libraries/architecture/room.html
@Database(
version = 121,
version = 122,
entities = {
EntityIdentity.class,
EntityAccount.class,
@ -1176,6 +1176,18 @@ public abstract class DB extends RoomDatabase {
db.execSQL("UPDATE `account` SET ondemand = 0");
}
})
.addMigrations(new Migration(121, 122) {
@Override
public void migrate(@NonNull SupportSQLiteDatabase db) {
Log.i("DB migration from version " + startVersion + " to " + endVersion);
db.execSQL("UPDATE `message` SET raw = NULL");
File[] raws = new File(context.getFilesDir(), "raw").listFiles();
if (raws != null)
for (File file : raws)
file.delete();
}
})
.build();
}

@ -245,7 +245,7 @@ public class EntityMessage implements Serializable {
File dir = new File(context.getFilesDir(), "raw");
if (!dir.exists())
dir.mkdir();
return new File(dir, Long.toString(id));
return new File(dir, id + ".eml");
}
static void snooze(Context context, long id, Long wakeup) {

Loading…
Cancel
Save