wip
This commit is contained in:
parent
0ca8ec93a7
commit
eb064d4e33
|
@ -25,6 +25,14 @@ extension String {
|
|||
let lon = Double(parts[1]) ?? 0.0
|
||||
return CLLocationCoordinate2D(latitude: lat, longitude: lon)
|
||||
}
|
||||
|
||||
var isContact: Bool {
|
||||
hasPrefix("contact:")
|
||||
}
|
||||
|
||||
var getContactJid: String {
|
||||
components(separatedBy: ":")[1]
|
||||
}
|
||||
}
|
||||
|
||||
extension String {
|
||||
|
|
|
@ -10,6 +10,8 @@ struct ConversationMessageContainer: View {
|
|||
var body: some View {
|
||||
if let msgText = message.body, msgText.isLocation {
|
||||
EmbededMapView(location: msgText.getLatLon)
|
||||
} else if let msgText = message.body, msgText.isContact {
|
||||
ContactView(message: message)
|
||||
} else if message.attachmentType != nil {
|
||||
AttachmentView(message: message)
|
||||
} else {
|
||||
|
@ -67,6 +69,31 @@ private struct EmbededMapView: View {
|
|||
}
|
||||
}
|
||||
|
||||
private struct ContactView: View {
|
||||
let message: Message
|
||||
|
||||
var body: some View {
|
||||
VStack {
|
||||
ZStack {
|
||||
Circle()
|
||||
.frame(width: 44, height: 44)
|
||||
.foregroundColor(.red)
|
||||
Text(message.body?.getContactJid.firstLetter ?? "?")
|
||||
.foregroundColor(.white)
|
||||
.font(.body1)
|
||||
}
|
||||
Text(message.body?.getContactJid ?? "...")
|
||||
.font(.body2)
|
||||
.foregroundColor(.Material.Text.main)
|
||||
.multilineTextAlignment(.leading)
|
||||
}
|
||||
.padding()
|
||||
.onTapGesture {
|
||||
// TODO: Jump to add roster from here
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private struct AttachmentView: View {
|
||||
let message: Message
|
||||
|
||||
|
|
Loading…
Reference in a new issue