update result checker in KronSchedulerWork

This commit is contained in:
2024-08-12 23:25:23 +06:00
parent 3845f6e0c5
commit 552ec14d66
2 changed files with 19 additions and 7 deletions

View File

@@ -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()
}
}