From 97f5a2270dba10ff23e17740227c7121a49b0fb3 Mon Sep 17 00:00:00 2001 From: QuentinArguillere Date: Fri, 29 Nov 2024 17:10:30 +0100 Subject: [PATCH] Set default internationalPrefix to 33 // FRA, and use it for calls and chat --- Linphone/Core/CoreContext.swift | 16 +++++++++++++--- .../Viewmodel/AccountLoginViewModel.swift | 4 ++++ 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/Linphone/Core/CoreContext.swift b/Linphone/Core/CoreContext.swift index 2d0deb5b3..f1e6fe8c9 100644 --- a/Linphone/Core/CoreContext.swift +++ b/Linphone/Core/CoreContext.swift @@ -187,10 +187,20 @@ final class CoreContext: ObservableObject { #else let pushEnvironment = "" #endif - for account in core.accountList where account.params?.pushNotificationConfig?.provider != ("apns" + pushEnvironment) { + for account in core.accountList { + let newParams = account.params?.clone() - Log.info("Account \(String(describing: newParams?.identityAddress?.asStringUriOnly())) - updating apple push provider from \(String(describing: newParams?.pushNotificationConfig?.provider)) to apns\(pushEnvironment)") - newParams?.pushNotificationConfig?.provider = "apns" + pushEnvironment + if account.params?.pushNotificationConfig?.provider != ("apns" + pushEnvironment) { + Log.info("Account \(String(describing: newParams?.identityAddress?.asStringUriOnly())) - updating apple push provider from \(String(describing: newParams?.pushNotificationConfig?.provider)) to apns\(pushEnvironment)") + newParams?.pushNotificationConfig?.provider = "apns" + pushEnvironment + } + + if account.params?.internationalPrefix == nil { + Log.info("Account \(account.displayName()): no international prefix set, adding 33 FRA by default: \(account.params?.internationalPrefix ?? "NIL")") + newParams?.internationalPrefix = "33" + newParams?.internationalPrefixIsoCountryCode = "FRA" + newParams?.useInternationalPrefixForCallsAndChats = true + } account.params = newParams } diff --git a/Linphone/UI/Assistant/Viewmodel/AccountLoginViewModel.swift b/Linphone/UI/Assistant/Viewmodel/AccountLoginViewModel.swift index ebebd6c32..b442f3632 100644 --- a/Linphone/UI/Assistant/Viewmodel/AccountLoginViewModel.swift +++ b/Linphone/UI/Assistant/Viewmodel/AccountLoginViewModel.swift @@ -114,6 +114,10 @@ class AccountLoginViewModel: ObservableObject { #endif accountParams.pushNotificationConfig?.provider = "apns" + pushEnvironment + accountParams.internationalPrefix = "33" + accountParams.internationalPrefixIsoCountryCode = "FRA" + accountParams.useInternationalPrefixForCallsAndChats = true + // Now that our AccountParams is configured, we can create the Account object let account = try core.createAccount(params: accountParams)