mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-02-07 14:18:25 +00:00
Normalize phone numbers in getFriendWithAddress
This commit is contained in:
parent
2fea9d720e
commit
b3ed027c61
3 changed files with 49 additions and 11 deletions
|
|
@ -422,21 +422,59 @@ final class ContactsManager: ObservableObject {
|
|||
let sipUri = clonedAddress.asStringUriOnly()
|
||||
|
||||
var friend: Friend?
|
||||
let core = CoreContext.shared.mCore
|
||||
|
||||
let normalizedIncoming = core?.defaultAccount?.normalizePhoneNumber(username: address.username ?? "")
|
||||
|
||||
if let friendList = self.friendList {
|
||||
friend = friendList.friends.first(where: { $0.addresses.contains(where: { $0.asStringUriOnly() == sipUri }) || $0.phoneNumbers.contains(where: { $0 == address.username }) })
|
||||
friend = friendList.friends.first(where: {
|
||||
$0.addresses.contains(where: { $0.asStringUriOnly() == sipUri }) ||
|
||||
(
|
||||
normalizedIncoming != nil &&
|
||||
$0.phoneNumbers.contains(where: {
|
||||
core?.defaultAccount?.normalizePhoneNumber(username: $0) == normalizedIncoming
|
||||
})
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
if friend == nil, let linphoneFriendList = self.linphoneFriendList {
|
||||
friend = linphoneFriendList.friends.first(where: { $0.addresses.contains(where: { $0.asStringUriOnly() == sipUri }) || $0.phoneNumbers.contains(where: { $0 == address.username }) })
|
||||
}
|
||||
if friend == nil, let tempRemoteFriendList = self.tempRemoteFriendList {
|
||||
friend = tempRemoteFriendList.friends.first(where: { $0.addresses.contains(where: { $0.asStringUriOnly() == sipUri }) || $0.phoneNumbers.contains(where: { $0 == address.username }) })
|
||||
}
|
||||
friend = linphoneFriendList.friends.first(where: {
|
||||
$0.addresses.contains(where: { $0.asStringUriOnly() == sipUri }) ||
|
||||
(
|
||||
normalizedIncoming != nil &&
|
||||
$0.phoneNumbers.contains(where: {
|
||||
core?.defaultAccount?.normalizePhoneNumber(username: $0) == normalizedIncoming
|
||||
})
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
CoreContext.shared.mCore.friendsLists.forEach { friendList in
|
||||
if friendList.type == .CardDAV {
|
||||
friend = friendList.friends.first(where: { $0.addresses.contains(where: { $0.asStringUriOnly() == sipUri }) || $0.phoneNumbers.contains(where: { $0 == address.username }) })
|
||||
if friend == nil, let tempRemoteFriendList = self.tempRemoteFriendList {
|
||||
friend = tempRemoteFriendList.friends.first(where: {
|
||||
$0.addresses.contains(where: { $0.asStringUriOnly() == sipUri }) ||
|
||||
(
|
||||
normalizedIncoming != nil &&
|
||||
$0.phoneNumbers.contains(where: {
|
||||
core?.defaultAccount?.normalizePhoneNumber(username: $0) == normalizedIncoming
|
||||
})
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
if let core {
|
||||
for list in core.friendsLists where list.type == .CardDAV {
|
||||
if friend == nil {
|
||||
friend = list.friends.first(where: {
|
||||
$0.addresses.contains(where: { $0.asStringUriOnly() == sipUri }) ||
|
||||
(
|
||||
normalizedIncoming != nil &&
|
||||
$0.phoneNumbers.contains(where: {
|
||||
core.defaultAccount?.normalizePhoneNumber(username: $0) == normalizedIncoming
|
||||
})
|
||||
)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,6 @@ import Foundation
|
|||
|
||||
public enum AppGitInfo {
|
||||
public static let branch = "master"
|
||||
public static let commit = "907211903"
|
||||
public static let commit = "2fea9d720"
|
||||
public static let tag = "6.1.0-alpha"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -123,7 +123,7 @@
|
|||
"location" : "https://gitlab.linphone.org/BC/public/linphone-sdk-swift-ios.git",
|
||||
"state" : {
|
||||
"branch" : "alpha",
|
||||
"revision" : "e2c24740b5f3479ae5d80f0eda11165937c448f8"
|
||||
"revision" : "859ffa75fe7118f861aec8baf0d9696671d349f5"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue