mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-17 02:58:07 +00:00
Fix CallView when the friend has only a phone number
This commit is contained in:
parent
6575a4b0f2
commit
4f7e4b0c36
4 changed files with 11 additions and 6 deletions
|
|
@ -424,18 +424,19 @@ final class ContactsManager: ObservableObject {
|
||||||
var friend: Friend?
|
var friend: Friend?
|
||||||
|
|
||||||
if let friendList = self.friendList {
|
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 {
|
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 {
|
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
|
CoreContext.shared.mCore.friendsLists.forEach { friendList in
|
||||||
if friendList.type == .CardDAV {
|
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 }) })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,6 @@ import Foundation
|
||||||
|
|
||||||
public enum AppGitInfo {
|
public enum AppGitInfo {
|
||||||
public static let branch = "master"
|
public static let branch = "master"
|
||||||
public static let commit = "990d2f36a"
|
public static let commit = "6575a4b0f"
|
||||||
public static let tag = "6.1.0-alpha"
|
public static let tag = "6.1.0-alpha"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -178,6 +178,8 @@ class CallViewModel: ObservableObject {
|
||||||
let friend = ContactsManager.shared.getFriendWithAddress(address: self.currentCall!.remoteAddress)
|
let friend = ContactsManager.shared.getFriendWithAddress(address: self.currentCall!.remoteAddress)
|
||||||
if friend != nil && friend!.address != nil && friend!.address!.displayName != nil {
|
if friend != nil && friend!.address != nil && friend!.address!.displayName != nil {
|
||||||
displayNameTmp = friend!.address!.displayName!
|
displayNameTmp = friend!.address!.displayName!
|
||||||
|
} else if friend != nil && friend?.name != nil {
|
||||||
|
displayNameTmp = friend?.name ?? "No name"
|
||||||
} else {
|
} else {
|
||||||
if self.currentCall!.remoteAddress!.displayName != nil {
|
if self.currentCall!.remoteAddress!.displayName != nil {
|
||||||
displayNameTmp = self.currentCall!.remoteAddress!.displayName!
|
displayNameTmp = self.currentCall!.remoteAddress!.displayName!
|
||||||
|
|
|
||||||
|
|
@ -1507,6 +1507,8 @@ struct ContentView: View {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.onReceive(NotificationCenter.default.publisher(for: NSNotification.Name("ContactLoaded"))) { _ in
|
.onReceive(NotificationCenter.default.publisher(for: NSNotification.Name("ContactLoaded"))) { _ in
|
||||||
|
callViewModel.resetCallView()
|
||||||
|
|
||||||
if let conversationsListVM = conversationsListViewModel {
|
if let conversationsListVM = conversationsListViewModel {
|
||||||
conversationsListVM.updateChatRoomsList()
|
conversationsListVM.updateChatRoomsList()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue