mirror of
https://github.com/InsanusMokrassar/krontab.git
synced 2025-12-05 12:35:47 +00:00
16 lines
392 B
Kotlin
16 lines
392 B
Kotlin
package dev.inmo.krontab
|
|
|
|
import android.annotation.SuppressLint
|
|
import androidx.work.ListenableWorker
|
|
|
|
@SuppressLint("RestrictedApi")
|
|
internal inline fun ListenableWorker.Result.checkResults(
|
|
onFailure: () -> Unit,
|
|
onSuccess: () -> Unit
|
|
) {
|
|
when (this) {
|
|
is ListenableWorker.Result.Failure -> onFailure()
|
|
is ListenableWorker.Result.Success -> onSuccess()
|
|
}
|
|
}
|