marinofaggiana 6 years ago
parent
commit
c945b7f4e5

+ 8 - 0
Nextcloud.xcodeproj/project.pbxproj

@@ -342,6 +342,8 @@
 		F76B3CCF1EAE01BD00921AC9 /* NCBrand.swift in Sources */ = {isa = PBXBuildFile; fileRef = F76B3CCD1EAE01BD00921AC9 /* NCBrand.swift */; };
 		F76C6F8E21943C8C0063591B /* NCActionSheetHeader.swift in Sources */ = {isa = PBXBuildFile; fileRef = F76C6F8D21943C8C0063591B /* NCActionSheetHeader.swift */; };
 		F76E71E52244DF6900690001 /* Zip.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F76E71E42244DF6900690001 /* Zip.framework */; };
+		F76E71E72244F48400690001 /* NCViewerImagemeter.swift in Sources */ = {isa = PBXBuildFile; fileRef = F76E71E62244F48400690001 /* NCViewerImagemeter.swift */; };
+		F76E71E92244FA0500690001 /* NCViewerImagemeter.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F76E71E82244FA0500690001 /* NCViewerImagemeter.storyboard */; };
 		F771E3D320E2392D00AFB62D /* FileProviderExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = F771E3D220E2392D00AFB62D /* FileProviderExtension.swift */; };
 		F771E3D520E2392D00AFB62D /* FileProviderItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = F771E3D420E2392D00AFB62D /* FileProviderItem.swift */; };
 		F771E3D720E2392D00AFB62D /* FileProviderEnumerator.swift in Sources */ = {isa = PBXBuildFile; fileRef = F771E3D620E2392D00AFB62D /* FileProviderEnumerator.swift */; };
@@ -1121,6 +1123,8 @@
 		F76C3B881C638A4C00DC4301 /* CCError.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CCError.m; sourceTree = "<group>"; };
 		F76C6F8D21943C8C0063591B /* NCActionSheetHeader.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCActionSheetHeader.swift; sourceTree = "<group>"; };
 		F76E71E42244DF6900690001 /* Zip.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Zip.framework; path = Carthage/Build/iOS/Zip.framework; sourceTree = "<group>"; };
+		F76E71E62244F48400690001 /* NCViewerImagemeter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCViewerImagemeter.swift; sourceTree = "<group>"; };
+		F76E71E82244FA0500690001 /* NCViewerImagemeter.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = NCViewerImagemeter.storyboard; sourceTree = "<group>"; };
 		F76F23321ED4600700C40023 /* Share-Bridging-Header.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "Share-Bridging-Header.h"; sourceTree = "<group>"; };
 		F771E3D020E2392D00AFB62D /* File Provider Extension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = "File Provider Extension.appex"; sourceTree = BUILT_PRODUCTS_DIR; };
 		F771E3D220E2392D00AFB62D /* FileProviderExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FileProviderExtension.swift; sourceTree = "<group>"; };
@@ -2381,6 +2385,8 @@
 			isa = PBXGroup;
 			children = (
 				F790110D21415BF600D7B136 /* NCViewerRichdocument.swift */,
+				F76E71E62244F48400690001 /* NCViewerImagemeter.swift */,
+				F76E71E82244FA0500690001 /* NCViewerImagemeter.storyboard */,
 				F7FB1D3D215E191D00D669EA /* NCViewerDocumentWeb.swift */,
 				F79630ED215527D40015EEA5 /* NCViewerMedia.swift */,
 			);
@@ -3232,6 +3238,7 @@
 				F77B0EFE1D118A16002130FE /* CCUploadFromOtherUpp.storyboard in Resources */,
 				F762CB991EACB84400B38484 /* icon-success.png in Resources */,
 				F7F54CF81E5B14C700E19C62 /* PlayButtonOverlayLargeTap@2x.png in Resources */,
+				F76E71E92244FA0500690001 /* NCViewerImagemeter.storyboard in Resources */,
 				F73B4EEE1F470D9100BBEE4B /* Big5Freq.tab in Resources */,
 				F7D4233B1F0596AC009C9782 /* Reader-Button-N.png in Resources */,
 				F760F78821F21F61006B1A73 /* PhotoCropEditorBorder@2x.png in Resources */,
@@ -3604,6 +3611,7 @@
 				F7DFB7F0219C5B8000680748 /* NCCreateFormUploadAssets.swift in Sources */,
 				F762CB0C1EACB66200B38484 /* XLFormSectionDescriptor.m in Sources */,
 				F760F79421F21F61006B1A73 /* ResizeControl.swift in Sources */,
+				F76E71E72244F48400690001 /* NCViewerImagemeter.swift in Sources */,
 				F77B0E131D118A16002130FE /* AppDelegate.m in Sources */,
 				F7DFB7F2219C5C0000680748 /* NCCreateFormUploadFileText.swift in Sources */,
 				F762CB861EACB81000B38484 /* RECommonFunctions.m in Sources */,

+ 10 - 7
iOSClient/Main/NCMainCommon.swift

@@ -1233,15 +1233,19 @@ class NCNetworkingMain: NSObject, CCNetworkingDelegate {
                         let source = URL(fileURLWithPath: CCUtility.getDirectoryProviderStorageFileID(metadata.fileID, fileNameView: metadata.fileNameView))
                         let destination =  URL(fileURLWithPath: CCUtility.getDirectoryProviderStorageFileID(metadata.fileID))
                         
-                        try Zip.unzipFile(source, destination: destination, overwrite: true, password: nil, progress: { (progress) in
-                            // progress
-                        }, fileOutputHandler: { (url) in
-                            // end
-                        })
+                        try Zip.unzipFile(source, destination: destination, overwrite: true, password: nil)
+                        
+                        let navigationController = UIStoryboard(name: "NCViewerImagemeter", bundle: nil).instantiateInitialViewController() as! UINavigationController
+                        let viewController = navigationController.topViewController as! NCViewerImagemeter
+                        
+                        viewController.metadata = metadata
+                        
+                        self.appDelegate.window.rootViewController?.present(navigationController, animated: true, completion: nil)
+                        
                     } catch {
                         appDelegate.messageNotification("_error_", description: "_error_decompressing_", visible: true, delay: TimeInterval(k_dismissAfterSecond), type: TWMessageBarMessageType.error, errorCode: errorCode)
                     }
-                    
+                                        
                 } else {
                     
                     if appDelegate.activeMain.view.window != nil {
@@ -1511,7 +1515,6 @@ class NCFunctionMain: NSObject {
                 CCSynchronize.shared()?.readFile(metadata.fileID, fileName: metadata.fileName, serverUrl: metadata.serverUrl, selector: selectorReadFileWithDownload, account: appDelegate.activeAccount)
             }
         }
-    
     }
 }
 

+ 64 - 0
iOSClient/Viewer/NCViewerImagemeter.storyboard

@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14460.31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="qsc-iN-HPH">
+    <device id="retina4_7" orientation="portrait">
+        <adaptation id="fullscreen"/>
+    </device>
+    <dependencies>
+        <deployment identifier="iOS"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14460.20"/>
+        <capability name="Safe area layout guides" minToolsVersion="9.0"/>
+        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
+    </dependencies>
+    <scenes>
+        <!--Viewer Imagemeter-->
+        <scene sceneID="pQ9-8Z-gqX">
+            <objects>
+                <viewController id="awL-ti-wNg" customClass="NCViewerImagemeter" customModule="Nextcloud" customModuleProvider="target" sceneMemberID="viewController">
+                    <view key="view" contentMode="scaleToFill" id="EZL-ha-mXQ">
+                        <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
+                        <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                        <subviews>
+                            <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="kz9-lQ-2Uc">
+                                <rect key="frame" x="0.0" y="64" width="375" height="128"/>
+                                <constraints>
+                                    <constraint firstAttribute="height" constant="128" id="QfZ-vy-737"/>
+                                </constraints>
+                            </imageView>
+                        </subviews>
+                        <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                        <constraints>
+                            <constraint firstItem="jl6-Io-SEU" firstAttribute="trailing" secondItem="kz9-lQ-2Uc" secondAttribute="trailing" id="9Mn-Qo-7AI"/>
+                            <constraint firstItem="kz9-lQ-2Uc" firstAttribute="leading" secondItem="jl6-Io-SEU" secondAttribute="leading" id="bR8-Vl-BZ7"/>
+                            <constraint firstItem="kz9-lQ-2Uc" firstAttribute="top" secondItem="jl6-Io-SEU" secondAttribute="top" id="fbi-gv-s56"/>
+                        </constraints>
+                        <viewLayoutGuide key="safeArea" id="jl6-Io-SEU"/>
+                    </view>
+                    <navigationItem key="navigationItem" id="ZuV-mh-zPX"/>
+                    <connections>
+                        <outlet property="img" destination="kz9-lQ-2Uc" id="r2x-XE-2Nf"/>
+                    </connections>
+                </viewController>
+                <placeholder placeholderIdentifier="IBFirstResponder" id="ISU-dv-V7S" userLabel="First Responder" sceneMemberID="firstResponder"/>
+            </objects>
+            <point key="canvasLocation" x="679.20000000000005" y="129.98500749625188"/>
+        </scene>
+        <!--Navigation Controller-->
+        <scene sceneID="p6d-cs-3da">
+            <objects>
+                <navigationController automaticallyAdjustsScrollViewInsets="NO" id="qsc-iN-HPH" sceneMemberID="viewController">
+                    <toolbarItems/>
+                    <navigationBar key="navigationBar" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" id="jti-R1-acA">
+                        <rect key="frame" x="0.0" y="20" width="375" height="44"/>
+                        <autoresizingMask key="autoresizingMask"/>
+                    </navigationBar>
+                    <nil name="viewControllers"/>
+                    <connections>
+                        <segue destination="awL-ti-wNg" kind="relationship" relationship="rootViewController" id="Rfb-px-LdY"/>
+                    </connections>
+                </navigationController>
+                <placeholder placeholderIdentifier="IBFirstResponder" id="lJQ-g9-WvY" userLabel="First Responder" sceneMemberID="firstResponder"/>
+            </objects>
+            <point key="canvasLocation" x="-260" y="129.98500749625188"/>
+        </scene>
+    </scenes>
+</document>

+ 63 - 0
iOSClient/Viewer/NCViewerImagemeter.swift

@@ -0,0 +1,63 @@
+//
+//  NCViewerImagemeter.swift
+//  Nextcloud
+//
+//  Created by Marino Faggiana on 22/03/2019.
+//  Copyright © 2019 Marino Faggiana. All rights reserved.
+//
+//  Author Marino Faggiana <marino.faggiana@nextcloud.com>
+//
+//  This program is free software: you can redistribute it and/or modify
+//  it under the terms of the GNU General Public License as published by
+//  the Free Software Foundation, either version 3 of the License, or
+//  (at your option) any later version.
+//
+//  This program is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//  GNU General Public License for more details.
+//
+//  You should have received a copy of the GNU General Public License
+//  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+//
+
+import Foundation
+
+class NCViewerImagemeter: UIViewController {
+    
+    @IBOutlet weak var img: UIImageView!
+    
+    private let appDelegate = UIApplication.shared.delegate as! AppDelegate
+    private var nameArchiveImagemeter: String = ""
+    private var pathArchiveImagemeter: String = ""
+    var metadata: tableMetadata?
+    
+
+    override func viewDidLoad() {
+        super.viewDidLoad()
+        
+        self.navigationItem.leftBarButtonItem = UIBarButtonItem(title: NSLocalizedString("_cancel_", comment: ""), style: UIBarButtonItem.Style.plain, target: self, action: #selector(close))
+        
+        self.navigationController?.navigationBar.isTranslucent = false
+        self.navigationController?.navigationBar.barTintColor = NCBrandColor.sharedInstance.brand
+        self.navigationController?.navigationBar.tintColor = NCBrandColor.sharedInstance.brandText
+        self.navigationController?.navigationBar.titleTextAttributes = [NSAttributedString.Key.foregroundColor: NCBrandColor.sharedInstance.brandText]
+        
+        nameArchiveImagemeter = (metadata!.fileNameView as NSString).deletingPathExtension
+        pathArchiveImagemeter = CCUtility.getDirectoryProviderStorageFileID(metadata?.fileID) + "/" + nameArchiveImagemeter
+        
+        self.navigationItem.title = nameArchiveImagemeter
+    }
+    
+    override func viewWillAppear(_ animated: Bool) {
+        super.viewWillAppear(animated)
+        
+        let imgPath = pathArchiveImagemeter + "/img-" + nameArchiveImagemeter + ".jpg"
+        
+        img.image = UIImage(contentsOfFile: imgPath)
+    }
+    
+    @objc func close() {
+        self.dismiss(animated: true, completion: nil)
+    }
+}