This commit is contained in:
Woit 2024-11-29 23:36:19 +01:00
parent 6934b0fa97
commit 880408b04a
3 changed files with 11 additions and 7 deletions

View file

@ -50,7 +50,7 @@ private struct ContactsScreenRow: View {
var body: some View {
SharedListRow(
iconType: .charCircle(contact.name ?? contact.contactJid),
iconType: .charCircle(contact.name),
text: contact.contactJid,
controlType: .none
)

View file

@ -19,9 +19,9 @@ struct Chat: Identifiable {
}
init?(_ obj: MLContact) {
guard let accId = obj.accountID as? Int else { return nil }
accountId = accId
participantJid = obj.contactJid
participantName = obj.nickName
guard let contact = Contact(obj) else { return nil }
accountId = contact.ownerId
participantJid = contact.contactJid
participantName = contact.name
}
}

View file

@ -4,13 +4,17 @@ import monalxmpp
struct Contact: Identifiable {
let ownerId: Int
let contactJid: String
let name: String?
private let nickname: String?
var id: String { contactJid }
var name: String {
nickname ?? contactJid
}
init?(_ obj: MLContact) {
ownerId = obj.accountID.intValue
contactJid = obj.contactJid
name = obj.nickName.isEmpty ? nil : obj.nickName
nickname = obj.nickName
}
}