Эх сурвалжийг харах

Revert "Merge pull request #2454 from nextcloud/PDF"

This reverts commit 59758b3e593e38241b4bf956b57dd83ae6350833, reversing
changes made to b75d3afcef26514d5c8a60e6482eac0b62d33f82.

Signed-off-by: Marino Faggiana <marino@marinofaggiana.com>
Marino Faggiana 1 жил өмнө
parent
commit
c1b1105e3f

+ 2 - 2
Nextcloud.xcodeproj/project.pbxproj

@@ -3970,7 +3970,7 @@
 				CLANG_WARN_UNREACHABLE_CODE = YES;
 				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
 				COPY_PHASE_STRIP = NO;
-				CURRENT_PROJECT_VERSION = 4;
+				CURRENT_PROJECT_VERSION = 3;
 				DEVELOPMENT_TEAM = NKUJUXUJ3B;
 				ENABLE_STRICT_OBJC_MSGSEND = YES;
 				ENABLE_TESTABILITY = YES;
@@ -4033,7 +4033,7 @@
 				CLANG_WARN_UNREACHABLE_CODE = YES;
 				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
 				COPY_PHASE_STRIP = NO;
-				CURRENT_PROJECT_VERSION = 4;
+				CURRENT_PROJECT_VERSION = 3;
 				DEVELOPMENT_TEAM = NKUJUXUJ3B;
 				ENABLE_STRICT_OBJC_MSGSEND = YES;
 				ENABLE_TESTABILITY = YES;

+ 7 - 2
iOSClient/Viewer/NCViewerPDF/NCViewerPDF.storyboard

@@ -36,14 +36,19 @@
                         <rect key="frame" x="0.0" y="0.0" width="414" height="736"/>
                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                         <subviews>
-                            <view contentMode="scaleToFill" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="wnh-nF-AjD">
+                            <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="wnh-nF-AjD">
                                 <rect key="frame" x="0.0" y="21" width="414" height="715"/>
-                                <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
                                 <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
                             </view>
                         </subviews>
                         <viewLayoutGuide key="safeArea" id="QiL-bG-Ojl"/>
                         <color key="backgroundColor" systemColor="systemBackgroundColor"/>
+                        <constraints>
+                            <constraint firstItem="wnh-nF-AjD" firstAttribute="leading" secondItem="QiL-bG-Ojl" secondAttribute="leading" id="49g-1K-X2G"/>
+                            <constraint firstAttribute="bottom" secondItem="wnh-nF-AjD" secondAttribute="bottom" id="9yz-fc-kA9"/>
+                            <constraint firstItem="wnh-nF-AjD" firstAttribute="top" secondItem="QiL-bG-Ojl" secondAttribute="top" constant="1" id="Snr-Xx-Peu"/>
+                            <constraint firstItem="QiL-bG-Ojl" firstAttribute="trailing" secondItem="wnh-nF-AjD" secondAttribute="trailing" id="nvb-SR-s8x"/>
+                        </constraints>
                     </view>
                     <connections>
                         <outlet property="pdfContainer" destination="wnh-nF-AjD" id="gAz-vm-JVr"/>

+ 9 - 14
iOSClient/Viewer/NCViewerPDF/NCViewerPDF.swift

@@ -47,10 +47,12 @@ class NCViewerPDF: UIViewController, NCViewerPDFSearchDelegate {
     private let thumbnailViewWidth: CGFloat = 80
     private let thumbnailPadding: CGFloat = 2
     private let animateDuration: TimeInterval = 0.3
+    private let pageViewtopAnchor: CGFloat = UIDevice.current.userInterfaceIdiom == .phone ? 10 : 30
     private let window = UIApplication.shared.connectedScenes.flatMap { ($0 as? UIWindowScene)?.windows ?? [] }.first { $0.isKeyWindow }
 
     private var defaultBackgroundColor: UIColor = .clear
 
+    private var pdfThumbnailScrollViewTopAnchor: NSLayoutConstraint?
     private var pdfThumbnailScrollViewTrailingAnchor: NSLayoutConstraint?
     private var pdfThumbnailScrollViewWidthAnchor: NSLayoutConstraint?
     private var pageViewWidthAnchor: NSLayoutConstraint?
@@ -74,6 +76,7 @@ class NCViewerPDF: UIViewController, NCViewerPDFSearchDelegate {
         defaultBackgroundColor = pdfView.backgroundColor
         view.backgroundColor = defaultBackgroundColor
 
+        navigationController?.navigationBar.prefersLargeTitles = false
         navigationItem.rightBarButtonItem = UIBarButtonItem(image: UIImage(named: "more")!.image(color: .label, size: 25), style: .plain, target: self, action: #selector(self.openMenuMore))
         navigationItem.title = metadata.fileNameView
 
@@ -107,13 +110,12 @@ class NCViewerPDF: UIViewController, NCViewerPDFSearchDelegate {
         preferences.animating.dismissDuration = 1.5
 
         tipView = EasyTipView(text: NSLocalizedString("_tip_pdf_thumbnails_", comment: ""), preferences: preferences, delegate: self)
-
-        createview()
     }
 
     override func viewDidAppear(_ animated: Bool) {
         super.viewDidAppear(animated)
 
+        createview()
         showTip()
     }
 
@@ -142,16 +144,6 @@ class NCViewerPDF: UIViewController, NCViewerPDFSearchDelegate {
 
     func createview() {
 
-        // PDF CONTAINER
-
-        pdfContainer.translatesAutoresizingMaskIntoConstraints = false
-        NSLayoutConstraint.activate([
-            pdfContainer.topAnchor.constraint(equalTo: view.topAnchor),
-            pdfContainer.bottomAnchor.constraint(equalTo: view.bottomAnchor),
-            pdfContainer.leadingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.leadingAnchor),
-            pdfContainer.trailingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.trailingAnchor)
-        ])
-
         // PDF VIEW
 
         pdfView = PDFView(frame: CGRect(x: 0, y: 0, width: pdfContainer.frame.width, height: pdfContainer.frame.height))
@@ -173,7 +165,8 @@ class NCViewerPDF: UIViewController, NCViewerPDFSearchDelegate {
         pdfContainer.addSubview(pdfThumbnailScrollView)
 
         pdfThumbnailScrollView.bottomAnchor.constraint(equalTo: pdfContainer.bottomAnchor).isActive = true
-        pdfThumbnailScrollView.topAnchor.constraint(equalTo: self.pdfView.topAnchor).isActive = true
+        pdfThumbnailScrollViewTopAnchor = pdfThumbnailScrollView.topAnchor.constraint(equalTo: pdfContainer.safeAreaLayoutGuide.topAnchor)
+        pdfThumbnailScrollViewTopAnchor?.isActive = true
         pdfThumbnailScrollViewTrailingAnchor = pdfThumbnailScrollView.trailingAnchor.constraint(equalTo: pdfContainer.trailingAnchor)
         pdfThumbnailScrollViewTrailingAnchor?.isActive = true
         pdfThumbnailScrollViewWidthAnchor = pdfThumbnailScrollView.widthAnchor.constraint(equalToConstant: thumbnailViewWidth)
@@ -215,7 +208,7 @@ class NCViewerPDF: UIViewController, NCViewerPDFSearchDelegate {
         pdfContainer.addSubview(pageView)
 
         NSLayoutConstraint.activate([
-            pageView.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor, constant: 15),
+            pageView.topAnchor.constraint(equalTo: pdfContainer.safeAreaLayoutGuide.topAnchor, constant: pageViewtopAnchor),
             pageView.heightAnchor.constraint(equalToConstant: 30),
             pageView.leftAnchor.constraint(equalTo: pdfContainer.safeAreaLayoutGuide.leftAnchor, constant: 10)
         ])
@@ -420,9 +413,11 @@ class NCViewerPDF: UIViewController, NCViewerPDFSearchDelegate {
             if navigationController?.isNavigationBarHidden ?? false {
                 navigationController?.setNavigationBarHidden(false, animated: true)
                 hideStatusBar = false
+                pdfThumbnailScrollViewTopAnchor = pdfThumbnailScrollView.topAnchor.constraint(equalTo: pdfContainer.safeAreaLayoutGuide.topAnchor)
             } else {
                 navigationController?.setNavigationBarHidden(true, animated: true)
                 hideStatusBar = true
+                pdfThumbnailScrollViewTopAnchor = pdfThumbnailScrollView.topAnchor.constraint(equalTo: pdfContainer.topAnchor)
             }
         }