Fixed quit button not killing app when background mode is enabled

This commit is contained in:
Sylvain Berfini 2022-02-10 10:08:11 +01:00
parent 69d7bff9a5
commit 4226dd6d5c
2 changed files with 4 additions and 8 deletions

View file

@ -31,7 +31,6 @@ import androidx.lifecycle.lifecycleScope
import java.io.File
import kotlinx.coroutines.launch
import org.linphone.LinphoneApplication.Companion.coreContext
import org.linphone.LinphoneApplication.Companion.corePreferences
import org.linphone.R
import org.linphone.activities.GenericFragment
import org.linphone.activities.assistant.AssistantActivity
@ -113,12 +112,9 @@ class SideMenuFragment : GenericFragment<SideMenuFragmentBinding>() {
Log.i("[Side Menu] Quitting app")
requireActivity().finishAndRemoveTask()
if (!corePreferences.keepServiceAlive) {
Log.i("[Side Menu] Stopping Core")
coreContext.stop()
} else {
Log.w("[Side Menu] Keep Service alive setting enabled, don't destroy the Core")
}
Log.i("[Side Menu] Stopping Core Context")
coreContext.notificationsManager.stopForegroundNotification()
coreContext.stop()
}
onBackPressedCallback.isEnabled = false

View file

@ -342,7 +342,7 @@ class NotificationsManager(private val context: Context) {
}
}
private fun stopForegroundNotification() {
fun stopForegroundNotification() {
if (service != null) {
Log.i("[Notifications Manager] Stopping service as foreground [$currentForegroundServiceNotificationId]")
service?.stopForeground(true)