mirror of
https://github.com/M66B/FairEmail.git
synced 2026-03-29 21:34:44 +02:00
Cloud sync: switches for send/receive
This commit is contained in:
@@ -215,6 +215,12 @@ public class CloudSync {
|
||||
throws JSONException, GeneralSecurityException, IOException {
|
||||
DB db = DB.getInstance(context);
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
boolean cloud_send = prefs.getBoolean("cloud_send", true);
|
||||
|
||||
if (!cloud_send) {
|
||||
Log.w("Cloud skip send");
|
||||
return;
|
||||
}
|
||||
|
||||
List<EntityAccount> accounts = db.account().getSynchronizingAccounts(null);
|
||||
Log.i("Cloud accounts=" + (accounts == null ? null : accounts.size()));
|
||||
@@ -299,6 +305,12 @@ public class CloudSync {
|
||||
throws JSONException, GeneralSecurityException, IOException {
|
||||
DB db = DB.getInstance(context);
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
boolean cloud_receive = prefs.getBoolean("cloud_receive", true);
|
||||
|
||||
if (!cloud_receive) {
|
||||
Log.w("Cloud skip receive");
|
||||
return;
|
||||
}
|
||||
|
||||
// New revision
|
||||
boolean updates = false;
|
||||
@@ -416,10 +428,12 @@ public class CloudSync {
|
||||
db.account().resetPrimary();
|
||||
db.account().setAccountPrimary(raccount.id, true);
|
||||
}
|
||||
db.account().setLastModified(raccount.id, rrevision);
|
||||
db.account().setAccountLastModified(raccount.id, rrevision);
|
||||
}
|
||||
|
||||
db.setTransactionSuccessful();
|
||||
|
||||
updates = true;
|
||||
} finally {
|
||||
db.endTransaction();
|
||||
}
|
||||
@@ -474,6 +488,14 @@ public class CloudSync {
|
||||
db.identity().updateIdentity(ridentity);
|
||||
}
|
||||
|
||||
if (ridentity.id != null) {
|
||||
if (ridentity.primary) {
|
||||
db.identity().resetPrimary(ridentity.account);
|
||||
db.identity().setIdentityPrimary(ridentity.id, true);
|
||||
}
|
||||
db.identity().setIdentityLastModified(ridentity.id, rrevision);
|
||||
}
|
||||
|
||||
db.setTransactionSuccessful();
|
||||
} finally {
|
||||
db.endTransaction();
|
||||
|
||||
Reference in New Issue
Block a user