Cloud sync: require network connection

pull/212/head
M66B 2 years ago
parent bb8e7950dc
commit df90d4fe0d

@ -5176,7 +5176,7 @@ To activate a cloud sync account, use the *Activate* button to send an email to
The email needs to come from an address used to activate the pro features before. The email needs to come from an address used to activate the pro features before.
You'll receive an email in response indicating whether the activation was succesful or not. You'll receive an email in response indicating whether the activation was succesful or not.
The app will automatically synchronize once a day around 1:30am, but you can manually synchronize too. The app will automatically synchronize once a day around 1:30am, provided that there is an internet connection, but you can manually synchronize too.
Synchronization will currently add and update enabled accounts and identities only, Synchronization will currently add and update enabled accounts and identities only,
but on the roadmap is synchronizing blocked senders and filter rules too. but on the roadmap is synchronizing blocked senders and filter rules too.

@ -27,7 +27,9 @@ import android.text.TextUtils;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.preference.PreferenceManager; import androidx.preference.PreferenceManager;
import androidx.work.Constraints;
import androidx.work.ExistingPeriodicWorkPolicy; import androidx.work.ExistingPeriodicWorkPolicy;
import androidx.work.NetworkType;
import androidx.work.PeriodicWorkRequest; import androidx.work.PeriodicWorkRequest;
import androidx.work.WorkManager; import androidx.work.WorkManager;
import androidx.work.Worker; import androidx.work.Worker;
@ -90,7 +92,9 @@ public class WorkerSync extends Worker {
"Queuing " + getName() + " delay=" + (delay / (60 * 1000L)) + "m"); "Queuing " + getName() + " delay=" + (delay / (60 * 1000L)) + "m");
PeriodicWorkRequest.Builder builder = PeriodicWorkRequest.Builder builder =
new PeriodicWorkRequest.Builder(WorkerSync.class, 1, TimeUnit.DAYS) new PeriodicWorkRequest.Builder(WorkerSync.class, 1, TimeUnit.DAYS)
.setInitialDelay(delay, TimeUnit.MILLISECONDS); .setInitialDelay(delay, TimeUnit.MILLISECONDS)
.setConstraints(new Constraints.Builder()
.setRequiredNetworkType(NetworkType.CONNECTED).build());
WorkManager.getInstance(context) WorkManager.getInstance(context)
.enqueueUniquePeriodicWork(getName(), ExistingPeriodicWorkPolicy.KEEP, builder.build()); .enqueueUniquePeriodicWork(getName(), ExistingPeriodicWorkPolicy.KEEP, builder.build());
Log.i("Queued " + getName()); Log.i("Queued " + getName());

Loading…
Cancel
Save