marinofaggiana 4 سال پیش
والد
کامیت
12fa98f7d1

+ 4 - 4
Nextcloud.xcodeproj/project.pbxproj

@@ -55,7 +55,7 @@
 		F710D1FE24057E5E00A6033D /* NCActionSheetHeader.swift in Sources */ = {isa = PBXBuildFile; fileRef = F710D1FB24057E5E00A6033D /* NCActionSheetHeader.swift */; };
 		F710D1FF24057E5E00A6033D /* NCActionSheetHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F710D1FC24057E5E00A6033D /* NCActionSheetHeaderView.swift */; };
 		F710D20024057E5E00A6033D /* NCActionSheetHeaderView.xib in Resources */ = {isa = PBXBuildFile; fileRef = F710D1FD24057E5E00A6033D /* NCActionSheetHeaderView.xib */; };
-		F710D2022405826100A6033D /* NCDetailNavigationController+Menu.swift in Sources */ = {isa = PBXBuildFile; fileRef = F710D2012405826100A6033D /* NCDetailNavigationController+Menu.swift */; };
+		F710D2022405826100A6033D /* NCViewer+Menu.swift in Sources */ = {isa = PBXBuildFile; fileRef = F710D2012405826100A6033D /* NCViewer+Menu.swift */; };
 		F710E8111EF95C9C00DC2427 /* ImagesIntro.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = F710E80F1EF95C9C00DC2427 /* ImagesIntro.xcassets */; };
 		F713FF002472764100214AF6 /* UIImage+animatedGIF.m in Sources */ = {isa = PBXBuildFile; fileRef = F713FEFF2472764100214AF6 /* UIImage+animatedGIF.m */; };
 		F71459BA1D12E3B700CAFEEC /* NSString+TruncateToWidth.m in Sources */ = {isa = PBXBuildFile; fileRef = F73049B91CB567F000C7C320 /* NSString+TruncateToWidth.m */; };
@@ -395,7 +395,7 @@
 		F710D1FB24057E5E00A6033D /* NCActionSheetHeader.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NCActionSheetHeader.swift; sourceTree = "<group>"; };
 		F710D1FC24057E5E00A6033D /* NCActionSheetHeaderView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NCActionSheetHeaderView.swift; sourceTree = "<group>"; };
 		F710D1FD24057E5E00A6033D /* NCActionSheetHeaderView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = NCActionSheetHeaderView.xib; sourceTree = "<group>"; };
-		F710D2012405826100A6033D /* NCDetailNavigationController+Menu.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NCDetailNavigationController+Menu.swift"; sourceTree = "<group>"; };
+		F710D2012405826100A6033D /* NCViewer+Menu.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NCViewer+Menu.swift"; sourceTree = "<group>"; };
 		F710E80F1EF95C9C00DC2427 /* ImagesIntro.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = ImagesIntro.xcassets; sourceTree = "<group>"; };
 		F713FEFE2472764000214AF6 /* UIImage+animatedGIF.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIImage+animatedGIF.h"; sourceTree = "<group>"; };
 		F713FEFF2472764100214AF6 /* UIImage+animatedGIF.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIImage+animatedGIF.m"; sourceTree = "<group>"; };
@@ -797,7 +797,7 @@
 				3781B9AF23DB2B7E006B4B1D /* AppDelegate+Menu.swift */,
 				F77A697C250A0FBC00FF1708 /* NCCollectionViewCommon+Menu.swift */,
 				F7CBC31B24F78E79004D3812 /* NCSortMenu.swift */,
-				F710D2012405826100A6033D /* NCDetailNavigationController+Menu.swift */,
+				F710D2012405826100A6033D /* NCViewer+Menu.swift */,
 				371B5A2D23D0B04500FAFAE9 /* NCMainMenuTableViewController.swift */,
 				3704EB2923D5A58400455C5B /* NCMenu.storyboard */,
 				37ECC83A23D0C7400082EFA2 /* NCMenuAction.swift */,
@@ -2030,7 +2030,7 @@
 				F78ACD52219046DC0088454D /* NCSectionHeaderFooter.swift in Sources */,
 				F749C10C23C4A5340027D966 /* NCIntroViewController.swift in Sources */,
 				F77B0E1B1D118A16002130FE /* CCGraphics.m in Sources */,
-				F710D2022405826100A6033D /* NCDetailNavigationController+Menu.swift in Sources */,
+				F710D2022405826100A6033D /* NCViewer+Menu.swift in Sources */,
 				3757A35523D9D76300EC369E /* NCMenuPanelController.swift in Sources */,
 				F77A697D250A0FBC00FF1708 /* NCCollectionViewCommon+Menu.swift in Sources */,
 				F7CA1ED320E7E3FE002CC65E /* PKStopDownloadButton.m in Sources */,

+ 7 - 11
iOSClient/Main/Menu/NCDetailNavigationController+Menu.swift → iOSClient/Main/Menu/NCViewer+Menu.swift

@@ -24,13 +24,9 @@
 import FloatingPanel
 import NCCommunication
 
-/*
-extension NCDetailNavigationController {
+extension NCViewer {
 
     @objc func toggleMoreMenu(viewController: UIViewController, metadata: tableMetadata) {
-        if appDelegate.activeDetail.backgroundView.subviews.first == nil && appDelegate.activeDetail.viewerImageViewController == nil {
-            return
-        }
         
         let mainMenuViewController = UIStoryboard.init(name: "NCMenu", bundle: nil).instantiateViewController(withIdentifier: "NCMainMenuTableViewController") as! NCMainMenuTableViewController
         
@@ -65,6 +61,7 @@ extension NCDetailNavigationController {
     }
     
     private func initMoreMenu(viewController: UIViewController, metadata: tableMetadata) -> [NCMenuAction] {
+        
         var actions = [NCMenuAction]()
         var titleFavorite = NSLocalizedString("_add_favorites_", comment: "")
         if metadata.favorite { titleFavorite = NSLocalizedString("_remove_favorites_", comment: "") }
@@ -111,7 +108,7 @@ extension NCDetailNavigationController {
                 title: NSLocalizedString("_details_", comment: ""),
                 icon: CCGraphics.changeThemingColorImage(UIImage(named: "details"), width: 50, height: 50, color: NCBrandColor.sharedInstance.icon),
                 action: { menuAction in
-                    NCNetworkingNotificationCenter.shared.openShare(ViewController: self, metadata: metadata, indexPage: 0)
+                    NCNetworkingNotificationCenter.shared.openShare(ViewController: viewController, metadata: metadata, indexPage: 0)
                 }
             )
         )
@@ -144,7 +141,7 @@ extension NCDetailNavigationController {
                     let cancelAction = UIAlertAction(title: NSLocalizedString("_cancel_", comment: ""), style: .cancel, handler: nil)
                     let okAction = UIAlertAction(title: NSLocalizedString("_ok_", comment: ""), style: .default, handler: { action in
                         let fileNameNew = alertController.textFields![0].text
-                        NCNetworking.shared.renameMetadata(metadata, fileNameNew: fileNameNew!, urlBase: self.appDelegate.urlBase, viewController: self) { (errorCode, errorDescription) in
+                        NCNetworking.shared.renameMetadata(metadata, fileNameNew: fileNameNew!, urlBase: self.appDelegate.urlBase, viewController: viewController) { (errorCode, errorDescription) in
                             if errorCode != 0 {
                                 NCContentPresenter.shared.messageNotification("_error_", description: errorDescription, delay: TimeInterval(k_dismissAfterSecond), type: NCContentPresenter.messageType.error, errorCode: errorCode)
                             }
@@ -153,7 +150,7 @@ extension NCDetailNavigationController {
                     alertController.addAction(cancelAction)
                     alertController.addAction(okAction)
 
-                    self.present(alertController, animated: true, completion: nil)
+                    viewController.present(alertController, animated: true, completion: nil)
                 }
             )
         )
@@ -183,7 +180,7 @@ extension NCDetailNavigationController {
                     viewController.isOverwriteHide = false
                     
                     navigationController.modalPresentationStyle = UIModalPresentationStyle.fullScreen
-                    self.present(navigationController, animated: true, completion: nil)
+                    viewController.present(navigationController, animated: true, completion: nil)
                 }
             )
         )
@@ -244,7 +241,7 @@ extension NCDetailNavigationController {
                     
                     alertController.addAction(UIAlertAction(title: NSLocalizedString("_no_delete_", comment: ""), style: .default) { (action:UIAlertAction) in })
                                         
-                    self.present(alertController, animated: true, completion:nil)
+                    viewController.present(alertController, animated: true, completion:nil)
                 }
             )
         )
@@ -309,4 +306,3 @@ extension NCDetailNavigationController {
         return actions
     }
 }
-*/

+ 6 - 3
iOSClient/Viewer/NCViewer.swift

@@ -25,6 +25,8 @@ import Foundation
 
 class NCViewer: NSObject {
     
+    let appDelegate = UIApplication.shared.delegate as! AppDelegate
+
     init(navigationController: UINavigationController, metadata: tableMetadata) {
         super.init()
                 
@@ -33,11 +35,12 @@ class NCViewer: NSObject {
             // PDF
             if metadata.contentType == "application/pdf" {
                     
-                let ViewController:NCViewerPDF = UIStoryboard(name: "NCViewerPDF", bundle: nil).instantiateInitialViewController() as! NCViewerPDF
+                let viewController:NCViewerPDF = UIStoryboard(name: "NCViewerPDF", bundle: nil).instantiateInitialViewController() as! NCViewerPDF
                 
-                ViewController.metadata = metadata
+                viewController.metadata = metadata
+                viewController.viewer = self
                 
-                navigationController.pushViewController(ViewController, animated: true)
+                navigationController.pushViewController(viewController, animated: true)
             }
         }
     }

+ 15 - 6
iOSClient/Viewer/NCViewerPDF/NCViewerPDF.swift

@@ -24,9 +24,12 @@
 import Foundation
 import PDFKit
 
-@objc class NCViewerPDF: UIViewController, NCViewerPDFSearchDelegate {
+class NCViewerPDF: UIViewController, NCViewerPDFSearchDelegate {
+    
+    let appDelegate = UIApplication.shared.delegate as! AppDelegate
+    var metadata = tableMetadata()
+    var viewer: NCViewer?
     
-    private let appDelegate = UIApplication.shared.delegate as! AppDelegate
     private var pdfView = PDFView()
     private var thumbnailViewHeight: CGFloat = 40
     private var pdfThumbnailView: PDFThumbnailView?
@@ -35,7 +38,6 @@ import PDFKit
     private let pageViewLabel = UILabel()
     private var pageViewWidthAnchor : NSLayoutConstraint?
     
-    var metadata = tableMetadata()
     
     required init?(coder aDecoder: NSCoder) {
         super.init(coder: aDecoder)
@@ -116,11 +118,18 @@ import PDFKit
     override func viewWillAppear(_ animated: Bool) {
         super.viewWillAppear(animated)
 
-        self.navigationController?.navigationBar.prefersLargeTitles = true
-        self.navigationItem.title = metadata.fileNameView
+        let buttonMore = UIBarButtonItem.init(image: CCGraphics.changeThemingColorImage(UIImage(named: "more"), width: 50, height: 50, color: NCBrandColor.sharedInstance.textView), style: .plain, target: self, action: #selector(self.openMenuMore))
+        navigationItem.rightBarButtonItem = buttonMore
+        
+        navigationController?.navigationBar.prefersLargeTitles = true
+        navigationItem.title = metadata.fileNameView
 
         appDelegate.activeViewController = self
-    }   
+    }
+    
+    @objc func openMenuMore() {
+        viewer?.toggleMoreMenu(viewController: self, metadata: metadata)
+    }
     
     //MARK: - NotificationCenter