mirror of
https://github.com/nextcloud/android.git
synced 2024-11-25 14:45:47 +03:00
schedule two-way-sync via isTwoWaySyncEnabled
Signed-off-by: alperozturk <alper_ozturk@proton.me>
This commit is contained in:
parent
832a63b5a6
commit
488589d2a7
4 changed files with 16 additions and 1 deletions
|
@ -171,4 +171,5 @@ interface BackgroundJobManager {
|
|||
fun startOfflineOperations()
|
||||
fun startPeriodicallyOfflineOperation()
|
||||
fun scheduleInternal2WaySync(intervalMinutes: Long)
|
||||
fun cancelInternal2WaySyncJob()
|
||||
}
|
||||
|
|
|
@ -707,4 +707,8 @@ internal class BackgroundJobManagerImpl(
|
|||
|
||||
workManager.enqueueUniquePeriodicWork(JOB_INTERNAL_TWO_WAY_SYNC, ExistingPeriodicWorkPolicy.UPDATE, request)
|
||||
}
|
||||
|
||||
override fun cancelInternal2WaySyncJob() {
|
||||
workManager.cancelJob(JOB_INTERNAL_TWO_WAY_SYNC)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -375,7 +375,11 @@ public class MainApp extends Application implements HasAndroidInjector, NetworkC
|
|||
backgroundJobManager.scheduleMediaFoldersDetectionJob();
|
||||
backgroundJobManager.startMediaFoldersDetectionJob();
|
||||
backgroundJobManager.schedulePeriodicHealthStatus();
|
||||
backgroundJobManager.scheduleInternal2WaySync(preferences.getTwoWaySyncInterval());
|
||||
|
||||
if (preferences.isTwoWaySyncEnabled()) {
|
||||
backgroundJobManager.scheduleInternal2WaySync(preferences.getTwoWaySyncInterval());
|
||||
}
|
||||
|
||||
backgroundJobManager.startPeriodicallyOfflineOperation();
|
||||
}
|
||||
|
||||
|
|
|
@ -79,6 +79,12 @@ class InternalTwoWaySyncActivity : BaseActivity(), Injectable {
|
|||
preferences.setTwoWaySyncStatus(isChecked)
|
||||
setupList()
|
||||
setVisibilities()
|
||||
|
||||
if (isChecked) {
|
||||
backgroundJobManager.scheduleInternal2WaySync(preferences.twoWaySyncInterval)
|
||||
} else {
|
||||
backgroundJobManager.cancelInternal2WaySyncJob()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue