Updated FAQ

This commit is contained in:
M66B 2023-01-15 22:01:51 +01:00
parent 632e045c7c
commit 8a3ed45c0c
3 changed files with 16 additions and 17 deletions

2
FAQ.md
View File

@ -2789,6 +2789,8 @@ This means that messages with multiple labels will be shown multiple times as we
A lot of knowledge and experience is required to successfully develop an app for a specific platform,
which is why I develop apps for Android only.
You can install FairEmail on recent Windows versions, though, see [here](#user-content-faq185), and also on ChromeOS via the Play Store.
<br />
<a name="faq76"></a>

View File

@ -66,17 +66,14 @@ public class CloudSync {
if (responses.size() == 1)
return responses.get(0);
else {
int count = 0;
JSONArray jall = new JSONArray();
for (JSONObject response : responses) {
JSONArray jitems = response.getJSONArray("items");
for (int i = 0; i < jitems.length(); i++)
jall.put(jitems.getJSONObject(i));
count += response.optInt("count", 0);
}
JSONObject jresponse = responses.get(0);
jresponse.put("items", jall);
jresponse.put("count", count);
return jresponse;
}
}
@ -114,7 +111,7 @@ public class CloudSync {
JSONArray jitems = jrequest.getJSONArray("items");
for (int i = 0; i < jitems.length(); i++) {
JSONObject jitem = jitems.getJSONObject(i);
int revision = jitem.getInt("rev");
long revision = jitem.getLong("rev");
String k = jitem.getString("key");
jitem.put("key", transform(k, key.second, null, true));
@ -181,7 +178,7 @@ public class CloudSync {
JSONArray jitems = jresponse.getJSONArray("items");
for (int i = 0; i < jitems.length(); i++) {
JSONObject jitem = jitems.getJSONObject(i);
int revision = jitem.getInt("rev");
long revision = jitem.getLong("rev");
String ekey = jitem.getString("key");
String k = transform(ekey, key.second, null, false);
@ -219,10 +216,10 @@ public class CloudSync {
Arrays.copyOfRange(encoded, half, half + half));
}
private static byte[] getAd(String key, int revision) throws NoSuchAlgorithmException {
private static byte[] getAd(String key, long revision) throws NoSuchAlgorithmException {
byte[] k = MessageDigest.getInstance("SHA256").digest(key.getBytes());
byte[] ad = ByteBuffer.allocate(4 + 8)
.putInt(revision)
byte[] ad = ByteBuffer.allocate(8 + 8)
.putLong(revision)
.put(Arrays.copyOfRange(k, 0, 8))
.array();
return ad;

View File

@ -1540,7 +1540,7 @@ public class FragmentOptionsBackup extends FragmentBase implements SharedPrefere
if ("sync".equals(command)) {
DB db = DB.getInstance(context);
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
int sync_status = prefs.getInt("sync_status", 0);
long sync_status = prefs.getLong("sync_status", new Date().getTime());
JSONObject jsyncstatus = new JSONObject();
jsyncstatus.put("key", "sync.status");
@ -1579,7 +1579,7 @@ public class FragmentOptionsBackup extends FragmentBase implements SharedPrefere
JSONObject jitem = new JSONObject();
jitem.put("key", "identity." + identity.uuid);
jitem.put("val", identity.toJSON().toString());
jitem.put("rev", 1);
jitem.put("rev", 1L);
jupload.put(jitem);
}
@ -1590,7 +1590,7 @@ public class FragmentOptionsBackup extends FragmentBase implements SharedPrefere
JSONObject jitem = new JSONObject();
jitem.put("key", "account." + account.uuid);
jitem.put("val", jaccountdata.toString());
jitem.put("rev", 1);
jitem.put("rev", 1L);
jupload.put(jitem);
}
@ -1602,18 +1602,18 @@ public class FragmentOptionsBackup extends FragmentBase implements SharedPrefere
jsyncstatus.put("key", "sync.status");
jsyncstatus.put("val", jstatus.toString());
jsyncstatus.put("rev", 1);
jsyncstatus.put("rev", 1L);
jupload.put(jsyncstatus);
jrequest.put("items", jupload);
CloudSync.perform(context, user, password, "write", jrequest);
prefs.edit().putInt("sync_status", 1).apply();
prefs.edit().putLong("sync_status", 1L).apply();
return null;
} else if (jitems.length() == 1) {
JSONObject jitem = jitems.getJSONObject(0);
int rev = jitem.getInt("rev");
long rev = jitem.getLong("rev");
Log.i("Cloud status revision=" + rev + "/" + sync_status);
if (BuildConfig.DEBUG)
@ -1650,7 +1650,7 @@ public class FragmentOptionsBackup extends FragmentBase implements SharedPrefere
for (int i = 0; i < jitems.length(); i++) {
JSONObject jaccount = jitems.getJSONObject(i);
String value = jaccount.getString("val");
int revision = jaccount.getInt("rev");
long revision = jaccount.getLong("rev");
JSONObject jaccountdata = new JSONObject(value);
EntityAccount raccount = EntityAccount.fromJSON(jaccountdata.getJSONObject("account"));
@ -1682,7 +1682,7 @@ public class FragmentOptionsBackup extends FragmentBase implements SharedPrefere
for (int i = 0; i < jitems.length(); i++) {
JSONObject jaccount = jitems.getJSONObject(i);
String value = jaccount.getString("val");
int revision = jaccount.getInt("rev");
long revision = jaccount.getLong("rev");
EntityIdentity ridentity = EntityIdentity.fromJSON(new JSONObject(value));
EntityIdentity lidentity = db.identity().getIdentityByUUID(ridentity.uuid);
Log.i("Cloud identity " + ridentity.uuid + "=" + (lidentity == null ? "insert" : "update") +
@ -1692,7 +1692,7 @@ public class FragmentOptionsBackup extends FragmentBase implements SharedPrefere
}
}
prefs.edit().putInt("sync_status", rev).apply();
prefs.edit().putLong("sync_status", rev).apply();
} else
throw new IllegalArgumentException("Expected one status item");
} else