From eb3517128632718466cf3bbd958f4129e741cf07 Mon Sep 17 00:00:00 2001 From: Catfriend1 Date: Sat, 27 Apr 2019 10:49:51 +0200 Subject: [PATCH] Hourly sync - Sync immediately when app starts (fixes #393) (#411) --- .../syncthingandroid/service/RunConditionMonitor.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/nutomic/syncthingandroid/service/RunConditionMonitor.java b/app/src/main/java/com/nutomic/syncthingandroid/service/RunConditionMonitor.java index 78bdd2ea..7fbda59d 100644 --- a/app/src/main/java/com/nutomic/syncthingandroid/service/RunConditionMonitor.java +++ b/app/src/main/java/com/nutomic/syncthingandroid/service/RunConditionMonitor.java @@ -100,8 +100,9 @@ public class RunConditionMonitor { * Only relevant if the user has enabled turning Syncthing on by * time schedule for a specific amount of time periodically. * Holds true if we are within a "SyncthingNative should run" time frame. + * Initial status true because we like to sync on app start, too. */ - private Boolean mTimeConditionMatch = false; + private Boolean mTimeConditionMatch = true; @Inject SharedPreferences mPreferences; @@ -165,7 +166,11 @@ public class RunConditionMonitor { updateShouldRunDecision(); // Initially schedule the SyncTrigger job. - JobUtils.scheduleSyncTriggerServiceJob(context, Constants.WAIT_FOR_NEXT_SYNC_DELAY_SECS); + JobUtils.scheduleSyncTriggerServiceJob(context, + mTimeConditionMatch ? + Constants.TRIGGERED_SYNC_DURATION_SECS : + Constants.WAIT_FOR_NEXT_SYNC_DELAY_SECS + ); } public void shutdown() {