Unique thread / account

This commit is contained in:
M66B
2022-04-17 17:50:57 +02:00
parent 8d7876f4fb
commit 1ee4717659
3 changed files with 2744 additions and 3 deletions

View File

@@ -71,7 +71,7 @@ import io.requery.android.database.sqlite.SQLiteDatabase;
// https://developer.android.com/topic/libraries/architecture/room.html
@Database(
version = 230,
version = 231,
entities = {
EntityIdentity.class,
EntityAccount.class,
@@ -2307,6 +2307,12 @@ public abstract class DB extends RoomDatabase {
db.execSQL("ALTER TABLE `folder` ADD COLUMN `hide_seen` INTEGER NOT NULL DEFAULT 0");
db.execSQL("UPDATE `folder` SET hide = 0 WHERE unified");
}
}).addMigrations(new Migration(230, 231) {
@Override
public void migrate(@NonNull SupportSQLiteDatabase db) {
logMigration(startVersion, endVersion);
db.execSQL("UPDATE `message` SET thread = account || ':' || thread");
}
}).addMigrations(new Migration(998, 999) {
@Override
public void migrate(@NonNull SupportSQLiteDatabase db) {

View File

@@ -1548,11 +1548,11 @@ public class MessageHelper {
if (thread == null && refs.size() > 0) {
String ref = refs.get(0);
if (!Objects.equals(ref, msgid))
thread = ref;
thread = account + ":" + ref;
}
if (thread == null)
thread = getHash() + ":" + uid;
thread = account + ":" + getHash() + ":" + uid;
// Sent before
for (TupleThreadInfo info : infos)