Fix CallView when the friend has only a phone number

This commit is contained in:
Benoit Martins 2026-01-09 14:12:03 +01:00
parent 6575a4b0f2
commit 4f7e4b0c36
4 changed files with 11 additions and 6 deletions

View file

@ -424,18 +424,19 @@ final class ContactsManager: ObservableObject {
var friend: Friend?
if let friendList = self.friendList {
friend = friendList.friends.first(where: { $0.addresses.contains(where: { $0.asStringUriOnly() == sipUri }) })
friend = friendList.friends.first(where: { $0.addresses.contains(where: { $0.asStringUriOnly() == sipUri }) || $0.phoneNumbers.contains(where: { $0 == address.username }) })
}
if friend == nil, let linphoneFriendList = self.linphoneFriendList {
friend = linphoneFriendList.friends.first(where: { $0.addresses.contains(where: { $0.asStringUriOnly() == sipUri }) })
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 }) })
friend = tempRemoteFriendList.friends.first(where: { $0.addresses.contains(where: { $0.asStringUriOnly() == sipUri }) || $0.phoneNumbers.contains(where: { $0 == address.username }) })
}
CoreContext.shared.mCore.friendsLists.forEach { friendList in
if friendList.type == .CardDAV {
friend = friendList.friends.first(where: { $0.addresses.contains(where: { $0.asStringUriOnly() == sipUri }) })
friend = friendList.friends.first(where: { $0.addresses.contains(where: { $0.asStringUriOnly() == sipUri }) || $0.phoneNumbers.contains(where: { $0 == address.username }) })
}
}

View file

@ -2,6 +2,6 @@ import Foundation
public enum AppGitInfo {
public static let branch = "master"
public static let commit = "990d2f36a"
public static let commit = "6575a4b0f"
public static let tag = "6.1.0-alpha"
}

View file

@ -178,6 +178,8 @@ class CallViewModel: ObservableObject {
let friend = ContactsManager.shared.getFriendWithAddress(address: self.currentCall!.remoteAddress)
if friend != nil && friend!.address != nil && friend!.address!.displayName != nil {
displayNameTmp = friend!.address!.displayName!
} else if friend != nil && friend?.name != nil {
displayNameTmp = friend?.name ?? "No name"
} else {
if self.currentCall!.remoteAddress!.displayName != nil {
displayNameTmp = self.currentCall!.remoteAddress!.displayName!

View file

@ -1507,6 +1507,8 @@ struct ContentView: View {
}
}
.onReceive(NotificationCenter.default.publisher(for: NSNotification.Name("ContactLoaded"))) { _ in
callViewModel.resetCallView()
if let conversationsListVM = conversationsListViewModel {
conversationsListVM.updateChatRoomsList()
}