Cloud sync: fixes

This commit is contained in:
M66B
2023-01-21 13:52:57 +01:00
parent f17aa78ad2
commit 76c6fc2e6c
2 changed files with 8 additions and 8 deletions

View File

@@ -232,7 +232,7 @@ public class CloudSync {
return;
}
List<EntityAccount> accounts = db.account().getSynchronizingAccounts(null);
List<EntityAccount> accounts = db.account().getAccounts();
EntityLog.log(context, EntityLog.Type.Cloud,
"Cloud accounts=" + (accounts == null ? null : accounts.size()));
if (accounts == null || accounts.size() == 0)
@@ -242,14 +242,14 @@ public class CloudSync {
JSONArray jaccountuuidlist = new JSONArray();
for (EntityAccount account : accounts)
if (!TextUtils.isEmpty(account.uuid)) {
if (account.synchronize && !TextUtils.isEmpty(account.uuid)) {
jaccountuuidlist.put(account.uuid);
JSONArray jidentitieuuids = new JSONArray();
List<EntityIdentity> identities = db.identity().getIdentities(account.id);
if (identities != null)
for (EntityIdentity identity : identities)
if (!TextUtils.isEmpty(identity.uuid)) {
if (identity.synchronize && !TextUtils.isEmpty(identity.uuid)) {
jidentitieuuids.put(identity.uuid);
JSONObject jidentity = identity.toJSON();
@@ -377,7 +377,7 @@ public class CloudSync {
"Cloud account " + raccount.uuid + "=" +
(laccount == null ? "insert" :
(EntityAccount.areEqual(raccount, laccount,
laccount.auth_type == ServiceAuthenticator.AUTH_TYPE_PASSWORD, true)
laccount.auth_type == ServiceAuthenticator.AUTH_TYPE_PASSWORD, false)
? "equal" : "update")) +
" rev=" + revision +
" left=" + (left == null ? null : left.name + ":" + left.type) +
@@ -483,13 +483,12 @@ public class CloudSync {
"Cloud identity " + ridentity.uuid + "=" +
(lidentity == null ? "insert" :
(EntityIdentity.areEqual(ridentity, lidentity,
lidentity.auth_type == ServiceAuthenticator.AUTH_TYPE_PASSWORD, true)
lidentity.auth_type == ServiceAuthenticator.AUTH_TYPE_PASSWORD, false)
? "equal" : "update")) +
" rev=" + revision +
" size=" + value.length());
ridentity.id = null;
ridentity.primary = false;
ridentity.last_modified = rrevision;
try {
@@ -503,6 +502,7 @@ public class CloudSync {
}
} else {
ridentity.id = lidentity.id;
ridentity.account = lidentity.account;
db.identity().updateIdentity(ridentity);
}