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 {
@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,11 +74,19 @@ 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 {
......
......@@ -31,24 +31,43 @@ struct SmallContactListView <C: DisplayContact>: View {
}
if showList {
ForEach(contacts, id: \.email) {contact in
Group {
// 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(.subheadline)
.font(.headline)
Text(contact.email)
.foregroundColor(.gray)
.foregroundColor(.secondary)
}
Spacer()
Button(action: {self.goToContact(contact: contact)}){
Image(systemName: "chevron.right")
}
}
}
.onTapGesture {
self.goToContact(contact: contact)
}
}
}
}
......
......@@ -24,6 +24,9 @@ import CoreLocation
struct SenderViewMain <M: DisplayMail>: View {
//let thismail: M
// SEE: PersonNameComponents
@EnvironmentObject var model: ReadModel<M>
......@@ -88,24 +91,47 @@ struct SenderViewMain <M: DisplayMail>: View {
private var sender: some View {
VStack (alignment: .leading, spacing: 10) {
HStack {
VStack (alignment: .leading) {
// 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(.subheadline)
.font(.headline)
Text(model.mail.sender.email)
.foregroundColor(.gray)
.foregroundColor(.secondary)
}
}
Spacer()
Button(action: {self.goToContact(contact: self.model.mail.sender)}){
Image(systemName: "chevron.right")
}
}
.onTapGesture {
self.goToContact(contact: self.model.mail.sender)
}
HStack{
Text(String(format: NSLocalizedString("ReadView.Sender.Previous", comment: "100 previous received mails"), model.mail.sender.previousMails))
Spacer()
......@@ -159,6 +185,8 @@ struct SenderViewMain <M: DisplayMail>: View {
}
private func goToContact(contact: M.C) {
/* guard let con = contact.keyRecord else {
print("No record...")
return
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment