Start and stop core in sync queue

This commit is contained in:
Benoit Martins 2024-05-10 09:54:55 +02:00
parent ad58d80939
commit eeb8c94c69
3 changed files with 4 additions and 7 deletions

View file

@ -41,9 +41,7 @@ final class ContactsManager: ObservableObject {
private var friendListSuscription: AnyCancellable?
private init() {
fetchContacts()
}
private init() {}
func fetchContacts() {
coreContext.doOnCoreQueue { core in

View file

@ -247,8 +247,6 @@ final class CoreContext: ObservableObject {
.sink { _ in
self.mCore.iterate()
}
try? self.mCore.start()
}
}
@ -259,7 +257,7 @@ final class CoreContext: ObservableObject {
}
func onEnterForeground() {
coreQueue.async {
coreQueue.sync {
// We can't rely on defaultAccount?.params?.isPublishEnabled
// as it will be modified by the SDK when changing the presence status
@ -270,7 +268,7 @@ final class CoreContext: ObservableObject {
}
func onEnterBackground() {
coreQueue.async {
coreQueue.sync {
// 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")

View file

@ -144,6 +144,7 @@ struct LinphoneApp: App {
if newPhase == .active {
Log.info("Entering foreground")
coreContext.onEnterForeground()
ContactsManager.shared.fetchContacts()
} else if newPhase == .inactive {
} else if newPhase == .background {
Log.info("Entering background")