Skip to content
Snippets Groups Projects
Commit e03d6ccd authored by goekhan08's avatar goekhan08
Browse files

Added Navigationlink on MailListView for the ID-Button, on SenderViewMain for...

Added Navigationlink on MailListView for the ID-Button, on SenderViewMain for the sender and in SmallContactListView for all receivers of the mail.
parent e95644a0
No related branches found
No related tags found
1 merge request!69Resolve "Add GoTo contact view"
...@@ -25,6 +25,7 @@ struct MailListView: View { ...@@ -25,6 +25,7 @@ struct MailListView: View {
@State var searchField = 0 @State var searchField = 0
@State var searchNow = false @State var searchNow = false
@State var composeMail = false @State var composeMail = false
@State var showID = false
init(folderpath: String, name: String) { init(folderpath: String, name: String) {
fetchRequest = MailRecord.mailsInFolderFetchRequest(folderpath: folderpath) fetchRequest = MailRecord.mailsInFolderFetchRequest(folderpath: folderpath)
...@@ -38,6 +39,7 @@ struct MailListView: View { ...@@ -38,6 +39,7 @@ struct MailListView: View {
.onAppear(perform: { .onAppear(perform: {
self.updateMails() self.updateMails()
}) })
.sheet(isPresented: $composeMail, content: { .sheet(isPresented: $composeMail, content: {
ComposeView() ComposeView()
}) })
...@@ -72,13 +74,21 @@ struct MailListView: View { ...@@ -72,13 +74,21 @@ struct MailListView: View {
} }
private var idButton: some View { private var idButton: some View {
Button(action: { // Button(action: {
print("Go to my id") // print("Go to my id")
}, label: { // }, 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")) Text(NSLocalizedString("KeyID", comment: "id"))
}) }
} }
private var composeButton: some View { private var composeButton: some View {
Button(action: { Button(action: {
composeMail = true composeMail = true
......
...@@ -31,24 +31,43 @@ struct SmallContactListView <C: DisplayContact>: View { ...@@ -31,24 +31,43 @@ struct SmallContactListView <C: DisplayContact>: View {
} }
if showList { if showList {
ForEach(contacts, id: \.email) {contact in ForEach(contacts, id: \.email) {contact in
Group { // Group {
HStack { // HStack {
CircleImage(image: contact.myImage, radius: 40) // CircleImage(image: contact.myImage, radius: 40)
VStack (alignment: .leading, spacing: 2){ // VStack (alignment: .leading, spacing: 2){
Text(contact.name) // Text(contact.name)
.font(.subheadline) // .font(.subheadline)
Text(contact.email) // Text(contact.email)
.foregroundColor(.gray) // .foregroundColor(.gray)
} // }
Spacer() // Spacer()
Button(action: {self.goToContact(contact: contact)}){ // Button(action: {self.goToContact(contact: contact)}){
Image(systemName: "chevron.right") // 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)
}
} }
} }
} }
......
...@@ -23,6 +23,9 @@ import SwiftUI ...@@ -23,6 +23,9 @@ import SwiftUI
import CoreLocation import CoreLocation
struct SenderViewMain <M: DisplayMail>: View { struct SenderViewMain <M: DisplayMail>: View {
//let thismail: M
// SEE: PersonNameComponents // SEE: PersonNameComponents
...@@ -88,24 +91,47 @@ struct SenderViewMain <M: DisplayMail>: View { ...@@ -88,24 +91,47 @@ struct SenderViewMain <M: DisplayMail>: View {
private var sender: some View { private var sender: some View {
VStack (alignment: .leading, spacing: 10) { VStack (alignment: .leading, spacing: 10) {
HStack {
VStack (alignment: .leading) { // HStack {
Text(NSLocalizedString("Sender", comment: "Sender")) // VStack (alignment: .leading) {
.font(.headline) // Text(NSLocalizedString("Sender", comment: "Sender"))
.padding(.bottom, 10) // .font(.headline)
Text(model.mail.sender.name) // .padding(.bottom, 10)
.font(.subheadline) // Text(model.mail.sender.name)
Text(model.mail.sender.email) // .font(.subheadline)
.foregroundColor(.gray) // 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() Spacer()
Button(action: {self.goToContact(contact: self.model.mail.sender)}){ Image(systemName: "chevron.right")
Image(systemName: "chevron.right")
}
}
.onTapGesture {
self.goToContact(contact: self.model.mail.sender)
} }
HStack{ HStack{
Text(String(format: NSLocalizedString("ReadView.Sender.Previous", comment: "100 previous received mails"), model.mail.sender.previousMails)) Text(String(format: NSLocalizedString("ReadView.Sender.Previous", comment: "100 previous received mails"), model.mail.sender.previousMails))
Spacer() Spacer()
...@@ -159,7 +185,9 @@ struct SenderViewMain <M: DisplayMail>: View { ...@@ -159,7 +185,9 @@ struct SenderViewMain <M: DisplayMail>: View {
} }
private func goToContact(contact: M.C) { private func goToContact(contact: M.C) {
/* guard let con = contact.keyRecord else {
/* guard let con = contact.keyRecord else {
print("No record...") print("No record...")
return return
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment