Revert "Resume last sync"

This reverts commit 62ae0eeb17.
This commit is contained in:
M66B
2018-09-06 05:33:04 +00:00
parent 62ae0eeb17
commit 30be70fec6
8 changed files with 2 additions and 1893 deletions

View File

@@ -45,7 +45,7 @@ import androidx.sqlite.db.SupportSQLiteDatabase;
// https://developer.android.com/topic/libraries/architecture/room.html
@Database(
version = 12,
version = 10,
entities = {
EntityIdentity.class,
EntityAccount.class,
@@ -184,20 +184,6 @@ public abstract class DB extends RoomDatabase {
db.execSQL("UPDATE `folder` SET unified = 1 WHERE type = '" + EntityFolder.INBOX + "'");
}
})
.addMigrations(new Migration(10, 11) {
@Override
public void migrate(SupportSQLiteDatabase db) {
Log.i(Helper.TAG, "DB migration from version " + startVersion + " to " + endVersion);
db.execSQL("ALTER TABLE `account` ADD COLUMN `last_sync` INTEGER");
}
})
.addMigrations(new Migration(11, 12) {
@Override
public void migrate(SupportSQLiteDatabase db) {
Log.i(Helper.TAG, "DB migration from version " + startVersion + " to " + endVersion);
db.execSQL("ALTER TABLE `folder` ADD COLUMN `last_sync` INTEGER");
}
})
.build();
}

View File

@@ -117,9 +117,6 @@ public interface DaoFolder {
@Query("UPDATE folder SET synchronize = :synchronize, unified = :unified, after = :after WHERE id = :id")
int setFolderProperties(long id, boolean synchronize, boolean unified, int after);
@Query("UPDATE folder SET last_sync = :last_sync WHERE id = :id")
int setFolderLastSync(long id, long last_sync);
@Query("DELETE FROM folder WHERE account= :account AND name = :name")
void deleteFolder(Long account, String name);
}

View File

@@ -52,7 +52,6 @@ public class EntityAccount {
public Boolean store_sent; // obsolete
@NonNull
public Integer poll_interval; // NOOP interval
public Long last_sync;
public Long seen_until;
public String state;
public String error;

View File

@@ -63,7 +63,6 @@ public class EntityFolder implements Parcelable {
public Boolean synchronize;
@NonNull
public Integer after; // days
public Long last_sync;
public String state;
public String error;

View File

@@ -1226,19 +1226,6 @@ public class ServiceSynchronize extends LifecycleService {
int old = db.message().deleteMessagesBefore(folder.id, ago);
Log.i(Helper.TAG, folder.name + " local old=" + old);
if (folder.last_sync != null) {
Log.i(Helper.TAG, "Last sync=" + new Date(folder.last_sync));
cal.setTimeInMillis(folder.last_sync);
// For late arrivals and sync duration
cal.add(Calendar.DAY_OF_MONTH, -1);
cal.set(Calendar.HOUR_OF_DAY, 0);
cal.set(Calendar.MINUTE, 0);
cal.set(Calendar.SECOND, 0);
cal.set(Calendar.MILLISECOND, 0);
ago = cal.getTimeInMillis();
Log.i(Helper.TAG, folder.name + " ago=" + new Date(ago));
}
// Get list of local uids
List<Long> uids = db.message().getUids(folder.id, ago);
Log.i(Helper.TAG, folder.name + " local count=" + uids.size());
@@ -1302,9 +1289,6 @@ public class ServiceSynchronize extends LifecycleService {
}
EntityOperation.process(this); // download small attachments
folder.last_sync = new Date().getTime();
db.folder().setFolderLastSync(folder.id, folder.last_sync);
Log.w(Helper.TAG, folder.name + " statistics added=" + added + " updated=" + updated + " unchanged=" + unchanged);
} finally {
Log.v(Helper.TAG, folder.name + " end sync");