Commit 162009b2 authored by Oliver Wiese's avatar Oliver Wiese

improve previews

parent 0f19db4a
......@@ -296,3 +296,16 @@ extension DisplayMail {
}
struct DisplayProtocols_Previews: PreviewProvider {
static let mails = DummyData.mails
static let deviceName = "iPhone 11 Pro Max"
static var previews: some View {
ForEach(0..<mails.count) { index in
ReadMainView(mail: mails[index])
.previewDisplayName(mails[index].previewName)
.previewDevice(.init(rawValue: deviceName))
}
}
}
......@@ -21,6 +21,16 @@ struct Simulators <V: View> {
.previewDisplayName(deviceName)
.previewDevice(.init(rawValue: deviceName))
}
}
}
/// Example
struct SimulatorData_Previews: PreviewProvider {
static var previews: some View {
let sim = Simulators<ReadMainView<PseuoMail>>()
let mail = DummyData.MissingPKMail
let view = ReadMainView(mail: mail)
return sim.previews(view: view)
}
}
......@@ -37,13 +47,16 @@ struct DummyData {
Landmark(name: "Sydney", domain: "thirdexampledomain.de", location: .init(latitude: -33.865143, longitude: 151.209900))
]
/// A list of all dummy mails
static let mails = [DummyData.SecureMail, DummyData.PlainMail, DummyData.SignedOnlyMail, DummyData.MissingPKMail, DummyData.NotDecryptedMail, DummyData.CorruptedMail]
/// Different Mails
static let SecureMail = PseuoMail(folderType: .Inbox, sender: Alice, tos: [Bob, Charlie], ccs: [Bob, Charlie, Bob, Charlie, Bob], bccs: [Bob], routingStops: Landmarks, signedState: SignatureState.ValidSignature, encState: .ValidedEncryptedWithCurrentKey)
static let NotDecryptedMail = PseuoMail(folderType: .Inbox, sender: Alice, tos: [Bob, Charlie], ccs: [Bob, Charlie, Bob, Charlie, Bob], bccs: [Bob], routingStops: Landmarks, signedState: SignatureState.ValidSignature, encState: .UnableToDecrypt)
static let PlainMail = PseuoMail(folderType: .Inbox, sender: Alice, tos: [Bob, Charlie], ccs: [Bob, Charlie, Bob, Charlie, Bob], bccs: [Bob], routingStops: Landmarks, signedState: SignatureState.NoSignature, encState: .NoEncryption)
static let SignedOnlyMail = PseuoMail(folderType: .Inbox, sender: Alice, tos: [Bob, Charlie], ccs: [Bob, Charlie, Bob, Charlie, Bob], bccs: [Bob], routingStops: Landmarks, signedState: SignatureState.ValidSignature, encState: .NoEncryption)
static let CorruptedMail = PseuoMail(folderType: .Inbox, sender: Alice, tos: [Bob, Charlie], ccs: [Bob, Charlie, Bob, Charlie, Bob], bccs: [Bob], routingStops: Landmarks, signedState: SignatureState.InvalidSignature, encState: .ValidedEncryptedWithCurrentKey)
static let MissingPKMail = PseuoMail(folderType: .Inbox, sender: Alice, tos: [Bob, Charlie], ccs: [Bob, Charlie, Bob, Charlie, Bob], bccs: [Bob], routingStops: Landmarks, signedState: SignatureState.NoPublicKey, encState: .ValidedEncryptedWithCurrentKey)
static let SecureMail = PseuoMail(previewName: "Secure mail", folderType: .Inbox, sender: Alice, tos: [Bob, Charlie], ccs: [Bob, Charlie, Bob, Charlie, Bob], bccs: [Bob], routingStops: Landmarks, signedState: SignatureState.ValidSignature, encState: .ValidedEncryptedWithCurrentKey)
static let NotDecryptedMail = PseuoMail(previewName: "Can not decrypt", folderType: .Inbox, sender: Alice, tos: [Bob, Charlie], ccs: [Bob, Charlie, Bob, Charlie, Bob], bccs: [Bob], routingStops: Landmarks, signedState: SignatureState.ValidSignature, encState: .UnableToDecrypt)
static let PlainMail = PseuoMail(previewName: "Plain mail", folderType: .Inbox, sender: Alice, tos: [Bob, Charlie], ccs: [Bob, Charlie, Bob, Charlie, Bob], bccs: [Bob], routingStops: Landmarks, signedState: SignatureState.NoSignature, encState: .NoEncryption)
static let SignedOnlyMail = PseuoMail(previewName: "Signed only mail", folderType: .Inbox, sender: Alice, tos: [Bob, Charlie], ccs: [Bob, Charlie, Bob, Charlie, Bob], bccs: [Bob], routingStops: Landmarks, signedState: SignatureState.ValidSignature, encState: .NoEncryption)
static let CorruptedMail = PseuoMail(previewName: "Corrupted mail", folderType: .Inbox, sender: Alice, tos: [Bob, Charlie], ccs: [Bob, Charlie, Bob, Charlie, Bob], bccs: [Bob], routingStops: Landmarks, signedState: SignatureState.InvalidSignature, encState: .ValidedEncryptedWithCurrentKey)
static let MissingPKMail = PseuoMail(previewName: "Mising public key", folderType: .Inbox, sender: Alice, tos: [Bob, Charlie], ccs: [Bob, Charlie, Bob, Charlie, Bob], bccs: [Bob], routingStops: Landmarks, signedState: SignatureState.NoPublicKey, encState: .ValidedEncryptedWithCurrentKey)
static let Attachment = PseudoAttachment()
}
......@@ -125,6 +138,8 @@ struct PseudoContact: DisplayContact {
struct PseuoMail: DisplayMail {
typealias U = PseudoContact
typealias D = DialogStruct
var previewName: String
var displayAttachments: [DisplayAttachment] = []
......@@ -171,3 +186,5 @@ JVBERi0xLjUKJdDUxdgKMTI1IDAgb2JqCjw8Ci9MZW5ndGggNTM1NCAgICAgIAovRmlsdGVyIC9GbGF0
"""
}
Markdown is supported
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