mirror of
https://github.com/nextcloud/android.git
synced 2024-12-20 07:52:18 +03:00
add Constraints
Signed-off-by: alperozturk <alper_ozturk@proton.me>
This commit is contained in:
parent
4f7dde0b17
commit
b2b87a831e
1 changed files with 6 additions and 0 deletions
|
@ -720,6 +720,11 @@ internal class BackgroundJobManagerImpl(
|
||||||
val tag = getSyncFolderTag(folderId)
|
val tag = getSyncFolderTag(folderId)
|
||||||
val filePaths = files.map { it.decryptedRemotePath }
|
val filePaths = files.map { it.decryptedRemotePath }
|
||||||
|
|
||||||
|
val constraints = Constraints.Builder()
|
||||||
|
.setRequiredNetworkType(NetworkType.CONNECTED)
|
||||||
|
.setRequiresStorageNotLow(true)
|
||||||
|
.build()
|
||||||
|
|
||||||
val data = Data.Builder()
|
val data = Data.Builder()
|
||||||
.putStringArray(SyncWorker.FILE_PATHS, filePaths.toTypedArray())
|
.putStringArray(SyncWorker.FILE_PATHS, filePaths.toTypedArray())
|
||||||
.build()
|
.build()
|
||||||
|
@ -727,6 +732,7 @@ internal class BackgroundJobManagerImpl(
|
||||||
val request = oneTimeRequestBuilder(SyncWorker::class, JOB_SYNC_FOLDER)
|
val request = oneTimeRequestBuilder(SyncWorker::class, JOB_SYNC_FOLDER)
|
||||||
.addTag(tag)
|
.addTag(tag)
|
||||||
.setInputData(data)
|
.setInputData(data)
|
||||||
|
.setConstraints(constraints)
|
||||||
.build()
|
.build()
|
||||||
|
|
||||||
workManager.enqueueUniqueWork(JOB_SYNC_FOLDER, ExistingWorkPolicy.REPLACE, request)
|
workManager.enqueueUniqueWork(JOB_SYNC_FOLDER, ExistingWorkPolicy.REPLACE, request)
|
||||||
|
|
Loading…
Reference in a new issue