File tree Expand file tree Collapse file tree 1 file changed +6
-0
lines changed
app/src/main/java/to/bitkit/fcm Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ import androidx.work.WorkerParameters
77import androidx.work.workDataOf
88import dagger.assisted.Assisted
99import dagger.assisted.AssistedInject
10+ import kotlinx.coroutines.CancellationException
1011import kotlinx.coroutines.CompletableDeferred
1112import kotlinx.coroutines.delay
1213import kotlinx.coroutines.flow.first
@@ -109,6 +110,11 @@ class WakeNodeWorker @AssistedInject constructor(
109110 .fold(
110111 onSuccess = { Result .success() },
111112 onFailure = { e ->
113+ if (e is CancellationException ) {
114+ Logger .debug(" Work cancelled" , context = TAG )
115+ return @fold Result .failure(workDataOf(" Reason" to " Cancelled" ))
116+ }
117+
112118 val reason = e.message ? : appContext.getString(R .string.common__error_body)
113119
114120 bestAttemptContent = NotificationDetails (
You can’t perform that action at this time.
0 commit comments