From e2332adb95236f6e130471d74cc035c4e51e1a1f Mon Sep 17 00:00:00 2001 From: Aylin <a.akkus@fu-berlin.de> Date: Fri, 26 Mar 2021 12:50:35 +0100 Subject: [PATCH] Finished? --- .../Tabbed Views/AttachmentsViewMain.swift | 29 +++++++++++++------ 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/enzevalos_iphone/SwiftUI/Read/Tabbed Views/AttachmentsViewMain.swift b/enzevalos_iphone/SwiftUI/Read/Tabbed Views/AttachmentsViewMain.swift index e17610ab..660c5f9c 100644 --- a/enzevalos_iphone/SwiftUI/Read/Tabbed Views/AttachmentsViewMain.swift +++ b/enzevalos_iphone/SwiftUI/Read/Tabbed Views/AttachmentsViewMain.swift @@ -93,8 +93,10 @@ struct AttPrev:View{ // by default false var shouldBeDownloaded = false - // whether this attachment is downloaded to the documents directory + // whether this attachment is already downloaded to the documents directory @State var isDownloaded: Bool = false + // used togehter with 'open' button to + // open a fullScreenView of a file @State var isFullScreen: Bool = false /// a func to find the documents directory @@ -124,16 +126,23 @@ struct AttPrev:View{ } var body: some View{ - if shouldBeDownloaded {self.download()} + if shouldBeDownloaded { + self.download() + } - //this QuickLookView has to be defined here so it reloads on every state-change + // QuickLookView creates the preview of the file + // it has to be defined here to update correctly let QLV = QuickLookView(name: self.attachment.myName, data: self.attachment.myData, shallDL: self.isDownloaded) + return VStack{ Group{ CardV(title: self.attachment.myName, - //these buttons are visable under the clicked preview + //these buttons are visable under the preview + // when users click on the preview actions: self.isDownloaded||self.shouldBeDownloaded ? + // different combination of buttons + // according to downloading status [ // anyViewDeleteButton anyViewOpenButton, @@ -147,19 +156,20 @@ struct AttPrev:View{ AnyView(EmptyView()), AnyView(EmptyView()) ] - ){ + ){ QLV/*TODO: .allowsHitTesting(false).disabled(true)*/ //this should make the whole view scrollable averywhere not just on the title } } - // preview resemble the look of A4 format + // preview should resemble the look of A4 format .aspectRatio(100/141, contentMode: .fit) .frame(width: UIScreen.main.bounds.width*2/3)//, maxHeight: 500) - //an invisable NavigationLink to open the preview in fullscreen - NavigationLink(destination: QuickLookView(name: self.attachment.myName, data: self.attachment.myData) - .navigationBarItems(trailing: shareButton), isActive: self.$isFullScreen){Text("loi")}.hidden() + //a hidden NavigationLink to open the preview in fullscreen + // seems not to work currently + NavigationLink(destination: QuickLookView(name: self.attachment.myName, data: self.attachment.myData) + .navigationBarItems(trailing: shareButton), isActive: self.$isFullScreen){Text("loi")}.hidden() } .onAppear(perform: { @@ -168,6 +178,7 @@ struct AttPrev:View{ //download all functionality if self.shouldBeDownloaded {self.isDownloaded=true; self.download()} }) + // remove file from documents directory .onDisappear(perform: { let filename = getDocumentsDirectory().appendingPathComponent(self.attachment.myName) -- GitLab