Commit 8b5f556c authored by Oliver Wiese's avatar Oliver Wiese

add localization

add parse attachments
parent b3db6282
......@@ -18,6 +18,13 @@
import Foundation
import SwiftUI
/*
TODOS:
* Remove download -> All files are allready downloaded
* Does Views disappear?
* Add Security indicator
*/
class ReadViewCoordinator {
let root: UINavigationController
......@@ -33,29 +40,14 @@ class ReadViewCoordinator {
}
func pushReadView(mail: PersistentMail){
root.isToolbarHidden = true
try? AppDelegate.getAppDelegate().mailHandler.startIMAPIdleIfSupported()
AppDelegate.getAppDelegate().mailHandler.updateFolder(folder: Folder.inbox, completionCallback: {_ in
})
if let vc = readView {
if root.viewControllers.contains(vc) {
while root.topViewController != vc {
root.popViewController(animated: true)
}
} else {
root.pushViewController(vc, animated: true)
}
}
else {
let context = DataHandler.handler.managedObjectContext
let vc = UIHostingController(rootView: ReadMainView(mail: mail, coord: self).environment(\.managedObjectContext,context))
readView = vc
root.pushViewController(vc, animated: true)
}
let vc = UIHostingController(rootView: ReadMainView(mail: mail, coord: self))
readView = vc
root.pushViewController(vc, animated: true)
}
func delete(mail: PersistentMail){
......
......@@ -19,12 +19,14 @@ import SwiftUI
struct AttachmentsViewMain: View {
let mail:PersistentMail
let coord:ReadViewCoordinator
//gets the attachments as attachments not as nsElemets
@State var Attachments:[Attachment]? = nil
func attachmentList()->[Attachment]{
if Attachments != nil { return Attachments!}//if we already converted the attachments
print((mail.attachments ?? []).count)
......@@ -46,6 +48,7 @@ struct AttachmentsViewMain: View {
}
@State var dlAll=false;//whether the Download all button was clicked
var attachments: some View {
return VStack(alignment: .leading, spacing: 5){
......@@ -157,7 +160,7 @@ struct AttPrev:View{
if preload {self.download()}
//this QuickLookView has to be defined here so it reloads on every state-change
var QLV = QuickLookView(name: self.attachment.name!, data: self.attachment.data!, shallDL: self.isDownloaded)
let QLV = QuickLookView(name: self.attachment.name!, data: self.attachment.data!, shallDL: self.isDownloaded)
return VStack{
Group{
CardV(title: self.attachment.name ?? "",
......
......@@ -153,6 +153,15 @@
"Sender" = "Absender";
"To" = "An";
"to" = "an";
"ReadView.Open" = "öffnen";
"ReadView.Share" = "teilen";
"ReadView.Download" = "herunterladen";
"ReadView.Download.All" = "alle herunterladen";
"ReadView.Download.Again" = "nochmals herunterladen";
"ReadView.Delete" = "löschen";
"ReadView.Attachments.No" = "Keine Anhänge vorhanden";
"ReadView.Attachments.Headline" = "Anhänge:";
"ReadView.Links.Future" = "a list of links contained in this mail will be visable here in a future update";
"Transportencryption" = "Transferverschlüsselung";
"Trash" = "Papierkorb";
"TwoDaysAgo" = "Vorgestern";
......
......@@ -150,6 +150,15 @@
"Subject" = "Subject";
"subject" = "subject";
"SubjectNo" = "No subject";
"ReadView.Open" = "open";
"ReadView.Share" = "share";
"ReadView.Download" = "download";
"ReadView.Download.All" = "download all";
"ReadView.Download.Again" = "download again";
"ReadView.Delete" = "delete";
"ReadView.Attachments.No" = "This mail doesn't contain any attachments";
"ReadView.Attachments.Headline" = "Attachments:";
"ReadView.Links.Future" = "A list of links contained in this mail will be visable here in a future update";
"Sender" = "Sender";
"To" = "To";
"to" = "to";
......
......@@ -332,6 +332,8 @@ class IncomingMail {
if travelMail {
publicKeyRaw = parseTravelMail()
}
readableAttachments=parseUserReadableAttachments(parser: msgParser)
for a in msgParser.attachments() {
if let attachment = a as? MCOAttachment {
......
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