Cloud sync: last modification improvements

pull/212/head
M66B 2 years ago
parent 31f6fedb31
commit a4ac9e00e9

@ -174,7 +174,9 @@ public class AdapterIdentity extends RecyclerView.Adapter<AdapterIdentity.ViewHo
tvSignKeyId.setVisibility(sb.length() > 0 ? View.VISIBLE : View.GONE);
tvLast.setText(context.getString(R.string.title_last_connected,
(identity.last_connected == null ? "-" : DTF.format(identity.last_connected))));
(identity.last_connected == null ? "-" : DTF.format(identity.last_connected))) +
(BuildConfig.DEBUG ?
"/" + (identity.last_modified == null ? "-" : DTF.format(identity.last_modified)) : ""));
tvMaxSize.setText(identity.max_size == null ? null : Helper.humanReadableByteCount(identity.max_size));
tvMaxSize.setVisibility(identity.max_size == null ? View.GONE : View.VISIBLE);

@ -489,7 +489,7 @@ public abstract class DB extends RoomDatabase {
Log.i("Get PRAGMA " + pragma + "=<?>");
}
if (BuildConfig.DEBUG && false) {
if (BuildConfig.DEBUG) {
db.execSQL("DROP TRIGGER IF EXISTS `attachment_insert`");
db.execSQL("DROP TRIGGER IF EXISTS `attachment_delete`");
@ -561,14 +561,16 @@ public abstract class DB extends RoomDatabase {
" AFTER UPDATE ON account" +
" BEGIN" +
" UPDATE account SET last_modified = strftime('%s') * 1000" +
" WHERE (NEW.auth_type = " + AUTH_TYPE_PASSWORD + " OR OLD.password = NEW.password);" +
" WHERE id = NEW.id" +
" AND (NEW.auth_type = " + AUTH_TYPE_PASSWORD + " OR OLD.password = NEW.password);" +
" END");
db.execSQL("CREATE TRIGGER IF NOT EXISTS identity_update" +
" AFTER UPDATE ON identity" +
" BEGIN" +
" UPDATE identity SET last_modified = strftime('%s') * 1000" +
" WHERE (NEW.auth_type = " + AUTH_TYPE_PASSWORD + " OR OLD.password = NEW.password);" +
" WHERE id = NEW.id" +
" AND (NEW.auth_type = " + AUTH_TYPE_PASSWORD + " OR OLD.password = NEW.password);" +
" END");
}

@ -364,7 +364,8 @@ public class EntityIdentity {
(!state || Objects.equals(i1.state, other.state)) &&
(!state || Objects.equals(i1.error, other.error)) &&
(!state || Objects.equals(i1.last_connected, other.last_connected)) &&
(!state || Objects.equals(i1.max_size, other.max_size)));
(!state || Objects.equals(i1.max_size, other.max_size)) &&
(!state || Objects.equals(i1.last_modified, other.last_modified)));
}
String getDisplayName() {

@ -1288,8 +1288,6 @@ 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();

@ -1018,7 +1018,6 @@ 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