Forráskód Böngészése

Merge pull request #1987 from nextcloud/feature/pdfview

Pdfview Improvements
Marino Faggiana 3 éve
szülő
commit
8516defa32

+ 0 - 17
Nextcloud.xcodeproj/project.pbxproj

@@ -257,7 +257,6 @@
 		F76DA963277B760E0082465B /* Queuer in Frameworks */ = {isa = PBXBuildFile; productRef = F76DA962277B760E0082465B /* Queuer */; };
 		F76DA966277B76F30082465B /* UICKeyChainStore in Frameworks */ = {isa = PBXBuildFile; productRef = F76DA965277B76F30082465B /* UICKeyChainStore */; };
 		F76DA969277B77EA0082465B /* DropDown in Frameworks */ = {isa = PBXBuildFile; productRef = F76DA968277B77EA0082465B /* DropDown */; };
-		F76DA96C277B78400082465B /* FSCalendar in Frameworks */ = {isa = PBXBuildFile; productRef = F76DA96B277B78400082465B /* FSCalendar */; };
 		F76DA96F277B78AE0082465B /* TLPhotoPicker in Frameworks */ = {isa = PBXBuildFile; productRef = F76DA96E277B78AE0082465B /* TLPhotoPicker */; };
 		F7707687263A853700A1BA94 /* NCContentPresenter.swift in Sources */ = {isa = PBXBuildFile; fileRef = F765608E23BF813500765969 /* NCContentPresenter.swift */; };
 		F7707689263A896A00A1BA94 /* UIImage+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7B7504A2397D38E004E13EC /* UIImage+Extensions.swift */; };
@@ -1030,7 +1029,6 @@
 				F72DA9B425F53E4E00B87DB1 /* SwiftRichString in Frameworks */,
 				F74E7720277A2EF40013B958 /* XLForm in Frameworks */,
 				F73ADD1C265546890069EA0D /* SwiftEntryKit in Frameworks */,
-				F76DA96C277B78400082465B /* FSCalendar in Frameworks */,
 				F76DA93F277B75870082465B /* KTVCocoaHTTPServer.xcframework in Frameworks */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
@@ -2083,7 +2081,6 @@
 				F76DA962277B760E0082465B /* Queuer */,
 				F76DA965277B76F30082465B /* UICKeyChainStore */,
 				F76DA968277B77EA0082465B /* DropDown */,
-				F76DA96B277B78400082465B /* FSCalendar */,
 				F76DA96E277B78AE0082465B /* TLPhotoPicker */,
 				F710FC79277B7D0000AA9FBF /* Realm */,
 				F710FC7B277B7D0000AA9FBF /* RealmSwift */,
@@ -2212,7 +2209,6 @@
 				F76DA961277B760E0082465B /* XCRemoteSwiftPackageReference "Queuer" */,
 				F76DA964277B76F10082465B /* XCRemoteSwiftPackageReference "UICKeyChainStore" */,
 				F76DA967277B77E90082465B /* XCRemoteSwiftPackageReference "DropDown" */,
-				F76DA96A277B78400082465B /* XCRemoteSwiftPackageReference "FSCalendar" */,
 				F76DA96D277B78AE0082465B /* XCRemoteSwiftPackageReference "TLPhotoPicker" */,
 				F710FC78277B7CFF00AA9FBF /* XCRemoteSwiftPackageReference "realm-swift" */,
 				F7233B3827835FA300F40A43 /* XCRemoteSwiftPackageReference "ChromaColorPicker" */,
@@ -3265,14 +3261,6 @@
 				kind = branch;
 			};
 		};
-		F76DA96A277B78400082465B /* XCRemoteSwiftPackageReference "FSCalendar" */ = {
-			isa = XCRemoteSwiftPackageReference;
-			repositoryURL = "https://github.com/WenchaoD/FSCalendar";
-			requirement = {
-				kind = upToNextMajorVersion;
-				minimumVersion = 2.0.0;
-			};
-		};
 		F76DA96D277B78AE0082465B /* XCRemoteSwiftPackageReference "TLPhotoPicker" */ = {
 			isa = XCRemoteSwiftPackageReference;
 			repositoryURL = "https://github.com/tilltue/TLPhotoPicker";
@@ -3459,11 +3447,6 @@
 			package = F76DA967277B77E90082465B /* XCRemoteSwiftPackageReference "DropDown" */;
 			productName = DropDown;
 		};
-		F76DA96B277B78400082465B /* FSCalendar */ = {
-			isa = XCSwiftPackageProductDependency;
-			package = F76DA96A277B78400082465B /* XCRemoteSwiftPackageReference "FSCalendar" */;
-			productName = FSCalendar;
-		};
 		F76DA96E277B78AE0082465B /* TLPhotoPicker */ = {
 			isa = XCSwiftPackageProductDependency;
 			package = F76DA96D277B78AE0082465B /* XCRemoteSwiftPackageReference "TLPhotoPicker" */;

+ 0 - 12
iOSClient/Images.xcassets/pdf-horizontal.imageset/Contents.json

@@ -1,12 +0,0 @@
-{
-  "images" : [
-    {
-      "filename" : "swap-horizontal-variant.svg",
-      "idiom" : "universal"
-    }
-  ],
-  "info" : {
-    "author" : "xcode",
-    "version" : 1
-  }
-}

+ 0 - 1
iOSClient/Images.xcassets/pdf-horizontal.imageset/swap-horizontal-variant.svg

@@ -1 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="24" height="24" viewBox="0 0 24 24"><path d="M4,6L8,10V7H16A2,2 0 0,1 18,9A2,2 0 0,1 16,11H8A4,4 0 0,0 4,15A4,4 0 0,0 8,19H16V22L20,18L16,14V17H8A2,2 0 0,1 6,15A2,2 0 0,1 8,13H16A4,4 0 0,0 20,9A4,4 0 0,0 16,5H8V2L4,6Z" /></svg>

+ 0 - 12
iOSClient/Images.xcassets/pdf-vertical.imageset/Contents.json

@@ -1,12 +0,0 @@
-{
-  "images" : [
-    {
-      "filename" : "swap-vertical-variant.svg",
-      "idiom" : "universal"
-    }
-  ],
-  "info" : {
-    "author" : "xcode",
-    "version" : 1
-  }
-}

+ 0 - 1
iOSClient/Images.xcassets/pdf-vertical.imageset/swap-vertical-variant.svg

@@ -1 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="24" height="24" viewBox="0 0 24 24"><path d="M18,4L14,8H17V16A2,2 0 0,1 15,18A2,2 0 0,1 13,16V8A4,4 0 0,0 9,4A4,4 0 0,0 5,8V16H2L6,20L10,16H7V8A2,2 0 0,1 9,6A2,2 0 0,1 11,8V16A4,4 0 0,0 15,20A4,4 0 0,0 19,16V8H22L18,4Z" /></svg>

+ 3 - 2
iOSClient/Settings/Acknowledgements.m

@@ -31,12 +31,13 @@
 - (void)viewDidLoad
 {
     [super viewDidLoad];
-    
+
     NSURL *rtfPath = [[NSBundle mainBundle]  URLForResource:@"Acknowledgements" withExtension:@"rtf"];
     
     NSAttributedString *attributedStringWithRtf = [[NSAttributedString alloc] initWithURL:rtfPath options:@{NSDocumentTypeDocumentAttribute:NSRTFTextDocumentType} documentAttributes:nil error:nil];
     self.txtTermini.attributedText = attributedStringWithRtf;
-    
+
+    self.navigationController.navigationBar.backgroundColor = [UIColor whiteColor];
     self.view.backgroundColor = [UIColor whiteColor];
     self.title = NSLocalizedString(@"_acknowledgements_", nil);
     self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(cancelPressed)];

+ 32 - 31
iOSClient/Settings/Acknowledgements.rtf

@@ -1,4 +1,4 @@
-{\rtf1\ansi\ansicpg1252\cocoartf2636
+{\rtf1\ansi\ansicpg1252\cocoartf2638
 \cocoatextscaling0\cocoaplatform0{\fonttbl\f0\fswiss\fcharset0 Helvetica;\f1\fswiss\fcharset0 Helvetica-Bold;}
 {\colortbl;\red255\green255\blue255;}
 {\*\expandedcolortbl;;}
@@ -8,7 +8,7 @@
 \f0\fs24 \cf0 \
 This software contains additional third party software. \
 All the third party software included or linked is redistributed under the terms and conditions of their original licenses. \
-____________________________________________\
+__________________________________\
 \
 
 \f1\b Nextcloud iOS Communication Library\
@@ -29,12 +29,12 @@ SwiftyXMLParser -
 \f1\b \
 SwiftyJSON - 
 \f0\b0 MIT License (MIT) \
-____________________________________________\
+__________________________________\
 \
 
 \f1\b NYMnemonic - BIP 39 style mnemonic codes\
 
-\f0\b0 ____________________________________________\
+\f0\b0 __________________________________\
 \
 
 \f1\b OpenSSL\
@@ -45,7 +45,7 @@ ____________________________________________\
 \f1\b \
 
 \f0\b0 Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)\
-____________________________________________\
+__________________________________\
 \
 
 \f1\b Realm
@@ -54,7 +54,7 @@ ____________________________________________\
 Apache License 2.0\
 \
 Copyright (c) 2014-2017 https://realm.io\
-____________________________________________\
+__________________________________\
 \
 
 \f1\b UICKeyChainStore
@@ -63,7 +63,7 @@ ____________________________________________\
 MIT License\
 \
 Copyright (c) kishikawa katsumi\
-____________________________________________\
+__________________________________\
 \
 
 \f1\b XLForm
@@ -72,7 +72,7 @@ ____________________________________________\
 MIT License\
 \
 Copyright (c) Xmartlabs ( http://xmartlabs.com )\
-____________________________________________\
+__________________________________\
 \
 
 \f1\b KTVHTTPCache
@@ -81,7 +81,7 @@ ____________________________________________\
 MIT License\
 \
 Copyright (c) libobjc\
-____________________________________________\
+__________________________________\
 \
 
 \f1\b SVGKit
@@ -90,7 +90,7 @@ ____________________________________________\
 https://github.com/SVGKit/SVGKit/blob/3.x/LICENSE\
 \
 Copyright (c) 2010-2011 Matt Rajca, 2011-2015 various authors (c) Tipbit Inc\
-____________________________________________\
+__________________________________\
 \
 
 \f1\b SwiftRichString
@@ -99,7 +99,7 @@ ____________________________________________\
 MIT License\
 \
 Copyright (c) Daniele Margutti\
-____________________________________________\
+__________________________________\
 \
 
 \f1\b QRCodeReader
@@ -108,7 +108,7 @@ ____________________________________________\
 MIT License\
 \
 Copyright (c) Yannick Loriot\
-____________________________________________\
+__________________________________\
 \
 
 \f1\b Parchment
@@ -117,16 +117,7 @@ ____________________________________________\
 MIT License\
 \
 Copyright (c) Martin Rechsteiner\
-____________________________________________\
-\
-
-\f1\b FSCalendar
-\f0\b0 \
-\
-MIT License\
-\
-Copyright (c) Wenchao Ding\
-____________________________________________\
+__________________________________\
 \
 
 \f1\b DropDown
@@ -135,7 +126,7 @@ ____________________________________________\
 MIT License\
 \
 Copyright (c) Kevin Hirsch\
-____________________________________________\
+__________________________________\
 \
 
 \f1\b TLPhotoPicker
@@ -144,7 +135,7 @@ ____________________________________________\
 MIT License\
 \
 Copyright (c) wade.hawk, junhyi.park@gmail.com\
-____________________________________________\
+__________________________________\
 \
 
 \f1\b SwiftEntryKit
@@ -153,7 +144,7 @@ ____________________________________________\
 MIT License\
 \
 Copyright (c)  Daniel Huri, huri000@gmail.com\
-____________________________________________\
+__________________________________\
 \
 
 \f1\b FloatingPanel
@@ -162,14 +153,14 @@ ____________________________________________\
 MIT License\
 \
 Copyright (c)  Shin Yamamoto shin@scenee.com\
-____________________________________________\
+__________________________________\
 \
 
 \f1\b MarkdownKit
 \f0\b0 \
 \
 MIT License\
-____________________________________________\
+__________________________________\
 \
 
 \f1\b Firebase Crashlytics
@@ -178,7 +169,7 @@ ____________________________________________\
 Apache License 2.0\
 \
 Copyright (c) Google Inc.\
-____________________________________________\
+__________________________________\
 \
 
 \f1\b Queuer
@@ -187,7 +178,7 @@ ____________________________________________\
 MIT License\
 \
 Copyright (c)  Fabrizio Brancati\
-____________________________________________\
+__________________________________\
 \
 
 \f1\b TOPasscodeViewController
@@ -196,7 +187,7 @@ ____________________________________________\
 MIT License\
 \
 Copyright (c)  Tim Oliver\
-____________________________________________\
+__________________________________\
 \
 
 \f1\b JGProgressHUD
@@ -205,5 +196,15 @@ ____________________________________________\
 MIT License\
 \
 Copyright (c)  Jonas Gessner\
-____________________________________________\
+__________________________________\
+\
+
+\f1\b EasyTipView
+\f0\b0 \
+\
+MIT License\
+\
+Copyright (c)  Teodor Patras\
+__________________________________\
+\
 }

+ 0 - 1
iOSClient/Share/NCShareCommon.swift

@@ -21,7 +21,6 @@
 //  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 import UIKit
-import FSCalendar
 import DropDown
 
 class NCShareCommon: NSObject {

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

@@ -25,7 +25,7 @@ import UIKit
 import PDFKit
 import EasyTipView
 
-class NCViewerPDF: UIViewController, NCViewerPDFSearchDelegate, UIGestureRecognizerDelegate {
+class NCViewerPDF: UIViewController, NCViewerPDFSearchDelegate {
 
     var metadata = tableMetadata()
     var imageIcon: UIImage?
@@ -63,7 +63,11 @@ class NCViewerPDF: UIViewController, NCViewerPDFSearchDelegate, UIGestureRecogni
         filePath = CCUtility.getDirectoryProviderStorageOcId(metadata.ocId, fileNameView: metadata.fileNameView)!
         pdfDocument = PDFDocument(url: URL(fileURLWithPath: filePath))
         let pageCount = CGFloat(pdfDocument?.pageCount ?? 0)
-        defaultBackgroundColor = pdfView.backgroundColor
+        if #available(iOS 13.0, *) {
+            defaultBackgroundColor = pdfView.backgroundColor
+        } else {
+            defaultBackgroundColor = .lightGray
+        }
         view.backgroundColor = defaultBackgroundColor
 
         navigationItem.rightBarButtonItem = UIBarButtonItem(image: UIImage(named: "more")!.image(color: NCBrandColor.shared.label, size: 25), style: .plain, target: self, action: #selector(self.openMenuMore))
@@ -170,19 +174,17 @@ class NCViewerPDF: UIViewController, NCViewerPDFSearchDelegate, UIGestureRecogni
 
         let swipePdfView = UISwipeGestureRecognizer(target: self, action: #selector(gestureClosePdfThumbnail))
         swipePdfView.direction = .right
+        swipePdfView.delegate = self
         pdfView.addGestureRecognizer(swipePdfView)
 
-        let swipePdfThumbnailScrollView = UISwipeGestureRecognizer(target: self, action: #selector(gestureClosePdfThumbnail))
-        swipePdfThumbnailScrollView.direction = .right
-        pdfThumbnailScrollView.addGestureRecognizer(swipePdfThumbnailScrollView)
-
         let edgePdfView = UIScreenEdgePanGestureRecognizer(target: self, action: #selector(gestureOpenPdfThumbnail))
         edgePdfView.edges = .right
+        edgePdfView.delegate = self
         pdfView.addGestureRecognizer(edgePdfView)
 
-        let edgeView = UIScreenEdgePanGestureRecognizer(target: self, action: #selector(gestureOpenPdfThumbnail))
-        edgeView.edges = .right
-        view.addGestureRecognizer(edgeView)
+        let swipePdfThumbnailScrollView = UISwipeGestureRecognizer(target: self, action: #selector(gestureClosePdfThumbnail))
+        swipePdfThumbnailScrollView.direction = .right
+        pdfThumbnailScrollView.addGestureRecognizer(swipePdfThumbnailScrollView)
 
         NotificationCenter.default.addObserver(self, selector: #selector(favoriteFile(_:)), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterFavoriteFile), object: nil)
         NotificationCenter.default.addObserver(self, selector: #selector(deleteFile(_:)), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterDeleteFile), object: nil)
@@ -497,6 +499,13 @@ class NCViewerPDF: UIViewController, NCViewerPDFSearchDelegate, UIGestureRecogni
      }
 }
 
+extension NCViewerPDF: UIGestureRecognizerDelegate {
+
+    func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldRecognizeSimultaneouslyWith otherGestureRecognizer: UIGestureRecognizer) -> Bool {
+        return true
+    }
+}
+
 extension NCViewerPDF: EasyTipViewDelegate {
 
     func easyTipViewDidTap(_ tipView: EasyTipView) {