mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-17 02:58:07 +00:00
Include phone number in lastSearchFriend results
This commit is contained in:
parent
914177000b
commit
b775f41ae0
1 changed files with 15 additions and 12 deletions
|
|
@ -61,19 +61,22 @@ final class MagicSearchSingleton: ObservableObject {
|
|||
var lastSearchFriend: [SearchResult] = []
|
||||
var lastSearchSuggestions: [SearchResult] = []
|
||||
|
||||
magicSearch.lastSearch.forEach { searchResult in
|
||||
if let friend = searchResult.friend,
|
||||
let address = searchResult.address,
|
||||
!lastSearchFriend.contains(where: { $0.address?.weakEqual(address2: address) ?? false }) {
|
||||
|
||||
lastSearchFriend.append(searchResult)
|
||||
} else {
|
||||
lastSearchSuggestions.append(searchResult)
|
||||
}
|
||||
}
|
||||
|
||||
magicSearch.lastSearch.forEach { searchResult in
|
||||
if searchResult.friend != nil {
|
||||
if let address = searchResult.address,
|
||||
!lastSearchFriend.contains(where: { $0.address?.weakEqual(address2: address) ?? false }) {
|
||||
lastSearchFriend.append(searchResult)
|
||||
} else if let phoneNumber = searchResult.phoneNumber,
|
||||
!lastSearchFriend.contains(where: { $0.phoneNumber == phoneNumber }) {
|
||||
lastSearchFriend.append(searchResult)
|
||||
}
|
||||
} else {
|
||||
lastSearchSuggestions.append(searchResult)
|
||||
}
|
||||
}
|
||||
|
||||
lastSearchSuggestions.sort(by: {
|
||||
$0.address!.asStringUriOnly() < $1.address!.asStringUriOnly()
|
||||
($0.address?.asStringUriOnly() ?? "") < ($1.address?.asStringUriOnly() ?? "")
|
||||
})
|
||||
|
||||
if let defaultAccount = core.defaultAccount, let contactAddress = defaultAccount.contactAddress {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue