From 147682a0e5ac2ac8e1d3b4fef62415ef3109fa24 Mon Sep 17 00:00:00 2001 From: Benoit Martins Date: Fri, 19 Sep 2025 11:15:18 +0200 Subject: [PATCH] Disable push notifications when pushNotificationAllowed is false --- Linphone/Core/CoreContext.swift | 3 ++- .../UI/Assistant/Viewmodel/AccountLoginViewModel.swift | 7 +++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Linphone/Core/CoreContext.swift b/Linphone/Core/CoreContext.swift index 9d1cf6dc3..0d55e6f72 100644 --- a/Linphone/Core/CoreContext.swift +++ b/Linphone/Core/CoreContext.swift @@ -146,7 +146,8 @@ class CoreContext: ObservableObject { self.mCore = try? Factory.Instance.createSharedCoreWithConfig(config: Config.get(), systemContext: Unmanaged.passUnretained(coreQueue).toOpaque(), appGroupId: Config.appGroupName, mainCore: true) self.mCore.callkitEnabled = true - self.mCore.pushNotificationEnabled = true + + self.mCore.pushNotificationEnabled = self.mCore.defaultAccount?.params?.pushNotificationAllowed ?? false let appName = Bundle.main.infoDictionary?["CFBundleName"] as? String let version = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String diff --git a/Linphone/UI/Assistant/Viewmodel/AccountLoginViewModel.swift b/Linphone/UI/Assistant/Viewmodel/AccountLoginViewModel.swift index 630f19b4b..a6a5d2194 100644 --- a/Linphone/UI/Assistant/Viewmodel/AccountLoginViewModel.swift +++ b/Linphone/UI/Assistant/Viewmodel/AccountLoginViewModel.swift @@ -107,8 +107,11 @@ class AccountLoginViewModel: ObservableObject { try accountParams.setServeraddress(newValue: address) // And we ensure the account will start the registration process accountParams.registerEnabled = true - accountParams.pushNotificationAllowed = true - accountParams.remotePushNotificationAllowed = true + + if accountParams.pushNotificationAllowed { + accountParams.pushNotificationAllowed = true + accountParams.remotePushNotificationAllowed = true + } #if DEBUG let pushEnvironment = ".dev" #else