Skip to content

Commit c7425ee

Browse files
committed
fix: Add foreground check before stopping node in deliver()
1 parent 4982d50 commit c7425ee

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

app/src/main/java/to/bitkit/fcm/WakeNodeWorker.kt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,14 @@ class WakeNodeWorker @AssistedInject constructor(
239239
}
240240

241241
private suspend fun deliver() {
242-
lightningRepo.stop()
242+
// Only stop node if app is not in foreground
243+
// LightningNodeService will keep node running in background when notifications are enabled
244+
if (App.currentActivity?.value == null) {
245+
Logger.debug("App in background, stopping node after notification delivery", context = TAG)
246+
lightningRepo.stop()
247+
} else {
248+
Logger.debug("App in foreground, keeping node running", context = TAG)
249+
}
243250

244251
bestAttemptContent?.run {
245252
appContext.pushNotification(title, body)

0 commit comments

Comments
 (0)