Added account/identity last modified time

pull/212/head
M66B 2 years ago
parent 421861ec30
commit a5f1507a19

File diff suppressed because it is too large Load Diff

@ -68,7 +68,7 @@ import javax.mail.internet.InternetAddress;
// https://developer.android.com/topic/libraries/architecture/room.html
@Database(
version = 262,
version = 263,
entities = {
EntityIdentity.class,
EntityAccount.class,
@ -2655,6 +2655,14 @@ public abstract class DB extends RoomDatabase {
logMigration(startVersion, endVersion);
db.execSQL("ALTER TABLE `folder` ADD COLUMN `subtype` TEXT");
}
}).addMigrations(new Migration(262, 263) {
@Override
public void migrate(@NonNull SupportSQLiteDatabase db) {
logMigration(startVersion, endVersion);
db.execSQL("ALTER TABLE `account` ADD COLUMN `last_modified` INTEGER");
db.execSQL("ALTER TABLE `identity` ADD COLUMN `last_modified` INTEGER");
createTriggers(db);
}
}).addMigrations(new Migration(998, 999) {
@Override
public void migrate(@NonNull SupportSQLiteDatabase db) {

@ -168,6 +168,7 @@ public class EntityAccount extends EntityOrder implements Serializable {
public Boolean capability_idle;
public Boolean capability_utf8;
public Boolean capability_uidl;
public Long last_modified; // sync
boolean isGmail() {
return "imap.gmail.com".equalsIgnoreCase(host) ||

@ -132,6 +132,7 @@ public class EntityIdentity {
public String error;
public Long last_connected;
public Long max_size;
public Long last_modified; // sync
String getProtocol() {
return (encryption == EmailService.ENCRYPTION_SSL ? "smtps" : "smtp");

@ -1288,6 +1288,8 @@ public class FragmentAccount extends FragmentBase {
account.warning = null;
account.error = null;
account.last_connected = last_connected;
account.last_modified = new Date().getTime();
// SET last_modified = strftime('%s') * 1000
if (account.primary)
db.account().resetPrimary();

@ -69,6 +69,7 @@ import java.io.FileNotFoundException;
import java.net.UnknownHostException;
import java.security.cert.X509Certificate;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Objects;
@ -1017,6 +1018,7 @@ public class FragmentIdentity extends FragmentBase {
identity.error = null;
identity.last_connected = last_connected;
identity.max_size = (user_max_size == null ? server_max_size : user_max_size);
identity.last_modified = new Date().getTime();
if (identity.primary)
db.identity().resetPrimary(account);

Loading…
Cancel
Save