diff --git a/enzevalos_iphone/SwiftUI/Read/Tabbed Views/AttachmentsViewMain.swift b/enzevalos_iphone/SwiftUI/Read/Tabbed Views/AttachmentsViewMain.swift index e17610ab4c49decd012770a2d53a42c710e3ab90..660c5f9cc8d627b01d961cab4d77d3504b7f1951 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)