wip
This commit is contained in:
parent
6934b0fa97
commit
880408b04a
|
@ -50,7 +50,7 @@ private struct ContactsScreenRow: View {
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
SharedListRow(
|
SharedListRow(
|
||||||
iconType: .charCircle(contact.name ?? contact.contactJid),
|
iconType: .charCircle(contact.name),
|
||||||
text: contact.contactJid,
|
text: contact.contactJid,
|
||||||
controlType: .none
|
controlType: .none
|
||||||
)
|
)
|
||||||
|
|
|
@ -19,9 +19,9 @@ struct Chat: Identifiable {
|
||||||
}
|
}
|
||||||
|
|
||||||
init?(_ obj: MLContact) {
|
init?(_ obj: MLContact) {
|
||||||
guard let accId = obj.accountID as? Int else { return nil }
|
guard let contact = Contact(obj) else { return nil }
|
||||||
accountId = accId
|
accountId = contact.ownerId
|
||||||
participantJid = obj.contactJid
|
participantJid = contact.contactJid
|
||||||
participantName = obj.nickName
|
participantName = contact.name
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,13 +4,17 @@ import monalxmpp
|
||||||
struct Contact: Identifiable {
|
struct Contact: Identifiable {
|
||||||
let ownerId: Int
|
let ownerId: Int
|
||||||
let contactJid: String
|
let contactJid: String
|
||||||
let name: String?
|
private let nickname: String?
|
||||||
|
|
||||||
var id: String { contactJid }
|
var id: String { contactJid }
|
||||||
|
|
||||||
|
var name: String {
|
||||||
|
nickname ?? contactJid
|
||||||
|
}
|
||||||
|
|
||||||
init?(_ obj: MLContact) {
|
init?(_ obj: MLContact) {
|
||||||
ownerId = obj.accountID.intValue
|
ownerId = obj.accountID.intValue
|
||||||
contactJid = obj.contactJid
|
contactJid = obj.contactJid
|
||||||
name = obj.nickName.isEmpty ? nil : obj.nickName
|
nickname = obj.nickName
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue