mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-17 02:58:07 +00:00
Fix international prefix reset in settings
This commit is contained in:
parent
aefa334038
commit
f8b7e3b319
2 changed files with 34 additions and 30 deletions
|
|
@ -64,7 +64,7 @@ class AccountProfileViewModel: ObservableObject {
|
|||
newParams?.internationalPrefix = self.dialPlanSelected?.countryCallingCode
|
||||
newParams?.internationalPrefixIsoCountryCode = self.dialPlanSelected?.isoCountryCode
|
||||
newParams?.useInternationalPrefixForCallsAndChats = true
|
||||
} else if newParams?.useInternationalPrefixForCallsAndChats == true {
|
||||
} else if self.dialPlanSelected == nil && newParams?.useInternationalPrefixForCallsAndChats == true {
|
||||
newParams?.internationalPrefix = nil
|
||||
newParams?.internationalPrefixIsoCountryCode = nil
|
||||
newParams?.useInternationalPrefixForCallsAndChats = false
|
||||
|
|
@ -75,18 +75,18 @@ class AccountProfileViewModel: ObservableObject {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
func setAvatarModel() {
|
||||
CoreContext.shared.doOnCoreQueue { _ in
|
||||
CoreContext.shared.accounts.forEach { accountTmp in
|
||||
let displayNameTmp = accountTmp.account.params?.identityAddress?.displayName ?? ""
|
||||
let contactAddressTmp = accountTmp.account.params?.identityAddress?.asStringUriOnly() ?? ""
|
||||
|
||||
let prefix = accountTmp.account.params?.internationalPrefix ?? ""
|
||||
let isoCountryCode = accountTmp.account.params?.internationalPrefixIsoCountryCode ?? ""
|
||||
|
||||
var dialPlanValueSelectedTmp = ""
|
||||
if !prefix.isEmpty || !isoCountryCode.isEmpty {
|
||||
|
||||
func setAvatarModel() {
|
||||
CoreContext.shared.doOnCoreQueue { _ in
|
||||
CoreContext.shared.accounts.forEach { accountTmp in
|
||||
let displayNameTmp = accountTmp.account.params?.identityAddress?.displayName ?? ""
|
||||
let contactAddressTmp = accountTmp.account.params?.identityAddress?.asStringUriOnly() ?? ""
|
||||
|
||||
let prefix = accountTmp.account.params?.internationalPrefix ?? ""
|
||||
let isoCountryCode = accountTmp.account.params?.internationalPrefixIsoCountryCode ?? ""
|
||||
|
||||
var dialPlanValueSelectedTmp = ""
|
||||
if !prefix.isEmpty || !isoCountryCode.isEmpty {
|
||||
Log.info(
|
||||
"\(AccountProfileViewModel.TAG) Account \(accountTmp.account.params?.identityAddress?.asStringUriOnly() ?? "") prefix is \(prefix) \(isoCountryCode)"
|
||||
)
|
||||
|
|
@ -101,32 +101,36 @@ class AccountProfileViewModel: ObservableObject {
|
|||
} else {
|
||||
dialPlanValueSelectedTmp = "No country code"
|
||||
}
|
||||
|
||||
let accountDisplayName = accountTmp.account.displayName()
|
||||
|
||||
self.updateDialPlan(newDialPlan: dialPlanValueSelectedTmp)
|
||||
|
||||
let accountDisplayName = accountTmp.account.displayName()
|
||||
|
||||
let defaultAccountModelIndexTmp = CoreContext.shared.accounts.firstIndex(where: {$0.isDefaultAccount})
|
||||
|
||||
DispatchQueue.main.async {
|
||||
accountTmp.avatarModel = ContactAvatarModel(
|
||||
friend: nil,
|
||||
name: displayNameTmp.isEmpty ? accountDisplayName : displayNameTmp,
|
||||
address: contactAddressTmp,
|
||||
withPresence: false
|
||||
)
|
||||
|
||||
self.defaultAccountModelIndex = defaultAccountModelIndexTmp
|
||||
DispatchQueue.main.async {
|
||||
accountTmp.avatarModel = ContactAvatarModel(
|
||||
friend: nil,
|
||||
name: displayNameTmp.isEmpty ? accountDisplayName : displayNameTmp,
|
||||
address: contactAddressTmp,
|
||||
withPresence: false
|
||||
)
|
||||
|
||||
self.dialPlanValueSelected = dialPlanValueSelectedTmp
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
self.defaultAccountModelIndex = defaultAccountModelIndexTmp
|
||||
|
||||
self.dialPlanValueSelected = dialPlanValueSelectedTmp
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func updateDialPlan(newDialPlan: String) {
|
||||
let dialPlansList = SharedMainViewModel.shared.dialPlansList
|
||||
if let dialPlan = dialPlansList.first(where: { newDialPlan.contains($0?.isoCountryCode ?? "") }) ??
|
||||
dialPlansList.first(where: { newDialPlan.contains($0?.countryCallingCode ?? "") }) {
|
||||
self.dialPlanSelected = dialPlan
|
||||
} else {
|
||||
self.dialPlanSelected = nil
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -124,7 +124,7 @@
|
|||
"location" : "https://gitlab.linphone.org/BC/public/linphone-sdk-swift-ios.git",
|
||||
"state" : {
|
||||
"branch" : "alpha",
|
||||
"revision" : "92aaa6e23f62bffdca8946c0ec172c5eb4605e76"
|
||||
"revision" : "49ecbf8a30d98ec4f83f4b0f10f239b46a7fd1cc"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue