Added on demand sync setting

pull/169/head
M66B 6 years ago
parent 4c68973238
commit e85beb1b04

@ -1759,15 +1759,12 @@ Scheduling is a pro feature.
**(79) How do I use synchronize on demand (manual)?**
Normally, FairEmail maintains a connection to the configured email servers whenever possible to receive messages in real-time.
If you don't want this, for example to not be disturbed or to save on battery usage,
just disable synchronization in the advanced option (accessible via the button at the bottom of the setup screen).
If you don't want this, for example to be not disturbed or to save on battery usage, just disable receiving in the receive settings.
This will stop the background service which takes care of automatic synchronization and will remove the associated status bar notification.
You can use pull-down-to-refresh in a folder or use the folder menu *Synchronize now* to manually synchronize messages.
This will start the synchronization service for 60 seconds for all configured accounts.
The synchronization process will also be started to execute [operations](#user-content-faq3),
for example to mark a message read, move a message or store a draft.
This is to keep the local and remote message store synchronized.
You can also enable *Synchronize manually* in the advanced account settings if you want to manually synschronize specific accounts only.
You can use pull-down-to-refresh in a message list or use the folder menu *Synchronize now* to manually synchronize messages.
If you want to synchronize some or all folders of an account manually, just disable synchronization for the folders (but not of the account).

File diff suppressed because it is too large Load Diff

@ -56,7 +56,7 @@ import io.requery.android.database.sqlite.RequerySQLiteOpenHelperFactory;
// https://developer.android.com/topic/libraries/architecture/room.html
@Database(
version = 120,
version = 121,
entities = {
EntityIdentity.class,
EntityAccount.class,
@ -1169,6 +1169,13 @@ public abstract class DB extends RoomDatabase {
db.execSQL("ALTER TABLE `certificate` ADD COLUMN `before` INTEGER");
}
})
.addMigrations(new Migration(120, 121) {
@Override
public void migrate(@NonNull SupportSQLiteDatabase db) {
Log.i("DB migration from version " + startVersion + " to " + endVersion);
db.execSQL("UPDATE `account` SET ondemand = 0");
}
})
.build();
}

@ -85,7 +85,7 @@ public class EntityAccount extends EntityOrder implements Serializable {
@NonNull
public Boolean synchronize;
@NonNull
public Boolean ondemand = false; // obsolete
public Boolean ondemand = false;
@NonNull
public Boolean primary;
@NonNull

@ -94,6 +94,7 @@ public class FragmentAccount extends FragmentBase {
private Button btnAdvanced;
private CheckBox cbSynchronize;
private CheckBox cbOnDemand;
private CheckBox cbPrimary;
private CheckBox cbNotify;
private TextView tvNotifyPro;
@ -197,6 +198,7 @@ public class FragmentAccount extends FragmentBase {
btnAdvanced = view.findViewById(R.id.btnAdvanced);
cbSynchronize = view.findViewById(R.id.cbSynchronize);
cbOnDemand = view.findViewById(R.id.cbOnDemand);
cbPrimary = view.findViewById(R.id.cbPrimary);
cbNotify = view.findViewById(R.id.cbNotify);
tvNotifyPro = view.findViewById(R.id.tvNotifyPro);
@ -341,6 +343,7 @@ public class FragmentAccount extends FragmentBase {
cbSynchronize.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
cbOnDemand.setEnabled(checked);
cbPrimary.setEnabled(checked);
}
});
@ -701,6 +704,7 @@ public class FragmentAccount extends FragmentBase {
args.putInt("color", btnColor.getColor());
args.putBoolean("synchronize", cbSynchronize.isChecked());
args.putBoolean("ondemand", cbOnDemand.isChecked());
args.putBoolean("primary", cbPrimary.isChecked());
args.putBoolean("notify", cbNotify.isChecked());
args.putBoolean("browse", cbBrowse.isChecked());
@ -759,6 +763,7 @@ public class FragmentAccount extends FragmentBase {
Integer color = args.getInt("color");
boolean synchronize = args.getBoolean("synchronize");
boolean ondemand = args.getBoolean("ondemand");
boolean primary = args.getBoolean("primary");
boolean notify = args.getBoolean("notify");
boolean browse = args.getBoolean("browse");
@ -836,6 +841,8 @@ public class FragmentAccount extends FragmentBase {
return true;
if (!Objects.equals(account.synchronize, synchronize))
return true;
if (!Objects.equals(account.ondemand, ondemand))
return true;
if (!Objects.equals(account.primary, account.synchronize && primary))
return true;
if (!Objects.equals(account.notify, notify))
@ -963,6 +970,7 @@ public class FragmentAccount extends FragmentBase {
account.color = color;
account.synchronize = synchronize;
account.ondemand = ondemand;
account.primary = (account.synchronize && primary);
account.notify = notify;
account.browse = browse;
@ -1240,6 +1248,7 @@ public class FragmentAccount extends FragmentBase {
cbNotify.setEnabled(pro);
cbSynchronize.setChecked(account == null ? true : account.synchronize);
cbOnDemand.setChecked(account == null ? false : account.ondemand);
cbPrimary.setChecked(account == null ? false : account.primary);
cbBrowse.setChecked(account == null ? true : account.browse);
cbAutoSeen.setChecked(account == null ? true : account.auto_seen);
@ -1284,6 +1293,7 @@ public class FragmentAccount extends FragmentBase {
tilPassword.setEnabled(false);
}
cbOnDemand.setEnabled(cbSynchronize.isChecked());
cbPrimary.setEnabled(cbSynchronize.isChecked());
// Consider previous check/save/delete as cancelled

@ -49,7 +49,7 @@ public class TupleAccountState extends EntityAccount {
}
boolean isEnabled(boolean enabled) {
return (enabled && synchronize && folders > 0 && tbd == null);
return (enabled && synchronize && !ondemand && folders > 0 && tbd == null);
}
boolean shouldRun(boolean enabled) {

@ -375,6 +375,15 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/btnAdvanced" />
<CheckBox
android:id="@+id/cbOnDemand"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/title_account_ondemand"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/cbSynchronize" />
<CheckBox
android:id="@+id/cbPrimary"
android:layout_width="wrap_content"
@ -382,7 +391,7 @@
android:layout_marginTop="12dp"
android:text="@string/title_primary_account"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/cbSynchronize" />
app:layout_constraintTop_toBottomOf="@id/cbOnDemand" />
<CheckBox
android:id="@+id/cbNotify"
@ -874,7 +883,7 @@
android:layout_height="0dp"
app:constraint_referenced_ids="
cbNotify,tvNotifyPro,
cbSynchronize,cbPrimary,
cbSynchronize,cbOnDemand,cbPrimary,
cbBrowse,tvBrowseHint,
cbAutoSeen,
tvInterval,etInterval,tvIntervalRemark,

@ -432,6 +432,7 @@
<string name="title_account_partial_fetch_hint">Disable this only in case of empty messages or corrupt attachments</string>
<string name="title_account_signature">Signature text</string>
<string name="title_color">Color</string>
<string name="title_account_ondemand">Synchronize manually</string>
<string name="title_account_notify">Separate notifications</string>
<string name="title_account_left">Swipe left</string>
<string name="title_account_right">Swipe right</string>

Loading…
Cancel
Save