Skip to content

Commit 8af25a3

Browse files
committed
fix: stop service in onDestroy if notifications are disabled
1 parent e07b58e commit 8af25a3

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

app/src/main/java/to/bitkit/ui/MainActivity.kt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,15 @@ class MainActivity : FragmentActivity() {
189189
appViewModel.handleDeeplinkIntent(intent)
190190
}
191191

192+
override fun onDestroy() {
193+
super.onDestroy()
194+
if (!settingsViewModel.notificationsGranted.value) {
195+
runCatching {
196+
stopService(Intent(this, LightningNodeService::class.java))
197+
}
198+
}
199+
}
200+
192201
/**
193202
* Attempts to start the LightningNodeService if it's not already running.
194203
*/

0 commit comments

Comments
 (0)