Skip to content

Commit dbbe138

Browse files
committed
fix: remove app from recents when stopped via notif button
1 parent 673df9f commit dbbe138

File tree

2 files changed

+1
-15
lines changed

2 files changed

+1
-15
lines changed

app/src/main/java/to/bitkit/App.kt

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -55,18 +55,4 @@ class CurrentActivity : ActivityLifecycleCallbacks {
5555
override fun onActivitySaveInstanceState(activity: Activity, bundle: Bundle) = Unit
5656
override fun onActivityDestroyed(activity: Activity) = Unit
5757
}
58-
59-
/**
60-
* Returns the current activity of the application.
61-
*
62-
* **NEVER** store the result to a variable, further calls to such reference can lead to memory leaks.
63-
*
64-
* **ALWAYS** retrieve the current activity functionally, processing on the result of this function.
65-
* */
66-
internal inline fun <reified T> currentActivity(): T? {
67-
return when (val activity = App.currentActivity?.value) {
68-
is T -> activity
69-
else -> null
70-
}
71-
}
7258
// endregion

app/src/main/java/to/bitkit/androidServices/LightningNodeService.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ class LightningNodeService : Service() {
101101
ACTION_STOP_SERVICE_AND_APP -> {
102102
Logger.debug("ACTION_STOP_SERVICE_AND_APP detected", context = TAG)
103103
// Close all activities
104-
App.currentActivity?.value?.finishAffinity()
104+
App.currentActivity?.value?.finishAndRemoveTask()
105105
// Stop the service
106106
stopSelf()
107107
return START_NOT_STICKY

0 commit comments

Comments
 (0)