Notify new messages after account creation only

pull/146/head
M66B 6 years ago
parent eb6203ab85
commit 5e9bb1415d

File diff suppressed because it is too large Load Diff

@ -45,7 +45,7 @@ import androidx.sqlite.db.SupportSQLiteDatabase;
// https://developer.android.com/topic/libraries/architecture/room.html
@Database(
version = 24,
version = 25,
entities = {
EntityIdentity.class,
EntityAccount.class,
@ -291,6 +291,13 @@ public abstract class DB extends RoomDatabase {
db.execSQL("ALTER TABLE `message` ADD COLUMN `preview` TEXT");
}
})
.addMigrations(new Migration(24, 25) {
@Override
public void migrate(SupportSQLiteDatabase db) {
Log.i(Helper.TAG, "DB migration from version " + startVersion + " to " + endVersion);
db.execSQL("ALTER TABLE `account` ADD COLUMN `created` INTEGER");
}
})
.build();
}

@ -182,6 +182,7 @@ public interface DaoMessage {
" JOIN folder ON folder.id = message.folder" +
" WHERE account.`synchronize`" +
" AND folder.unified" +
" AND (account.created IS NULL OR IFNULL(message.sent, message.received) > account.created)" +
" AND NOT message.ui_seen" +
" AND NOT message.ui_hide" +
" AND NOT message.ui_found" +

@ -62,6 +62,7 @@ public class EntityAccount {
@NonNull
public Integer poll_interval; // keep-alive interval
public Long seen_until; // obsolete
public Long created;
public String state;
public String error;

@ -73,6 +73,7 @@ import java.text.Collator;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.List;
import java.util.Locale;
import java.util.Properties;
@ -715,6 +716,7 @@ public class FragmentAccount extends FragmentEx {
account.store_sent = false; // obsolete
account.seen_until = null; // obsolete
account.created = new Date().getTime();
if (!synchronize)
account.error = null;

@ -650,6 +650,7 @@ public class FragmentSetup extends FragmentEx {
JSONObject jaccount = (JSONObject) jaccounts.get(a);
EntityAccount account = EntityAccount.fromJSON(jaccount);
account.store_sent = false;
account.created = new Date().getTime();
account.id = db.account().insertAccount(account);
Log.i(Helper.TAG, "Imported account=" + account.name);

Loading…
Cancel
Save