diff --git a/enzevalos_iphone/SwiftUI/Inbox/MailListView.swift b/enzevalos_iphone/SwiftUI/Inbox/MailListView.swift index a326d7cec1413a3ac356c6c4eddc0aead964a4e6..6482af2a4ea799267b9639d0b74fab9a07e4217f 100644 --- a/enzevalos_iphone/SwiftUI/Inbox/MailListView.swift +++ b/enzevalos_iphone/SwiftUI/Inbox/MailListView.swift @@ -25,6 +25,7 @@ struct MailListView: View { @State var searchField = 0 @State var searchNow = false @State var composeMail = false + @State var showID = false init(folderpath: String, name: String) { fetchRequest = MailRecord.mailsInFolderFetchRequest(folderpath: folderpath) @@ -38,6 +39,7 @@ struct MailListView: View { .onAppear(perform: { self.updateMails() }) + .sheet(isPresented: $composeMail, content: { ComposeView() }) @@ -72,13 +74,21 @@ struct MailListView: View { } private var idButton: some View { - Button(action: { - print("Go to my id") - }, label: { +// Button(action: { +// print("Go to my id") +// }, label: { +// Text(NSLocalizedString("KeyID", comment: "id")) +// }) +// } + +// NavigationLink (destination: ContactView(contact: mails., fromMail: ReadModel(mail: self.mails.filter(filterKeyRecord)), derivedFromKey: false) { + + // What should be the destination vor the button "ID"? + NavigationLink (destination: Text("Destination!")) { Text(NSLocalizedString("KeyID", comment: "id")) - }) + } } - + private var composeButton: some View { Button(action: { composeMail = true diff --git a/enzevalos_iphone/SwiftUI/Read/Tabbed Views/SenderViewChildren/SmallContactListView.swift b/enzevalos_iphone/SwiftUI/Read/Tabbed Views/SenderViewChildren/SmallContactListView.swift index 6eaecfe5be0d59a6a2a89e2b524f4e60b43c0909..6f95ebf87e5778efc1549d9cda1cb0fabdec9f15 100644 --- a/enzevalos_iphone/SwiftUI/Read/Tabbed Views/SenderViewChildren/SmallContactListView.swift +++ b/enzevalos_iphone/SwiftUI/Read/Tabbed Views/SenderViewChildren/SmallContactListView.swift @@ -31,24 +31,43 @@ struct SmallContactListView <C: DisplayContact>: View { } if showList { ForEach(contacts, id: \.email) {contact in - Group { - HStack { - CircleImage(image: contact.myImage, radius: 40) - VStack (alignment: .leading, spacing: 2){ - Text(contact.name) - .font(.subheadline) - Text(contact.email) - .foregroundColor(.gray) - } - Spacer() - Button(action: {self.goToContact(contact: contact)}){ - Image(systemName: "chevron.right") +// Group { +// HStack { +// CircleImage(image: contact.myImage, radius: 40) +// VStack (alignment: .leading, spacing: 2){ +// Text(contact.name) +// .font(.subheadline) +// Text(contact.email) +// .foregroundColor(.gray) +// } +// Spacer() +// Button(action: {self.goToContact(contact: contact)}){ +// Image(systemName: "chevron.right") +// } +// } +// } +// .onTapGesture { +// self.goToContact(contact: contact) +// } + + + // Without an entry in "fromMail", the code will not be executed. Why is "fromMail" necessary to call "ContactView"? + // Therefor we put a dummymail in there + NavigationLink(destination: ContactView(contact: contact, fromMail: ProxyData.SecureMail)) { + HStack { + CircleImage(image: contact.myImage, radius: 40) + VStack (alignment: .leading, spacing: 2){ + Text(contact.name) + .font(.headline) + Text(contact.email) + .foregroundColor(.secondary) } + Spacer() + Image(systemName: "chevron.right") } - } - .onTapGesture { - self.goToContact(contact: contact) - } + } + + } } } diff --git a/enzevalos_iphone/SwiftUI/Read/Tabbed Views/SenderViewMain.swift b/enzevalos_iphone/SwiftUI/Read/Tabbed Views/SenderViewMain.swift index b1f6f14b217836e545e62aaaa29f4532d3278346..acc0d9cb1ca023039e9b957cf85ceb6bb85fbd23 100644 --- a/enzevalos_iphone/SwiftUI/Read/Tabbed Views/SenderViewMain.swift +++ b/enzevalos_iphone/SwiftUI/Read/Tabbed Views/SenderViewMain.swift @@ -23,6 +23,9 @@ import SwiftUI import CoreLocation struct SenderViewMain <M: DisplayMail>: View { + + + //let thismail: M // SEE: PersonNameComponents @@ -88,24 +91,47 @@ struct SenderViewMain <M: DisplayMail>: View { private var sender: some View { VStack (alignment: .leading, spacing: 10) { - HStack { - VStack (alignment: .leading) { - Text(NSLocalizedString("Sender", comment: "Sender")) - .font(.headline) - .padding(.bottom, 10) - Text(model.mail.sender.name) - .font(.subheadline) - Text(model.mail.sender.email) - .foregroundColor(.gray) + +// HStack { +// VStack (alignment: .leading) { +// Text(NSLocalizedString("Sender", comment: "Sender")) +// .font(.headline) +// .padding(.bottom, 10) +// Text(model.mail.sender.name) +// .font(.subheadline) +// Text(model.mail.sender.email) +// .foregroundColor(.gray) +// } +// Spacer() +// Button(action: {self.goToContact(contact: self.model.mail.sender)}){ +// Image(systemName: "chevron.right") +// } +// } +// .onTapGesture { +// self.goToContact(contact: self.model.mail.sender) +// } + + + + Text(NSLocalizedString("Sender", comment: "Sender")) + .font(.headline) + .padding(.bottom, 10) + NavigationLink(destination: ContactView(contact: model.mail.sender, fromMail: model.mail)) { + HStack { + VStack (alignment: .leading) { + Text(model.mail.sender.name) + .font(.headline) + Text(model.mail.sender.email) + .foregroundColor(.secondary) + } } Spacer() - Button(action: {self.goToContact(contact: self.model.mail.sender)}){ - Image(systemName: "chevron.right") - } - } - .onTapGesture { - self.goToContact(contact: self.model.mail.sender) + Image(systemName: "chevron.right") } + + + + HStack{ Text(String(format: NSLocalizedString("ReadView.Sender.Previous", comment: "100 previous received mails"), model.mail.sender.previousMails)) Spacer() @@ -159,7 +185,9 @@ struct SenderViewMain <M: DisplayMail>: View { } private func goToContact(contact: M.C) { - /* guard let con = contact.keyRecord else { + + + /* guard let con = contact.keyRecord else { print("No record...") return }