Improve code again
This commit is contained in:
parent
477b15428e
commit
a40988894b
7 changed files with 48 additions and 35 deletions
|
|
@ -27,16 +27,14 @@ class DefaultWorkManagerScheduler(
|
|||
private val workManager by lazy { WorkManager.getInstance(context) }
|
||||
|
||||
override fun submit(workManagerRequest: WorkManagerRequest) {
|
||||
workManagerRequest.build().forEach {
|
||||
it.fold(
|
||||
onSuccess = { workRequest ->
|
||||
workManager.enqueue(workRequest)
|
||||
},
|
||||
onFailure = {
|
||||
Timber.e(it, "Failed to build WorkManager request $workManagerRequest")
|
||||
}
|
||||
)
|
||||
}
|
||||
workManagerRequest.build().fold(
|
||||
onSuccess = { workRequests ->
|
||||
workManager.enqueue(workRequests)
|
||||
},
|
||||
onFailure = {
|
||||
Timber.e(it, "Failed to build WorkManager request $workManagerRequest")
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
override fun cancel(sessionId: SessionId) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue