ソースを参照

remove old code

marinofaggiana 5 年 前
コミット
ce10f0afa0

+ 0 - 20
Nextcloud.xcodeproj/project.pbxproj

@@ -209,7 +209,6 @@
 		F745B251222D871800346520 /* QRCodeReader.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F745B250222D871800346520 /* QRCodeReader.framework */; };
 		F745B253222D88AE00346520 /* NCLoginQRCode.swift in Sources */ = {isa = PBXBuildFile; fileRef = F745B252222D88AE00346520 /* NCLoginQRCode.swift */; };
 		F747BA1F22354D2000971601 /* NCCreateFormUploadVoiceNote.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F747BA1E22354D2000971601 /* NCCreateFormUploadVoiceNote.storyboard */; };
-		F7499A1C2247AD3A00A7D630 /* IMImagemeterView.xib in Resources */ = {isa = PBXBuildFile; fileRef = F7499A1B2247AD3A00A7D630 /* IMImagemeterView.xib */; };
 		F749E4E91DC1FB38009BA2FD /* Share.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = F7CE8AFB1DC1F8D8009CAE48 /* Share.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
 		F74AFCE922E8B025003DE61F /* FSCalendar.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F74AFCE822E8B024003DE61F /* FSCalendar.framework */; };
 		F74E432620B5547700C2E54C /* NCNetworkingEndToEnd.m in Sources */ = {isa = PBXBuildFile; fileRef = F74E432520B5547700C2E54C /* NCNetworkingEndToEnd.m */; };
@@ -331,7 +330,6 @@
 		F76B3CCE1EAE01BD00921AC9 /* NCBrand.swift in Sources */ = {isa = PBXBuildFile; fileRef = F76B3CCD1EAE01BD00921AC9 /* NCBrand.swift */; };
 		F76B3CCF1EAE01BD00921AC9 /* NCBrand.swift in Sources */ = {isa = PBXBuildFile; fileRef = F76B3CCD1EAE01BD00921AC9 /* NCBrand.swift */; };
 		F76C6F8E21943C8C0063591B /* NCActionSheetHeader.swift in Sources */ = {isa = PBXBuildFile; fileRef = F76C6F8D21943C8C0063591B /* NCActionSheetHeader.swift */; };
-		F76E71E72244F48400690001 /* NCViewerImagemeter.swift in Sources */ = {isa = PBXBuildFile; fileRef = F76E71E62244F48400690001 /* NCViewerImagemeter.swift */; };
 		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 */; };
@@ -544,7 +542,6 @@
 		F7D4B69A2295666E000C2C86 /* FirebaseMLCommon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F7D4B6932295666E000C2C86 /* FirebaseMLCommon.framework */; };
 		F7D4B69B2295666E000C2C86 /* GoogleMobileVision.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F7D4B6942295666E000C2C86 /* GoogleMobileVision.framework */; };
 		F7D6650720FF341600BFBA9E /* NCMainCommon.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7D6650620FF341600BFBA9E /* NCMainCommon.swift */; };
-		F7D7B0D42245271100E6FE36 /* IMImagemeter.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7D7B0D32245271100E6FE36 /* IMImagemeter.swift */; };
 		F7DFAA8A22E22EF100FC4527 /* NCShareLinkMenuView.xib in Resources */ = {isa = PBXBuildFile; fileRef = F7DFAA8922E22EF100FC4527 /* NCShareLinkMenuView.xib */; };
 		F7DFB7E0219C312D00680748 /* NCRichDocumentTemplate.m in Sources */ = {isa = PBXBuildFile; fileRef = F7DFB7DF219C312D00680748 /* NCRichDocumentTemplate.m */; };
 		F7DFB7E1219C312D00680748 /* NCRichDocumentTemplate.m in Sources */ = {isa = PBXBuildFile; fileRef = F7DFB7DF219C312D00680748 /* NCRichDocumentTemplate.m */; };
@@ -867,7 +864,6 @@
 		F747BA1E22354D2000971601 /* NCCreateFormUploadVoiceNote.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = NCCreateFormUploadVoiceNote.storyboard; sourceTree = "<group>"; };
 		F7496B81208F5651004B299C /* iOSClient.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = iOSClient.plist; sourceTree = "<group>"; };
 		F7496B83208F5652004B299C /* Share.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Share.plist; sourceTree = "<group>"; };
-		F7499A1B2247AD3A00A7D630 /* IMImagemeterView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = IMImagemeterView.xib; sourceTree = "<group>"; };
 		F74AFCE822E8B024003DE61F /* FSCalendar.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = FSCalendar.framework; path = Carthage/Build/iOS/FSCalendar.framework; sourceTree = "<group>"; };
 		F74D3DBD1BAC1941000BAE4B /* OCNetworking.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OCNetworking.h; sourceTree = "<group>"; };
 		F74D3DBE1BAC1941000BAE4B /* OCNetworking.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OCNetworking.m; sourceTree = "<group>"; };
@@ -1126,7 +1122,6 @@
 		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>"; };
 		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>"; };
@@ -1391,7 +1386,6 @@
 		F7D5328F1F5D443B006568B1 /* en-GB */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "en-GB"; path = "en-GB.lproj/Localizable.strings"; sourceTree = "<group>"; };
 		F7D532A41F5D4461006568B1 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/Localizable.strings"; sourceTree = "<group>"; };
 		F7D6650620FF341600BFBA9E /* NCMainCommon.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCMainCommon.swift; sourceTree = "<group>"; };
-		F7D7B0D32245271100E6FE36 /* IMImagemeter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IMImagemeter.swift; sourceTree = "<group>"; };
 		F7DE9AB01F482FA5008DFE10 /* sv */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = sv; path = sv.lproj/Localizable.strings; sourceTree = "<group>"; };
 		F7DFAA8922E22EF100FC4527 /* NCShareLinkMenuView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = NCShareLinkMenuView.xib; sourceTree = "<group>"; };
 		F7DFB7DE219C312D00680748 /* NCRichDocumentTemplate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NCRichDocumentTemplate.h; sourceTree = "<group>"; };
@@ -2391,7 +2385,6 @@
 			isa = PBXGroup;
 			children = (
 				F790110D21415BF600D7B136 /* NCViewerRichdocument.swift */,
-				F76E71E62244F48400690001 /* NCViewerImagemeter.swift */,
 				F7FB1D3D215E191D00D669EA /* NCViewerDocumentWeb.swift */,
 				F79630ED215527D40015EEA5 /* NCViewerMedia.swift */,
 			);
@@ -2776,15 +2769,6 @@
 			path = MLVision;
 			sourceTree = "<group>";
 		};
-		F7D7B0D52245377800E6FE36 /* Imagemeter */ = {
-			isa = PBXGroup;
-			children = (
-				F7D7B0D32245271100E6FE36 /* IMImagemeter.swift */,
-				F7499A1B2247AD3A00A7D630 /* IMImagemeterView.xib */,
-			);
-			path = Imagemeter;
-			sourceTree = "<group>";
-		};
 		F7DFB7E9219C5A0500680748 /* Create cloud */ = {
 			isa = PBXGroup;
 			children = (
@@ -2939,7 +2923,6 @@
 				F7AE00F6230E8191007ACF8A /* BrowserWeb */,
 				F7BAAD951ED5A63D00B7EAD4 /* Database */,
 				F7A3214D1E9E2A070069AD1B /* Favorites */,
-				F7D7B0D52245377800E6FE36 /* Imagemeter */,
 				F7F54CAC1E5B143100E19C62 /* Library */,
 				F7BFFA621A24D7300044ED85 /* Login */,
 				F7BFCCBD1B68C21900548E76 /* ManageLocation+ManageAsset */,
@@ -3369,7 +3352,6 @@
 				F7F54CFB1E5B14C700E19C62 /* UIBarButtonItemArrowLeft@2x.png in Resources */,
 				F7C525A21E3B6DA800FFE02C /* CCNotification.storyboard in Resources */,
 				F7F54CEB1E5B14C700E19C62 /* ImageSelectedOn.png in Resources */,
-				F7499A1C2247AD3A00A7D630 /* IMImagemeterView.xib in Resources */,
 				F762CB951EACB84400B38484 /* icon-error.png in Resources */,
 				F7F54CF01E5B14C700E19C62 /* ImageSelectedSmallOff@3x.png in Resources */,
 				F73B4EF01F470D9100BBEE4B /* CMakeLists.txt in Resources */,
@@ -3660,7 +3642,6 @@
 				F7DFB7F0219C5B8000680748 /* NCCreateFormUploadAssets.swift in Sources */,
 				F762CB0C1EACB66200B38484 /* XLFormSectionDescriptor.m in Sources */,
 				F760F79421F21F61006B1A73 /* ResizeControl.swift in Sources */,
-				F76E71E72244F48400690001 /* NCViewerImagemeter.swift in Sources */,
 				F7DFB7F2219C5C0000680748 /* NCCreateFormUploadFileText.swift in Sources */,
 				F762CB861EACB81000B38484 /* RECommonFunctions.m in Sources */,
 				F76C6F8E21943C8C0063591B /* NCActionSheetHeader.swift in Sources */,
@@ -3817,7 +3798,6 @@
 				F762CAF71EACB66200B38484 /* XLFormBaseCell.m in Sources */,
 				F760F78A21F21F61006B1A73 /* UIImage+Size.swift in Sources */,
 				F70022B31EC4C9100080073F /* OCActivity.m in Sources */,
-				F7D7B0D42245271100E6FE36 /* IMImagemeter.swift in Sources */,
 				F70022D41EC4C9100080073F /* NSDate+ISO8601.m in Sources */,
 				F762CB151EACB66200B38484 /* XLFormRowNavigationAccessoryView.m in Sources */,
 				F762CB0A1EACB66200B38484 /* XLFormDescriptor.m in Sources */,

+ 0 - 236
iOSClient/Imagemeter/IMImagemeter.swift

@@ -1,236 +0,0 @@
-//
-//  IMImagemeter.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
-import ZIPFoundation
-
-//MARK: - IMImagemeterCodable
-
-class IMImagemeterCodable: NSObject {
-    
-    @objc static let sharedInstance: IMImagemeterCodable = {
-        let instance = IMImagemeterCodable()
-        return instance
-    }()
-    
-    struct imagemeterAnnotation: Codable {
-        
-        struct coordinates: Codable {
-            let x: CGFloat
-            let y: CGFloat
-        }
-        
-        struct color: Codable {
-            let rgba: [Int]?
-        }
-        
-        struct end_pt: Codable {
-            let end_pt: coordinates
-            
-            enum CodingKeys : String, CodingKey {
-                case end_pt = "end-pt"
-            }
-        }
-        
-        struct style: Codable {
-            let color: color?
-            let line_width: CGFloat?
-            let text_outline_width: CGFloat?
-            let font_base_size: CGFloat?
-            let font_magnification: CGFloat?
-            
-            enum CodingKeys : String, CodingKey {
-                case color
-                case line_width = "line-width"
-                case text_outline_width = "text-outline-width"
-                case font_base_size = "font-base-size"
-                case font_magnification = "font-magnification"
-            }
-        }
-        
-        struct audio_recording: Codable {
-            let recording_filename: String
-            let recording_duration_msecs: Int
-            
-            enum CodingKeys : String, CodingKey {
-                case recording_filename = "recording-filename"
-                case recording_duration_msecs = "recording-duration-msecs"
-            }
-        }
-        
-        struct capture_timestamp: Codable {
-            let year: Int
-            let month: Int
-            let day: Int
-            let hour: Int
-            let minutes: Int
-            let seconds: Int
-        }
-        
-        struct image: Codable {
-            let title: String
-            let filename: String
-            let annotated_image_filename: String
-            let rotation: Int
-            
-            enum CodingKeys : String, CodingKey {
-                case title
-                case filename
-                case annotated_image_filename = "annotated-image-filename"
-                case rotation
-            }
-        }
-        
-        struct export_image_cache: Codable {
-            let width: CGFloat
-            let height: CGFloat
-            let file_format: String
-            let with_hardware_antialiasing: Bool
-            let with_watermark: Bool
-            let with_image_title: Bool
-            
-            enum CodingKeys : String, CodingKey {
-                case width
-                case height
-                case file_format = "file-format"
-                case with_hardware_antialiasing = "with-hardware-antialiasing"
-                case with_watermark = "with-watermark"
-                case with_image_title = "with-image-title"
-            }
-        }
-        
-        struct elements: Codable {
-            let id: Int
-            let class_: String
-            let center: coordinates?
-            let width: CGFloat?
-            let arrows: [end_pt]?
-            let text: String?
-            let audio_recording: audio_recording?
-            let show_border: Bool?
-            let show_arrows: Bool?
-            let fill_background: Bool?
-            let style: style?
-            
-            enum CodingKeys : String, CodingKey {
-                case id
-                case class_ = "class"
-                case center
-                case width
-                case arrows
-                case text
-                case audio_recording = "audio-recording"
-                case show_border = "show-border"
-                case show_arrows = "show-arrows"
-                case fill_background = "fill-background"
-                case style
-            }
-        }
-        
-        struct thumbnails: Codable {
-            let filename: String
-            let width: CGFloat
-            let height: CGFloat
-        }
-        
-        let is_example_image: Bool
-        let version: Int
-        let capture_timestamp: capture_timestamp
-        let image: image
-        let export_image_cache: [export_image_cache]
-        let elements: [elements]?
-        let id: String
-        let thumbnails: [thumbnails]
-        let last_modification: Int
-        
-        enum CodingKeys : String, CodingKey {
-            case is_example_image = "is-example-image"
-            case version
-            case capture_timestamp = "capture-timestamp"
-            case image
-            case export_image_cache = "export-image-cache"
-            case elements
-            case id
-            case thumbnails
-            case last_modification = "last-modification"
-        }
-    }
-    
-    func decoderAnnotetion(_ annotation: Data) -> imagemeterAnnotation? {
-        
-        let jsonDecoder = JSONDecoder.init()
-        
-        do {
-            
-            let decode = try jsonDecoder.decode(imagemeterAnnotation.self, from: annotation)
-            return decode
-            
-        } catch let error {
-            
-            print("Serious internal error in decoding metadata ("+error.localizedDescription+")")
-            return nil
-        }
-    }
-    
-    func convertCoordinate(x: CGFloat, y: CGFloat, width: CGFloat, height: CGFloat) -> (x: CGFloat, y: CGFloat) {
-        
-        let factor = sqrt(width * height / (1024*768))
-        
-        let factorX = factor * x + width/2
-        let factorY = factor * y + height/2
-        
-        return(factorX, factorY)
-    }
-}
-
-//MARK: - IMImagemeter
-
-class IMImagemeter: NSObject {
-
-    static let sharedInstance: IMImagemeter = {
-        let instance = IMImagemeter()
-        return instance
-    }()
-    
-    func getBundleDirectory(metadata: tableMetadata) -> (error: Bool, bundleDirectory: String, immPath: String) {
-
-        var error = true
-        var bundleDirectory = ""
-        var immPath = ""
-        
-        let source = URL(fileURLWithPath: CCUtility.getDirectoryProviderStorageOcId(metadata.ocId, fileNameView: metadata.fileNameView))
-        
-        if let archive = Archive(url: source, accessMode: .read) {
-            archive.forEach({ (entry) in
-                let pathComponents = (entry.path as NSString).pathComponents
-                if pathComponents.count == 2 && (pathComponents.last! as NSString).pathExtension.lowercased() == "imm" {
-                    error = false
-                    bundleDirectory = CCUtility.getDirectoryProviderStorageOcId(metadata.ocId) + "/" + pathComponents.first!
-                    immPath = CCUtility.getDirectoryProviderStorageOcId(metadata.ocId) + "/" + entry.path
-                }
-            })
-        }
-        
-        return(error, bundleDirectory, immPath)
-    }
-}

+ 0 - 46
iOSClient/Imagemeter/IMImagemeterView.xib

@@ -1,46 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14460.31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
-    <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>
-    <objects>
-        <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
-        <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
-        <view contentMode="scaleToFill" id="iN0-l3-epB" customClass="IMImagemeterView" customModule="Nextcloud" customModuleProvider="target">
-            <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="1ij-2s-LYq">
-                    <rect key="frame" x="0.0" y="215.5" width="375" height="256"/>
-                    <constraints>
-                        <constraint firstAttribute="height" constant="256" id="LfB-Mf-Syk"/>
-                    </constraints>
-                </imageView>
-                <progressView opaque="NO" contentMode="scaleToFill" verticalHuggingPriority="750" progress="0.5" translatesAutoresizingMaskIntoConstraints="NO" id="6f5-Kb-BAR">
-                    <rect key="frame" x="0.0" y="471.5" width="375" height="2"/>
-                </progressView>
-            </subviews>
-            <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
-            <constraints>
-                <constraint firstItem="vUN-kp-3ea" firstAttribute="trailing" secondItem="6f5-Kb-BAR" secondAttribute="trailing" id="OPB-z2-8ro"/>
-                <constraint firstItem="vUN-kp-3ea" firstAttribute="trailing" secondItem="1ij-2s-LYq" secondAttribute="trailing" id="dgH-RG-ZfA"/>
-                <constraint firstItem="6f5-Kb-BAR" firstAttribute="leading" secondItem="vUN-kp-3ea" secondAttribute="leading" id="mQc-Fk-9H5"/>
-                <constraint firstItem="1ij-2s-LYq" firstAttribute="centerY" secondItem="vUN-kp-3ea" secondAttribute="centerY" id="rw2-di-c3M"/>
-                <constraint firstItem="6f5-Kb-BAR" firstAttribute="top" secondItem="1ij-2s-LYq" secondAttribute="bottom" id="svd-nV-djc"/>
-                <constraint firstItem="1ij-2s-LYq" firstAttribute="leading" secondItem="vUN-kp-3ea" secondAttribute="leading" id="xtT-oj-SZN"/>
-            </constraints>
-            <viewLayoutGuide key="safeArea" id="vUN-kp-3ea"/>
-            <connections>
-                <outlet property="image" destination="1ij-2s-LYq" id="iez-qY-Pih"/>
-                <outlet property="imageHeightConstraint" destination="LfB-Mf-Syk" id="0Og-Mt-xU1"/>
-                <outlet property="progressView" destination="6f5-Kb-BAR" id="nc5-MB-GOs"/>
-            </connections>
-        </view>
-    </objects>
-</document>

+ 2 - 15
iOSClient/Main/CCDetail.m

@@ -138,18 +138,6 @@
     }
 }
 
-- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator
-{
-    [super viewWillTransitionToSize:size withTransitionCoordinator:coordinator];
-    
-    [coordinator animateAlongsideTransition:nil completion:^(id<UIViewControllerTransitionCoordinatorContext> context) {
-        
-        if (self.imagemeter) {
-            [self.imagemeter viewImagemeter];
-        }
-    }];
-}
-
 - (void)changeTheming
 {
     [appDelegate changeTheming:self];
@@ -167,9 +155,6 @@
     if (_readerPDFViewController) {
         [self.readerPDFViewController updateContentViews];
     }
-    if (self.imagemeter) {
-        [self.imagemeter viewImagemeter];
-    }
 }
 
 #pragma --------------------------------------------------------------------------------------------
@@ -270,12 +255,14 @@
     }
     
     // IMI File
+    /*
     if ([self.metadataDetail.typeFile isEqualToString: k_metadataTypeFile_imagemeter]) {
         
         self.imagemeter = [[NCViewerImagemeter alloc] initWithMetadata:self.metadataDetail detail:self];
         [self.imagemeter viewImagemeter];
         [self createToolbar];
     }
+    */
 }
 
 #pragma --------------------------------------------------------------------------------------------

+ 1 - 1
iOSClient/Main/NCMainCommon.swift

@@ -1307,7 +1307,7 @@ class NCNetworkingMain: NSObject, CCNetworkingDelegate {
 
                     try? FileManager().unzipItem(at: source, to: destination)
                     
-                    let bundleDirectory = IMImagemeter.sharedInstance.getBundleDirectory(metadata: metadata)
+                    let bundleDirectory = NCUtility.sharedInstance.IMGetBundleDirectory(metadata: metadata)
                     
                     if bundleDirectory.error {
                         appDelegate.messageNotification("_error_", description: "Bundle imagemeter error. 🤷‍♂️", visible: true, delay: TimeInterval(k_dismissAfterSecond), type: TWMessageBarMessageType.error, errorCode: errorCode)

+ 0 - 239
iOSClient/Viewer/NCViewerImagemeter.swift

@@ -1,239 +0,0 @@
-//
-//  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: NSObject {
-    
-    private var imagemeterView: IMImagemeterView!
-    
-    private let appDelegate = UIApplication.shared.delegate as! AppDelegate
-    
-    private var annotation: IMImagemeterCodable.imagemeterAnnotation?
-    
-    private var immFileNamePath: String = ""
-    private var bundleDirectory: String = ""
-    
-    private var audioPlayer = AVAudioPlayer()
-    private var timer = Timer()
-    
-    private var durationPlayer: TimeInterval = 0
-    private var counterSecondPlayer: TimeInterval = 0
-
-    private var metadata: tableMetadata!
-    private var detail: CCDetail!
-
-    private var safeAreaBottom: Int = 0
-    private let dimButton: CGFloat = 30.0
-    
-    @objc public init(metadata: tableMetadata, detail: CCDetail) {
-        super.init()
-        
-        self.metadata = metadata
-        self.detail = detail
-    }
-    
-    @objc public func viewImagemeter() {
-        
-        guard let rootView = UIApplication.shared.keyWindow else {
-            return
-        }
-        if #available(iOS 11.0, *) {
-            safeAreaBottom = Int(rootView.safeAreaInsets.bottom)
-        }
-        
-        for view in self.detail.view.subviews {
-            if view is IMImagemeterView {
-                view.removeFromSuperview()
-            }
-        }
-        
-        let bundleDirectory = IMImagemeter.sharedInstance.getBundleDirectory(metadata: metadata)
-        self.bundleDirectory = bundleDirectory.bundleDirectory
-        self.immFileNamePath = bundleDirectory.immPath
-
-        self.imagemeterView = IMImagemeterView.instanceFromNib() as? IMImagemeterView
-        self.imagemeterView.frame = CGRect(x: 0, y: 0, width: Int(detail.view.frame.width), height: Int(detail.view.frame.height) - Int(k_detail_Toolbar_Height) - safeAreaBottom - 1)
-        
-        detail.view.addSubview(imagemeterView)
-        
-        do {
-            
-            let annoData = try Data(contentsOf: NSURL(fileURLWithPath: immFileNamePath) as URL, options: .mappedIfSafe)
-            if let annotation = IMImagemeterCodable.sharedInstance.decoderAnnotetion(annoData) {
-                
-                self.annotation = annotation
-                imageImagemeter()
-                audioImagemeter()
-                
-            } else {
-                appDelegate.messageNotification("_error_", description: "_error_json_decoding_", visible: true, delay: TimeInterval(k_dismissAfterSecond), type: TWMessageBarMessageType.error, errorCode: Int(k_CCErrorInternalError))
-            }
-            
-        } catch {
-            print("error:\(error)")
-        }
-    }
-
-    private func imageImagemeter() {
-        
-        guard let annotation = self.annotation else {
-            return
-        }
-        
-        let imageFilename = annotation.image.filename
-        if let image = UIImage(contentsOfFile: bundleDirectory + "/" + imageFilename) {
-            
-            let factor = image.size.width / image.size.height
-            
-            imagemeterView.imageHeightConstraint.constant = imagemeterView.bounds.size.width / factor
-            imagemeterView.image.image = NCUtility.sharedInstance.resizeImage(image: image, newWidth: imagemeterView.bounds.size.width)
-        }
-    }
-    
-    private func audioImagemeter() {
-        
-        guard let annotation = self.annotation else {
-            return
-        }
-        
-        if annotation.elements != nil {
-            for element in annotation.elements! {
-                
-                if element.audio_recording == nil {
-                    continue
-                }
-                
-                let center = IMImagemeterCodable.sharedInstance.convertCoordinate(x: element.center?.x ?? 0, y: element.center?.y ?? 0, width: imagemeterView.bounds.width, height: imagemeterView.imageHeightConstraint.constant)
-                
-                let button = UIButton()
-                button.frame = CGRect(x: center.x - dimButton/2, y: center.y - dimButton/2, width: dimButton, height: dimButton)
-                button.setImage(UIImage(named: "audioPlayFull"), for: .normal)
-                button.addTarget(self, action: #selector(buttonAction), for: .touchUpInside)
-                button.tag = element.id
-        
-                imagemeterView.image.addSubview(button)
-                
-                if element.arrows != nil {
-                    for arrow in element.arrows! {
-                        let endPt = IMImagemeterCodable.sharedInstance.convertCoordinate(x: arrow.end_pt.x, y: arrow.end_pt.y, width: imagemeterView.bounds.width, height: imagemeterView.imageHeightConstraint.constant)
-                        imagemeterView.image.image = drawLineOnImage(startingImage: imagemeterView.image.image!, x: center.x, y: center.y, endX: endPt.x, endY: endPt.y, color: .yellow, size: 1.5)
-                    }
-                }
-            }
-        }
-    }
-    
-    private func drawLineOnImage(startingImage: UIImage, x: CGFloat, y: CGFloat, endX:CGFloat, endY:CGFloat, color: UIColor, size: CGFloat) -> UIImage {
-        
-        // Create a context of the starting image size and set it as the current one
-        UIGraphicsBeginImageContext(startingImage.size)
-        
-        // Draw the starting image in the current context as background
-        startingImage.draw(at: CGPoint.zero)
-        
-        // Get the current context
-        let context = UIGraphicsGetCurrentContext()!
-        
-        // Draw a red line
-        context.setLineWidth(size)
-        context.setStrokeColor(color.cgColor)
-        context.move(to: CGPoint(x: x, y: y))
-        context.addLine(to: CGPoint(x: endX, y: endY))
-        context.strokePath()
-        
-        // Save the context as a new UIImage
-        let image = UIGraphicsGetImageFromCurrentImageContext()
-        UIGraphicsEndImageContext()
-        
-        return image!
-    }
-    
-    @objc private func buttonAction(sender: UIButton!) {
-        
-        guard let annotation = self.annotation else {
-            return
-        }
-        
-        for element in annotation.elements! {
-            if element.id == sender.tag {
-                do {
-
-                    let fileNamePath =  bundleDirectory + "/" + element.audio_recording!.recording_filename
-                    try audioPlayer = AVAudioPlayer(contentsOf: URL(fileURLWithPath: fileNamePath))
-                    audioPlayer.delegate = self
-                    audioPlayer.prepareToPlay()
-                    audioPlayer.play()
-
-                    durationPlayer = TimeInterval(audioPlayer.duration)
-                    counterSecondPlayer = 0
-                    timer.invalidate()
-                    timer = Timer.scheduledTimer(timeInterval: 1, target: self, selector: #selector(updateTimer), userInfo: nil, repeats: true)
-
-                } catch {
-                    
-                }
-            }
-        }
-    }
-    
-    @objc private func updateTimer() {
-        counterSecondPlayer += 1
-        imagemeterView.progressView.progress = Float(counterSecondPlayer / durationPlayer)
-    }
-}
-
-extension NCViewerImagemeter: AVAudioPlayerDelegate {
-    
-    func audioPlayerDidFinishPlaying(_ player: AVAudioPlayer, successfully flag: Bool) {
-        
-        updateTimer()
-        timer.invalidate()
-        counterSecondPlayer = 0
-        
-        DispatchQueue.main.asyncAfter(deadline: .now() + 1) {
-            self.imagemeterView.progressView.progress = 0
-        }
-    }
-}
-
-class IMImagemeterView: UIView {
-    
-    @IBOutlet weak var image: UIImageView!
-    @IBOutlet weak var imageHeightConstraint: NSLayoutConstraint!
-    @IBOutlet weak var progressView: UIProgressView!
-    
-    class func instanceFromNib() -> UIView {
-        return UINib(nibName: "IMImagemeterView", bundle: nil).instantiate(withOwner: nil, options: nil)[0] as! UIView
-    }
-    
-    override func awakeFromNib() {
-        super.awakeFromNib()
-        
-        image.isUserInteractionEnabled = true
-        
-        progressView.progressTintColor = NCBrandColor.sharedInstance.brandElement
-        progressView.trackTintColor = UIColor(red: 247.0/255.0, green: 247.0/255.0, blue: 247.0/255.0, alpha: 1.0)
-        progressView.progress = 0
-    }
-}