From 2b0ae30dbc13b87aae02cb3427aa527164494fcf Mon Sep 17 00:00:00 2001 From: jvsena42 Date: Thu, 22 Jan 2026 14:55:23 -0300 Subject: [PATCH] fix: don't notify cancelation exception --- app/src/main/java/to/bitkit/fcm/WakeNodeWorker.kt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/src/main/java/to/bitkit/fcm/WakeNodeWorker.kt b/app/src/main/java/to/bitkit/fcm/WakeNodeWorker.kt index a3a12243b..7702122f1 100644 --- a/app/src/main/java/to/bitkit/fcm/WakeNodeWorker.kt +++ b/app/src/main/java/to/bitkit/fcm/WakeNodeWorker.kt @@ -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 @@ -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(