mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-17 02:58:07 +00:00
Ensure core is On before stopping it on background entry
This commit is contained in:
parent
14635250f8
commit
a7e2ebb600
1 changed files with 8 additions and 10 deletions
|
|
@ -424,26 +424,24 @@ class CoreContext: ObservableObject {
|
|||
|
||||
func onEnterForeground() {
|
||||
coreQueue.async {
|
||||
// We can't rely on defaultAccount?.params?.isPublishEnabled
|
||||
// as it will be modified by the SDK when changing the presence status
|
||||
Log.info("[onEnterForegroundOrBackground] Entering foreground")
|
||||
|
||||
try? self.mCore.start()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
func onEnterBackground() {
|
||||
coreQueue.async {
|
||||
// We can't rely on defaultAccount?.params?.isPublishEnabled
|
||||
// as it will be modified by the SDK when changing the presence status
|
||||
Log.info("App is in background, un-PUBLISHING presence info")
|
||||
Log.info("[onEnterForegroundOrBackground] Entering background, un-PUBLISHING presence info")
|
||||
|
||||
// We don't use ConsolidatedPresence.Busy but Offline to do an unsubscribe,
|
||||
// Flexisip will handle the Busy status depending on other devices
|
||||
self.updatePresence(core: self.mCore, presence: ConsolidatedPresence.Offline)
|
||||
self.updatePresence(core: self.mCore, presence: .Offline)
|
||||
self.mCore.iterate()
|
||||
|
||||
if self.mCore.currentCall == nil {
|
||||
if self.mCore.currentCall == nil && self.mCore.globalState == .On {
|
||||
Log.info("[onEnterForegroundOrBackground] Stopping core because no active calls")
|
||||
self.mCore.stop()
|
||||
} else {
|
||||
Log.info("[onEnterForegroundOrBackground] Skipped stop: core not fully On or active call in progress")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue