From cba7621413c3000eb306b1bef3cee5d1adb6c8b8 Mon Sep 17 00:00:00 2001 From: Benoit Martins Date: Thu, 26 Jun 2025 10:27:26 +0200 Subject: [PATCH] Set publishEnabled to false by default in app extension, and enable it on main app --- Linphone/Core/CoreContext.swift | 8 ++++++++ msgNotificationService/NotificationService.swift | 7 +++++++ 2 files changed, 15 insertions(+) diff --git a/Linphone/Core/CoreContext.swift b/Linphone/Core/CoreContext.swift index 7e279cfef..943ca4dc2 100644 --- a/Linphone/Core/CoreContext.swift +++ b/Linphone/Core/CoreContext.swift @@ -306,6 +306,14 @@ class CoreContext: ObservableObject { NotificationCenter.default.post(name: NSNotification.Name("CoreStarted"), object: nil) } ContactsManager.shared.fetchContacts() + + if let defaultAccountParams = self.mCore.defaultAccount?.params, defaultAccountParams.publishEnabled == false { + let params = defaultAccountParams + let clonedParams = params.clone() + clonedParams?.publishEnabled = true + self.mCore.defaultAccount?.params = clonedParams + } + if self.mCore.consolidatedPresence != ConsolidatedPresence.Online { self.updatePresence(core: self.mCore, presence: ConsolidatedPresence.Online) } diff --git a/msgNotificationService/NotificationService.swift b/msgNotificationService/NotificationService.swift index 557701382..62eec577f 100644 --- a/msgNotificationService/NotificationService.swift +++ b/msgNotificationService/NotificationService.swift @@ -99,6 +99,13 @@ class NotificationService: UNNotificationServiceExtension { createCore() // if !lc!.config!.getBool(section: "app", key: "disable_chat_feature", defaultValue: false) { Log.info("received push payload : \(bestAttemptContent.userInfo.debugDescription)") + + if let defaultAccountParams = lc?.defaultAccount?.params, defaultAccountParams.publishEnabled == true { + let params = defaultAccountParams + let clonedParams = params.clone() + clonedParams?.publishEnabled = false + lc?.defaultAccount?.params = clonedParams + } /* let defaults = UserDefaults.init(suiteName: Config.appGroupName)