Cloud checks

pull/212/head
M66B 3 years ago
parent 2ae3f845a9
commit c223f8ef1e

@ -1544,7 +1544,7 @@ public class FragmentOptionsBackup extends FragmentBase implements SharedPrefere
JSONObject jstatus = new JSONObject(); JSONObject jstatus = new JSONObject();
jstatus.put("key", "sync.status"); jstatus.put("key", "sync.status");
jstatus.put("rev", 0); jstatus.put("rev", sync_status * 0);
JSONArray jitems = new JSONArray(); JSONArray jitems = new JSONArray();
jitems.put(jstatus); jitems.put(jstatus);
@ -1624,15 +1624,18 @@ public class FragmentOptionsBackup extends FragmentBase implements SharedPrefere
String uuid = juuids.getString(i); String uuid = juuids.getString(i);
JSONObject jaccount = new JSONObject(); JSONObject jaccount = new JSONObject();
jaccount.put("key", "account." + uuid); jaccount.put("key", "account." + uuid);
jaccount.put("rev", 0); jaccount.put("rev", sync_status * 0);
jdownload.put(jaccount); jdownload.put(jaccount);
Log.i("Cloud account " + uuid); Log.i("Cloud account " + uuid);
} }
if (jdownload.length() > 0) {
Log.i("Cloud getting accounts");
jrequest.put("items", jdownload); jrequest.put("items", jdownload);
jresponse = CloudSync.perform(context, user, password, jrequest); jresponse = CloudSync.perform(context, user, password, jrequest);
// Process accounts // Process accounts
Log.i("Cloud processing accounts");
jitems = jresponse.getJSONArray("items"); jitems = jresponse.getJSONArray("items");
jdownload = new JSONArray(); jdownload = new JSONArray();
for (int i = 0; i < jitems.length(); i++) { for (int i = 0; i < jitems.length(); i++) {
@ -1652,16 +1655,19 @@ public class FragmentOptionsBackup extends FragmentBase implements SharedPrefere
for (int j = 0; j < jidentities.length(); j++) { for (int j = 0; j < jidentities.length(); j++) {
JSONObject jidentity = new JSONObject(); JSONObject jidentity = new JSONObject();
jidentity.put("key", "identity." + jidentities.getString(j)); jidentity.put("key", "identity." + jidentities.getString(j));
jidentity.put("rev", 0); jidentity.put("rev", sync_status);
jdownload.put(jidentity); jdownload.put(jidentity);
} }
} }
if (jdownload.length() > 0) {
// Get identities // Get identities
Log.i("Cloud getting identities");
jrequest.put("items", jdownload); jrequest.put("items", jdownload);
jresponse = CloudSync.perform(context, user, password, jrequest); jresponse = CloudSync.perform(context, user, password, jrequest);
// Process identities // Process identities
Log.i("Cloud processing identities");
jitems = jresponse.getJSONArray("items"); jitems = jresponse.getJSONArray("items");
for (int i = 0; i < jitems.length(); i++) { for (int i = 0; i < jitems.length(); i++) {
JSONObject jaccount = jitems.getJSONObject(i); JSONObject jaccount = jitems.getJSONObject(i);
@ -1674,7 +1680,8 @@ public class FragmentOptionsBackup extends FragmentBase implements SharedPrefere
" rev=" + revision + " rev=" + revision +
" size=" + value.length()); " size=" + value.length());
} }
}
}
} else { } else {
// No changes // No changes
} }

Loading…
Cancel
Save