marinofaggiana há 5 anos atrás
pai
commit
369e3a5f85
1 ficheiros alterados com 28 adições e 22 exclusões
  1. 28 22
      iOSClient/Viewer/NCViewerPDF/NCViewerPDF.swift

+ 28 - 22
iOSClient/Viewer/NCViewerPDF/NCViewerPDF.swift

@@ -50,28 +50,6 @@ import PDFKit
         NotificationCenter.default.addObserver(self, selector: #selector(handlePageChange), name: Notification.Name.PDFViewPageChanged, object: nil)
     }
     
-    @objc private func handlePageChange() {
-        
-        guard let curPage = currentPage?.pageRef?.pageNumber else { pageView.alpha = 0; return }
-        guard let totalPages = document?.pageCount else { return }
-        
-        pageView.alpha = 1
-        pageViewLabel.text = String(curPage) + " " + NSLocalizedString("_of_", comment: "") + " " + String(totalPages)
-        pageViewWidthAnchor?.constant = pageViewLabel.intrinsicContentSize.width + 10
-        
-        UIView.animate(withDuration: 1.0, delay: 3.0, animations: {
-            self.pageView.alpha = 0
-        })
-    }
-    
-    @objc func changeTheming() {
-        guard let navigationController = appDelegate.activeDetail.navigationController else { return }
-
-        if navigationController.isNavigationBarHidden == false {
-            backgroundColor = NCBrandColor.sharedInstance.backgroundView
-        }
-    }
-    
     @objc func setupPdfView(filePath: URL, view: UIView) {
         pdfDocument = PDFDocument(url: filePath)
         
@@ -131,6 +109,32 @@ import PDFKit
         view.addGestureRecognizer(tapGesture)
     }
     
+    //MARK: - NotificationCenter
+    
+    @objc private func handlePageChange() {
+        
+        guard let curPage = currentPage?.pageRef?.pageNumber else { pageView.alpha = 0; return }
+        guard let totalPages = document?.pageCount else { return }
+        
+        pageView.alpha = 1
+        pageViewLabel.text = String(curPage) + " " + NSLocalizedString("_of_", comment: "") + " " + String(totalPages)
+        pageViewWidthAnchor?.constant = pageViewLabel.intrinsicContentSize.width + 10
+        
+        UIView.animate(withDuration: 1.0, delay: 3.0, animations: {
+            self.pageView.alpha = 0
+        })
+    }
+    
+    @objc func changeTheming() {
+        guard let navigationController = appDelegate.activeDetail.navigationController else { return }
+
+        if navigationController.isNavigationBarHidden == false {
+            backgroundColor = NCBrandColor.sharedInstance.backgroundView
+        }
+    }
+    
+    //MARK: - Gesture Recognizer
+    
     @objc func didTap(_ recognizer: UITapGestureRecognizer) {
         guard let navigationController = appDelegate.activeDetail.navigationController else { return }
         
@@ -162,6 +166,8 @@ import PDFKit
         self.frame = CGRect(x: 0, y: 0, width: size.width, height: height)
     }
     
+    //MARK: - 
+    
     @objc func searchText() {
         
         let viewerPDFSearch = UIStoryboard.init(name: "NCViewerPDF", bundle: nil).instantiateViewController(withIdentifier: "NCViewerPDFSearch") as! NCViewerPDFSearch