1
0
Fork 0
mirror of https://github.com/syncthing/syncthing-android.git synced 2024-11-29 15:51:17 +00:00

Hourly sync - Sync immediately when app starts (fixes #393) (#411)

This commit is contained in:
Catfriend1 2019-04-27 10:49:51 +02:00 committed by GitHub
parent 0ca5d851f2
commit eb35171286
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -100,8 +100,9 @@ public class RunConditionMonitor {
* Only relevant if the user has enabled turning Syncthing on by * Only relevant if the user has enabled turning Syncthing on by
* time schedule for a specific amount of time periodically. * time schedule for a specific amount of time periodically.
* Holds true if we are within a "SyncthingNative should run" time frame. * 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 @Inject
SharedPreferences mPreferences; SharedPreferences mPreferences;
@ -165,7 +166,11 @@ public class RunConditionMonitor {
updateShouldRunDecision(); updateShouldRunDecision();
// Initially schedule the SyncTrigger job. // 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() { public void shutdown() {