mirror of
https://github.com/InsanusMokrassar/krontab.git
synced 2026-04-25 09:32:31 +00:00
update result checker in KronSchedulerWork
This commit is contained in:
@@ -8,3 +8,14 @@ internal fun ListenableWorker.Result.isSuccess() = this is ListenableWorker.Resu
|
||||
|
||||
@SuppressLint("RestrictedApi")
|
||||
internal fun ListenableWorker.Result.isFailure() = this is ListenableWorker.Result.Failure
|
||||
|
||||
@SuppressLint("RestrictedApi")
|
||||
internal inline fun ListenableWorker.Result.checkResults(
|
||||
onFailure: () -> Unit,
|
||||
onSuccess: () -> Unit
|
||||
) {
|
||||
when (this) {
|
||||
is ListenableWorker.Result.Failure -> onFailure()
|
||||
is ListenableWorker.Result.Success -> onSuccess()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user