diff --git a/enzevalos_iphone/SwiftUI/Contact/ContactView.swift b/enzevalos_iphone/SwiftUI/Contact/ContactView.swift index aba0935a46e7feef5a54f9c86071afe5dfcb191c..9aa96309808f79e4bab044a93d4a4d7cb4d51988 100644 --- a/enzevalos_iphone/SwiftUI/Contact/ContactView.swift +++ b/enzevalos_iphone/SwiftUI/Contact/ContactView.swift @@ -15,6 +15,10 @@ struct ContactView <C: DisplayContact, M: DisplayMail>: View { public var fromMail: M? public var derivedFromKey: Bool = true +// init(contact: C, fromMail: M? = nil) { +// self.contact = contact +// } + var body: some View { TabView{ ForEach(Tabs, id: \.id ){ tab in diff --git a/enzevalos_iphone/SwiftUI/Read/Tabbed Views/SenderViewChildren/SmallContactListView.swift b/enzevalos_iphone/SwiftUI/Read/Tabbed Views/SenderViewChildren/SmallContactListView.swift index 6f95ebf87e5778efc1549d9cda1cb0fabdec9f15..1c574ac0ca37b441bdbb5f09e518eb5d9b2b05bb 100644 --- a/enzevalos_iphone/SwiftUI/Read/Tabbed Views/SenderViewChildren/SmallContactListView.swift +++ b/enzevalos_iphone/SwiftUI/Read/Tabbed Views/SenderViewChildren/SmallContactListView.swift @@ -31,29 +31,7 @@ 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") -// } -// } -// } -// .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)) { + NavigationLink(destination: ContactView<C, MailRecord>(contact: contact, fromMail: nil)) { HStack { CircleImage(image: contact.myImage, radius: 40) VStack (alignment: .leading, spacing: 2){ @@ -66,21 +44,11 @@ struct SmallContactListView <C: DisplayContact>: View { Image(systemName: "chevron.right") } } - - } } } .padding(10) } - - private func goToContact(contact: C) { - /* TODOguard let con = contact.keyRecord else { - return - } */ - return - // AppDelegate.getAppDelegate().readViewCoordinator?.pushContactView(contact: con) - } } diff --git a/enzevalos_iphone/SwiftUI/Read/Tabbed Views/SenderViewMain.swift b/enzevalos_iphone/SwiftUI/Read/Tabbed Views/SenderViewMain.swift index acc0d9cb1ca023039e9b957cf85ceb6bb85fbd23..de1f69c47b90a27a261a68e5c7f59fbd5919b58b 100644 --- a/enzevalos_iphone/SwiftUI/Read/Tabbed Views/SenderViewMain.swift +++ b/enzevalos_iphone/SwiftUI/Read/Tabbed Views/SenderViewMain.swift @@ -23,9 +23,6 @@ import SwiftUI import CoreLocation struct SenderViewMain <M: DisplayMail>: View { - - - //let thismail: M // SEE: PersonNameComponents @@ -76,43 +73,20 @@ struct SenderViewMain <M: DisplayMail>: View { } private var icon: some View { - model.mail.sender.myImage - .resizable() - .frame(width: 130, height: 110) - .clipShape(Circle()) - .overlay(Circle().stroke(Color.white, lineWidth: 4)) - .shadow(radius: 10) - .offset(y: -110/2) - .padding(.bottom, -110/2) - .onTapGesture { - self.goToContact(contact: self.model.mail.sender) + NavigationLink(destination: ContactView(contact: model.mail.sender, fromMail: model.mail)) { + model.mail.sender.myImage + .resizable() + .frame(width: 130, height: 110) + .clipShape(Circle()) + .overlay(Circle().stroke(Color.white, lineWidth: 4)) + .shadow(radius: 10) + .offset(y: -110/2) + .padding(.bottom, -110/2) } } 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) -// } -// 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) @@ -129,9 +103,6 @@ struct SenderViewMain <M: DisplayMail>: View { Image(systemName: "chevron.right") } - - - HStack{ Text(String(format: NSLocalizedString("ReadView.Sender.Previous", comment: "100 previous received mails"), model.mail.sender.previousMails)) Spacer() @@ -183,16 +154,6 @@ struct SenderViewMain <M: DisplayMail>: View { } } } - - private func goToContact(contact: M.C) { - - - /* guard let con = contact.keyRecord else { - print("No record...") - return - } - AppDelegate.getAppDelegate().readViewCoordinator?.pushContactView(contact: con) */ - } } struct SenderView_Previews: PreviewProvider {