mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-02-07 14:18:25 +00:00
Fix contacts with only a phone number
This commit is contained in:
parent
b3ed027c61
commit
e3bf00dca5
5 changed files with 38 additions and 12 deletions
|
|
@ -2,6 +2,6 @@ import Foundation
|
|||
|
||||
public enum AppGitInfo {
|
||||
public static let branch = "master"
|
||||
public static let commit = "2fea9d720"
|
||||
public static let commit = "b3ed027c6"
|
||||
public static let tag = "6.1.0-alpha"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -99,10 +99,17 @@ struct ContactRow: View {
|
|||
SharedMainViewModel.shared.displayedFriend = contactAvatarModel
|
||||
}
|
||||
}
|
||||
|
||||
if contactAvatarModel.friend != nil
|
||||
&& contactAvatarModel.friend!.address != nil {
|
||||
startCallFunc(contactAvatarModel.friend!.address!)
|
||||
|
||||
CoreContext.shared.doOnCoreQueue { core in
|
||||
if let friend = contactAvatarModel.friend {
|
||||
if let friendAddress = friend.address {
|
||||
startCallFunc(friendAddress)
|
||||
} else if !friend.phoneNumbers.isEmpty {
|
||||
if let address = core.interpretUrl(url: friend.phoneNumbers.first ?? "", applyInternationalPrefix: LinphoneUtils.applyInternationalPrefix(core: core)) {
|
||||
startCallFunc(address)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.onLongPressGesture(minimumDuration: 0.2) {
|
||||
|
|
|
|||
|
|
@ -204,6 +204,17 @@ class ContactAvatarModel: ObservableObject, Identifiable {
|
|||
if avatarModel == nil {
|
||||
avatarModel = ContactAvatarModel(friend: nil, name: addressFriend.name!, address: addressFriend.address!.asStringUriOnly(), withPresence: false)
|
||||
}
|
||||
completion(avatarModel!)
|
||||
} else if !addressFriend.phoneNumbers.isEmpty {
|
||||
var avatarModel = ContactsManager.shared.avatarListModel.first(where: {
|
||||
$0.friend != nil && $0.friend!.name == addressFriend.name && !$0.friend!.phoneNumbers.isEmpty
|
||||
&& $0.friend!.phoneNumbers == addressFriend.phoneNumbers
|
||||
})
|
||||
|
||||
if avatarModel == nil {
|
||||
avatarModel = ContactAvatarModel(friend: nil, name: addressFriend.name!, address: addressFriend.phoneNumbers.first ?? addressFriend.address?.asStringUriOnly() ?? "", withPresence: false)
|
||||
}
|
||||
|
||||
completion(avatarModel!)
|
||||
} else {
|
||||
var name = ""
|
||||
|
|
|
|||
|
|
@ -220,8 +220,16 @@ struct AddParticipantsFragment: View {
|
|||
}
|
||||
.background(.white)
|
||||
.onTapGesture {
|
||||
if let addr = try? Factory.Instance.createAddress(addr: contactsManager.avatarListModel[index].address) {
|
||||
addParticipantsViewModel.selectParticipant(addr: addr)
|
||||
CoreContext.shared.doOnCoreQueue { core in
|
||||
if !contactsManager.avatarListModel[index].address.isEmpty {
|
||||
if let addr = try? Factory.Instance.createAddress(addr: contactsManager.avatarListModel[index].address) {
|
||||
addParticipantsViewModel.selectParticipant(addr: addr)
|
||||
}
|
||||
} else if !contactsManager.avatarListModel[index].phoneNumbersWithLabel.isEmpty {
|
||||
if let address = core.interpretUrl(url: contactsManager.avatarListModel[index].phoneNumbersWithLabel.first?.phoneNumber ?? "", applyInternationalPrefix: LinphoneUtils.applyInternationalPrefix(core: core)) {
|
||||
addParticipantsViewModel.selectParticipant(addr: address)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.buttonStyle(.borderless)
|
||||
|
|
|
|||
|
|
@ -31,11 +31,11 @@ class CardDavViewModel: ObservableObject {
|
|||
let tempRemoteAddressBookFriendList = "TempRemoteDirectoryContacts address-book"
|
||||
|
||||
@Published var isEdit: Bool = false
|
||||
@Published var displayName: String = ""
|
||||
@Published var serverUrl: String = ""
|
||||
@Published var username: String = ""
|
||||
@Published var password: String = ""
|
||||
@Published var realm: String = ""
|
||||
@Published var displayName: String = "CardDav Test"
|
||||
@Published var serverUrl: String = "https://dav.berfini.me/dav.php/addressbooks/BC/default/"
|
||||
@Published var username: String = "BC"
|
||||
@Published var password: String = "cotcot"
|
||||
@Published var realm: String = "BaikalDAV"
|
||||
@Published var storeNewContactsInIt: Bool = false
|
||||
@Published var isReadOnly: Bool = false
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue