Commit 73aa3b02 authored by Oliver Wiese's avatar Oliver Wiese
Browse files

new mailrowView

parent 68b51280
......@@ -24,7 +24,7 @@ import SwiftUI
// TODO: Mark displayname as from CNContact
class ContactHandler {
static var cartoons = true
static var cartoons = false
private let store = CNContactStore()
static let handler = ContactHandler()
......
......@@ -28,6 +28,55 @@ struct MailRowView <M: DisplayMail>: View {
var activateOnTap: Bool = true
var body: some View {
body_v2
}
private var content: String {
get {
let max = 500
if mail.subject.count < max {
return mail.subject + "\n" + mail.body.prefix(max - mail.subject.count)
}
return mail.subject
}
}
private var body_v2: some View {
VStack(alignment: .leading) {
HStack{
// Sender name
Text(mail.sender.name)
.fontWeight(mail.isRead ? .regular : .medium)
.lineLimit(2)
Spacer()
if !mail.displayAttachments.isEmpty {
Image(systemName: "paperclip")
.font(.caption)
.foregroundColor(.secondary)
}
// Arrival time
Text(mail.date.timeAgoText())
.font(.caption)
.padding(.trailing, -20)
}
HStack {
avatar
// Subject
Text(content)
.font(.caption)
.lineLimit(6)
}
.padding(.top, -7)
.frame(height: 65)
}
.foregroundColor(mail.isRead ? .secondary : .primary)
}
private var body_v1: some View {
HStack {
avatar
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment