From 8a3ed45c0c6fb025458b417b1a01708547554768 Mon Sep 17 00:00:00 2001 From: M66B Date: Sun, 15 Jan 2023 22:01:51 +0100 Subject: [PATCH] Updated FAQ --- FAQ.md | 2 ++ .../main/java/eu/faircode/email/CloudSync.java | 13 +++++-------- .../faircode/email/FragmentOptionsBackup.java | 18 +++++++++--------- 3 files changed, 16 insertions(+), 17 deletions(-) diff --git a/FAQ.md b/FAQ.md index 80b1186d1c..0895d885ea 100644 --- a/FAQ.md +++ b/FAQ.md @@ -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. +
diff --git a/app/src/main/java/eu/faircode/email/CloudSync.java b/app/src/main/java/eu/faircode/email/CloudSync.java index c7b6802b26..c622c069b7 100644 --- a/app/src/main/java/eu/faircode/email/CloudSync.java +++ b/app/src/main/java/eu/faircode/email/CloudSync.java @@ -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; diff --git a/app/src/main/java/eu/faircode/email/FragmentOptionsBackup.java b/app/src/main/java/eu/faircode/email/FragmentOptionsBackup.java index 1d8f598f5c..3a45ddeda3 100644 --- a/app/src/main/java/eu/faircode/email/FragmentOptionsBackup.java +++ b/app/src/main/java/eu/faircode/email/FragmentOptionsBackup.java @@ -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