wip
This commit is contained in:
parent
0ca8ec93a7
commit
eb064d4e33
|
@ -25,6 +25,14 @@ extension String {
|
||||||
let lon = Double(parts[1]) ?? 0.0
|
let lon = Double(parts[1]) ?? 0.0
|
||||||
return CLLocationCoordinate2D(latitude: lat, longitude: lon)
|
return CLLocationCoordinate2D(latitude: lat, longitude: lon)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var isContact: Bool {
|
||||||
|
hasPrefix("contact:")
|
||||||
|
}
|
||||||
|
|
||||||
|
var getContactJid: String {
|
||||||
|
components(separatedBy: ":")[1]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extension String {
|
extension String {
|
||||||
|
|
|
@ -10,6 +10,8 @@ struct ConversationMessageContainer: View {
|
||||||
var body: some View {
|
var body: some View {
|
||||||
if let msgText = message.body, msgText.isLocation {
|
if let msgText = message.body, msgText.isLocation {
|
||||||
EmbededMapView(location: msgText.getLatLon)
|
EmbededMapView(location: msgText.getLatLon)
|
||||||
|
} else if let msgText = message.body, msgText.isContact {
|
||||||
|
ContactView(message: message)
|
||||||
} else if message.attachmentType != nil {
|
} else if message.attachmentType != nil {
|
||||||
AttachmentView(message: message)
|
AttachmentView(message: message)
|
||||||
} else {
|
} 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 {
|
private struct AttachmentView: View {
|
||||||
let message: Message
|
let message: Message
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue