Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions app/src/main/java/to/bitkit/fcm/WakeNodeWorker.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import androidx.work.WorkerParameters
import androidx.work.workDataOf
import dagger.assisted.Assisted
import dagger.assisted.AssistedInject
import kotlinx.coroutines.CancellationException
import kotlinx.coroutines.CompletableDeferred
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.first
Expand Down Expand Up @@ -109,6 +110,11 @@ class WakeNodeWorker @AssistedInject constructor(
.fold(
onSuccess = { Result.success() },
onFailure = { e ->
if (e is CancellationException) {
Logger.debug("Work cancelled", context = TAG)
return@fold Result.failure(workDataOf("Reason" to "Cancelled"))
}

val reason = e.message ?: appContext.getString(R.string.common__error_body)

bestAttemptContent = NotificationDetails(
Expand Down
Loading