Cloud sync: swipe left/right

pull/212/head
M66B 2 years ago
parent 693bb27e9a
commit 41e9935c88

File diff suppressed because it is too large Load Diff

@ -193,7 +193,7 @@ public class CloudSync {
Helper.writeText(ifile, identity.toJSON().toString()); Helper.writeText(ifile, identity.toJSON().toString());
long itime = ifile.lastModified(); long itime = ifile.lastModified();
if (last == null || itime > last) if (itime > last)
last = itime; last = itime;
} }
} }
@ -316,15 +316,25 @@ public class CloudSync {
JSONObject jaccountdata = new JSONObject(value); JSONObject jaccountdata = new JSONObject(value);
JSONObject jaccount = jaccountdata.getJSONObject("account"); JSONObject jaccount = jaccountdata.getJSONObject("account");
JSONArray jidentities = jaccountdata.getJSONArray("identities");
EntityAccount raccount = EntityAccount.fromJSON(jaccount); EntityAccount raccount = EntityAccount.fromJSON(jaccount);
EntityAccount laccount = db.account().getAccountByUUID(raccount.uuid); EntityAccount laccount = db.account().getAccountByUUID(raccount.uuid);
JSONArray jidentities = jaccountdata.getJSONArray("identities"); String swipe_left_folder = null;
if (jaccount.has("swipe_left_folder") && !jaccount.isNull("swipe_left_folder"))
swipe_left_folder = jaccount.getString("swipe_left_folder");
String swipe_right_folder = null;
if (jaccount.has("swipe_right_folder") && !jaccount.isNull("swipe_right_folder"))
swipe_right_folder = jaccount.getString("swipe_right_folder");
Log.i("Cloud account " + raccount.uuid + "=" + Log.i("Cloud account " + raccount.uuid + "=" +
(laccount == null ? "insert" : (laccount == null ? "insert" :
(EntityAccount.areEqual(raccount, laccount, laccount.auth_type == ServiceAuthenticator.AUTH_TYPE_PASSWORD, true) (EntityAccount.areEqual(raccount, laccount, laccount.auth_type == ServiceAuthenticator.AUTH_TYPE_PASSWORD, true)
? "equal" : "update")) + ? "equal" : "update")) +
" rev=" + revision + " rev=" + revision +
" left=" + swipe_left_folder +
" right=" + swipe_right_folder +
" identities=" + jidentities + " identities=" + jidentities +
" size=" + value.length()); " size=" + value.length());

@ -68,7 +68,7 @@ import javax.mail.internet.InternetAddress;
// https://developer.android.com/topic/libraries/architecture/room.html // https://developer.android.com/topic/libraries/architecture/room.html
@Database( @Database(
version = 262, version = 261,
entities = { entities = {
EntityIdentity.class, EntityIdentity.class,
EntityAccount.class, EntityAccount.class,
@ -2644,7 +2644,7 @@ public abstract class DB extends RoomDatabase {
else else
db.execSQL("UPDATE `folder` SET `hide_seen` = 0"); db.execSQL("UPDATE `folder` SET `hide_seen` = 0");
} }
}).addMigrations(new Migration(261, 262) { }).addMigrations(new Migration(262, 261) {
@Override @Override
public void migrate(@NonNull SupportSQLiteDatabase db) { public void migrate(@NonNull SupportSQLiteDatabase db) {
logMigration(startVersion, endVersion); logMigration(startVersion, endVersion);

Loading…
Cancel
Save