Skip to content
Snippets Groups Projects
Commit b4efa42c authored by Aylin's avatar Aylin
Browse files

AttachmentAlert works now

parent fcd77ea9
Branches
No related tags found
1 merge request!83Resolve "Integrate attachment functionality in new ComposeView"
......@@ -32,9 +32,10 @@ struct ComposeViewHeader: View {
if model.mentionsAttachments && model.attachments == [] {
model.showAttachmentAlert = true
model.resumeSend = false
print("You forgot the attachments")
}
if model.resumeSend {
model.sendMail()
// model.sendMail()
presentationMode.wrappedValue.dismiss()
}
model.resumeSend = true
......
......@@ -33,8 +33,8 @@ class ComposeModel: ObservableObject {
/// computed property checks whether an attachment is mentioned in the mail (subject or body)
var mentionsAttachments: Bool {
let germanWords = ["Anhang", "anhang", "angehängt", "angehangen", "Anhänge"]
let englishWords = ["attachment", "attachments", "attached", "attach"]
let germanWords = ["Anhang", "anhang", "Angehängt", "angehängt", "Angehangen", "angehangen", "Anhänge", "anhänge"]
let englishWords = ["Attachment", "attachment", "Attachments", "attachments", "Attached", "attached", "Attach", "attach"]
// TODO: more languages?
let allWords = germanWords + englishWords
return allWords.contains(where: self.body.contains) || allWords.contains(where: self.subject.contains)
......@@ -44,7 +44,7 @@ class ComposeModel: ObservableObject {
/// Generates mail and sends it.
func sendMail() {
//generateMail().send()
generateMail().send()
}
/// Adds email addresses to given RecipientFieldModel.
......
......@@ -87,13 +87,13 @@ struct ComposeView: View {
Alert(
title: Text("Attachment.Alert.Title"),
message: Text("Attachment.Alert.Text"),
primaryButton: .destructive(Text("Attachment.Alert.PrimaryButton")) {
primaryButton: .destructive(Text("Attachment.Alert.PrimaryButton").foregroundColor(Color.blue)) {
// send the mail anyway
model.sendMail()
presentationMode.wrappedValue.dismiss()
},
secondaryButton: .destructive(Text("Attachment.Alert.SecondaryButton")) {
// quit send, edit again
secondaryButton: .destructive(Text("Attachment.Alert.SecondaryButton").foregroundColor(Color.blue)) {
// quit sending, enable further editing
}
)
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment