From 4f7e4b0c360a521686199bf0fb8b2b2758eae7b5 Mon Sep 17 00:00:00 2001 From: Benoit Martins Date: Fri, 9 Jan 2026 14:12:03 +0100 Subject: [PATCH] Fix CallView when the friend has only a phone number --- Linphone/Contacts/ContactsManager.swift | 9 +++++---- Linphone/GeneratedGit.swift | 2 +- Linphone/UI/Call/ViewModel/CallViewModel.swift | 4 +++- Linphone/UI/Main/ContentView.swift | 2 ++ 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/Linphone/Contacts/ContactsManager.swift b/Linphone/Contacts/ContactsManager.swift index 1338effcc..adda9f5ee 100644 --- a/Linphone/Contacts/ContactsManager.swift +++ b/Linphone/Contacts/ContactsManager.swift @@ -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 }) }) } } diff --git a/Linphone/GeneratedGit.swift b/Linphone/GeneratedGit.swift index ec24c7abb..8ffb5a75a 100644 --- a/Linphone/GeneratedGit.swift +++ b/Linphone/GeneratedGit.swift @@ -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" } diff --git a/Linphone/UI/Call/ViewModel/CallViewModel.swift b/Linphone/UI/Call/ViewModel/CallViewModel.swift index 9c5c97dd5..4d48fb5c4 100644 --- a/Linphone/UI/Call/ViewModel/CallViewModel.swift +++ b/Linphone/UI/Call/ViewModel/CallViewModel.swift @@ -178,7 +178,9 @@ 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 { + } else if friend != nil && friend?.name != nil { + displayNameTmp = friend?.name ?? "No name" + } else { if self.currentCall!.remoteAddress!.displayName != nil { displayNameTmp = self.currentCall!.remoteAddress!.displayName! } else if self.currentCall!.remoteAddress!.username != nil && displayNameTmp.isEmpty { diff --git a/Linphone/UI/Main/ContentView.swift b/Linphone/UI/Main/ContentView.swift index f837974f8..20fdc661f 100644 --- a/Linphone/UI/Main/ContentView.swift +++ b/Linphone/UI/Main/ContentView.swift @@ -1507,6 +1507,8 @@ struct ContentView: View { } } .onReceive(NotificationCenter.default.publisher(for: NSNotification.Name("ContactLoaded"))) { _ in + callViewModel.resetCallView() + if let conversationsListVM = conversationsListViewModel { conversationsListVM.updateChatRoomsList() }