Set default internationalPrefix to 33 // FRA, and use it for calls and chat

This commit is contained in:
QuentinArguillere 2024-11-29 17:10:30 +01:00 committed by Benoit Martins
parent 9421135fac
commit 97f5a2270d
2 changed files with 17 additions and 3 deletions

View file

@ -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
}

View file

@ -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)