Browse Source

clear code

marinofaggiana 4 years ago
parent
commit
c5708cb989

+ 4 - 20
Nextcloud.xcodeproj/project.pbxproj

@@ -20,8 +20,6 @@
 		3757A35523D9D76300EC369E /* NCMenuPanelController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3757A35423D9D76300EC369E /* NCMenuPanelController.swift */; };
 		3781B9B023DB2B7E006B4B1D /* AppDelegate+Menu.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3781B9AF23DB2B7E006B4B1D /* AppDelegate+Menu.swift */; };
 		37ECC83B23D0C7410082EFA2 /* NCMenuAction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37ECC83A23D0C7400082EFA2 /* NCMenuAction.swift */; };
-		F70006FA24164F8D00F214A5 /* NCViewerVideo.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F70006F924164F8D00F214A5 /* NCViewerVideo.storyboard */; };
-		F70006FC2416500B00F214A5 /* NCViewerVideo.swift in Sources */ = {isa = PBXBuildFile; fileRef = F70006FB2416500B00F214A5 /* NCViewerVideo.swift */; };
 		F700222C1EC479840080073F /* Custom.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = F700222B1EC479840080073F /* Custom.xcassets */; };
 		F700222D1EC479840080073F /* Custom.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = F700222B1EC479840080073F /* Custom.xcassets */; };
 		F700510122DF63AC003A3356 /* NCShare.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F700510022DF63AC003A3356 /* NCShare.storyboard */; };
@@ -361,8 +359,6 @@
 		3757A35423D9D76300EC369E /* NCMenuPanelController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCMenuPanelController.swift; sourceTree = "<group>"; };
 		3781B9AF23DB2B7E006B4B1D /* AppDelegate+Menu.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "AppDelegate+Menu.swift"; sourceTree = "<group>"; };
 		37ECC83A23D0C7400082EFA2 /* NCMenuAction.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCMenuAction.swift; sourceTree = "<group>"; };
-		F70006F924164F8D00F214A5 /* NCViewerVideo.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = NCViewerVideo.storyboard; sourceTree = "<group>"; };
-		F70006FB2416500B00F214A5 /* NCViewerVideo.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCViewerVideo.swift; sourceTree = "<group>"; };
 		F700222B1EC479840080073F /* Custom.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Custom.xcassets; sourceTree = "<group>"; };
 		F700510022DF63AC003A3356 /* NCShare.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = NCShare.storyboard; sourceTree = "<group>"; };
 		F700510222DF6897003A3356 /* Parchment.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Parchment.framework; path = Carthage/Build/iOS/Parchment.framework; sourceTree = "<group>"; };
@@ -884,16 +880,6 @@
 			path = Shares;
 			sourceTree = "<group>";
 		};
-		F71CEB0D253A0B1A00832FFE /* NCViewerVideo */ = {
-			isa = PBXGroup;
-			children = (
-				F70006F924164F8D00F214A5 /* NCViewerVideo.storyboard */,
-				F70006FB2416500B00F214A5 /* NCViewerVideo.swift */,
-				F79630ED215527D40015EEA5 /* NCViewerVideoCommon.swift */,
-			);
-			path = NCViewerVideo;
-			sourceTree = "<group>";
-		};
 		F720B5B72507B9A5008C94E5 /* Cell */ = {
 			isa = PBXGroup;
 			children = (
@@ -1110,26 +1096,26 @@
 			path = Trash;
 			sourceTree = "<group>";
 		};
-		F79018B1240962C7007C9B6D /* NCViewerImage */ = {
+		F79018B1240962C7007C9B6D /* NCViewerImageVideoAudio */ = {
 			isa = PBXGroup;
 			children = (
 				F70753F62542A9C000972D44 /* NCViewerImage.storyboard */,
 				F70753EA2542A99800972D44 /* NCViewerImagePageContainer.swift */,
 				F70753F02542A9A200972D44 /* NCViewerImageZoom.swift */,
 				F7C6E0D0254411D0007E35FE /* NCViewerImageVideo.storyboard */,
+				F79630ED215527D40015EEA5 /* NCViewerVideoCommon.swift */,
 				F7C6E0D6254411D8007E35FE /* NCViewerImageVideo.swift */,
 			);
-			path = NCViewerImage;
+			path = NCViewerImageVideoAudio;
 			sourceTree = "<group>";
 		};
 		F79630EC215526B60015EEA5 /* Viewer */ = {
 			isa = PBXGroup;
 			children = (
 				F7F9D1BA25397CE000D9BFF5 /* NCViewer.swift */,
-				F79018B1240962C7007C9B6D /* NCViewerImage */,
+				F79018B1240962C7007C9B6D /* NCViewerImageVideoAudio */,
 				F723986A253C9C0E00257F49 /* NCViewerQuickLook */,
 				F76D3CEF2428B3DD005DFA87 /* NCViewerPDF */,
-				F71CEB0D253A0B1A00832FFE /* NCViewerVideo */,
 				F73D11FF253C5F5400DF9BEC /* NCViewerNextcloudText */,
 				F7239861253C95D500257F49 /* NCViewerRichdocument */,
 			);
@@ -1922,7 +1908,6 @@
 				F73CB3B222E072A000AD728E /* NCShareHeaderView.xib in Resources */,
 				F7AE00FA230E81EB007ACF8A /* NCBrowserWeb.storyboard in Resources */,
 				F78ACD58219048040088454D /* NCSectionHeaderMenu.xib in Resources */,
-				F70006FA24164F8D00F214A5 /* NCViewerVideo.storyboard in Resources */,
 				F774DF101FCC26BE002AF9FC /* iTunesArtwork@2x.png in Resources */,
 				F7501C322212E57500FB1415 /* NCMedia.storyboard in Resources */,
 				F74DE14425135B6800917068 /* NCTransfers.storyboard in Resources */,
@@ -2136,7 +2121,6 @@
 				F77B0EA61D118A16002130FE /* NSString+TruncateToWidth.m in Sources */,
 				F7CA1ED020E7E3FE002CC65E /* UIImage+PKDownloadButton.m in Sources */,
 				F7DFB7F4219C5CA800680748 /* NCCreateFormUploadScanDocument.swift in Sources */,
-				F70006FC2416500B00F214A5 /* NCViewerVideo.swift in Sources */,
 				F710D1FF24057E5E00A6033D /* NCActionSheetHeaderView.swift in Sources */,
 				F7020FCE2233D7F700B7297D /* NCCreateFormUploadVoiceNote.swift in Sources */,
 				F7F4B1D823C74B3E00D82A6E /* NCRichWorkspace.swift in Sources */,

+ 0 - 0
iOSClient/Viewer/NCViewerImage/NCViewerImage.storyboard → iOSClient/Viewer/NCViewerImageVideoAudio/NCViewerImage.storyboard


+ 0 - 0
iOSClient/Viewer/NCViewerImage/NCViewerImagePageContainer.swift → iOSClient/Viewer/NCViewerImageVideoAudio/NCViewerImagePageContainer.swift


+ 0 - 0
iOSClient/Viewer/NCViewerImage/NCViewerImageVideo.storyboard → iOSClient/Viewer/NCViewerImageVideoAudio/NCViewerImageVideo.storyboard


+ 0 - 0
iOSClient/Viewer/NCViewerImage/NCViewerImageVideo.swift → iOSClient/Viewer/NCViewerImageVideoAudio/NCViewerImageVideo.swift


+ 0 - 0
iOSClient/Viewer/NCViewerImage/NCViewerImageZoom.swift → iOSClient/Viewer/NCViewerImageVideoAudio/NCViewerImageZoom.swift


+ 0 - 0
iOSClient/Viewer/NCViewerVideo/NCViewerVideoCommon.swift → iOSClient/Viewer/NCViewerImageVideoAudio/NCViewerVideoCommon.swift


+ 0 - 48
iOSClient/Viewer/NCViewerVideo/NCViewerVideo.storyboard

@@ -1,48 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="17156" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="Mmv-kq-uRN">
-    <device id="retina6_1" orientation="portrait" appearance="light"/>
-    <dependencies>
-        <deployment identifier="iOS"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17126"/>
-        <capability name="Safe area layout guides" minToolsVersion="9.0"/>
-        <capability name="System colors in document resources" minToolsVersion="11.0"/>
-        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
-    </dependencies>
-    <scenes>
-        <!--Viewer Video-->
-        <scene sceneID="puT-XC-QL4">
-            <objects>
-                <viewController modalPresentationStyle="fullScreen" hidesBottomBarWhenPushed="YES" id="Mmv-kq-uRN" customClass="NCViewerVideo" customModule="Nextcloud" customModuleProvider="target" sceneMemberID="viewController">
-                    <view key="view" contentMode="scaleToFill" id="ZUd-xF-jbc">
-                        <rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
-                        <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
-                        <subviews>
-                            <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="U2u-Ng-quR">
-                                <rect key="frame" x="0.0" y="44" width="414" height="842"/>
-                                <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
-                            </view>
-                        </subviews>
-                        <viewLayoutGuide key="safeArea" id="I8r-2q-gEp"/>
-                        <color key="backgroundColor" systemColor="systemBackgroundColor"/>
-                        <constraints>
-                            <constraint firstItem="U2u-Ng-quR" firstAttribute="top" secondItem="I8r-2q-gEp" secondAttribute="top" id="JMx-LP-euj"/>
-                            <constraint firstAttribute="bottom" secondItem="U2u-Ng-quR" secondAttribute="bottom" constant="10" id="OB5-oL-uWd"/>
-                            <constraint firstAttribute="trailing" secondItem="U2u-Ng-quR" secondAttribute="trailing" id="fK9-2n-mIB"/>
-                            <constraint firstItem="U2u-Ng-quR" firstAttribute="leading" secondItem="ZUd-xF-jbc" secondAttribute="leading" id="zBR-Jl-ZtK"/>
-                        </constraints>
-                    </view>
-                    <connections>
-                        <outlet property="videoView" destination="U2u-Ng-quR" id="GFR-GE-i2N"/>
-                    </connections>
-                </viewController>
-                <placeholder placeholderIdentifier="IBFirstResponder" id="gwo-1E-fE5" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
-            </objects>
-            <point key="canvasLocation" x="18.840579710144929" y="140.625"/>
-        </scene>
-    </scenes>
-    <resources>
-        <systemColor name="systemBackgroundColor">
-            <color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
-        </systemColor>
-    </resources>
-</document>

+ 0 - 126
iOSClient/Viewer/NCViewerVideo/NCViewerVideo.swift

@@ -1,126 +0,0 @@
-//
-//  NCViewerVideo.swift
-//  Nextcloud
-//
-//  Created by Marino Faggiana on 09/03/2020.
-//  Copyright © 2020 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 NCViewerVideo: UIViewController {
-    
-    @IBOutlet weak var videoView: UIView!
-
-    let appDelegate = UIApplication.shared.delegate as! AppDelegate
-    var metadata = tableMetadata()
-
-    required init?(coder: NSCoder) {
-        super.init(coder: coder)        
-    }
-    
-    override func viewDidLoad() {
-        super.viewDidLoad()
-        
-        NotificationCenter.default.addObserver(self, selector: #selector(deleteFile(_:)), name: NSNotification.Name(rawValue: k_notificationCenter_deleteFile), object: nil)
-        NotificationCenter.default.addObserver(self, selector: #selector(renameFile(_:)), name: NSNotification.Name(rawValue: k_notificationCenter_renameFile), object: nil)
-        NotificationCenter.default.addObserver(self, selector: #selector(moveFile(_:)), name: NSNotification.Name(rawValue: k_notificationCenter_moveFile), object: nil)
-        NotificationCenter.default.addObserver(self, selector: #selector(viewUnload), name: NSNotification.Name(rawValue: k_notificationCenter_menuDetailClose), object: nil)
-        
-        view.backgroundColor = .black
-        NCViewerVideoCommon.shared.viewMedia(metadata, view: videoView, frame: CGRect(x: 0, y: 0, width: videoView.frame.width, height: videoView.frame.height))
-    }
-    
-    override func viewWillAppear(_ animated: Bool) {
-        super.viewWillAppear(animated)
-
-        let buttonMore = UIBarButtonItem.init(image: CCGraphics.changeThemingColorImage(UIImage(named: "more"), width: 50, height: 50, color: NCBrandColor.sharedInstance.textView), style: .plain, target: self, action: #selector(self.openMenuMore))
-        navigationItem.rightBarButtonItem = buttonMore
-        
-        navigationController?.setNavigationBarHidden(false, animated: true)
-        navigationController?.navigationBar.prefersLargeTitles = true
-        navigationItem.title = metadata.fileNameView
-
-        appDelegate.activeViewController = self
-    }
-    
-    @objc func viewUnload() {
-        
-        navigationController?.popViewController(animated: true)
-    }
-    
-    //MARK: - NotificationCenter
-   
-    @objc func moveFile(_ notification: NSNotification) {
-        
-        if let userInfo = notification.userInfo as NSDictionary? {
-            if let metadata = userInfo["metadata"] as? tableMetadata, let metadataNew = userInfo["metadataNew"] as? tableMetadata {
-                if metadata.ocId == self.metadata.ocId {
-                    self.metadata = metadataNew
-                }
-            }
-        }
-    }
-    
-    @objc func deleteFile(_ notification: NSNotification) {
-        
-        if let userInfo = notification.userInfo as NSDictionary? {
-            if let metadata = userInfo["metadata"] as? tableMetadata {
-                if metadata.ocId == self.metadata.ocId {
-                    viewUnload()
-                }
-            }
-        }
-    }
-    
-    @objc func renameFile(_ notification: NSNotification) {
-        if let userInfo = notification.userInfo as NSDictionary? {
-            if let metadata = userInfo["metadata"] as? tableMetadata {
-                if metadata.ocId == self.metadata.ocId {
-                    self.metadata = metadata
-                    navigationItem.title = metadata.fileNameView
-                }
-            }
-        }
-    }
-
-    //MARK: - Action
-    
-    @objc func openMenuMore() {
-        NCViewer.shared.toggleMoreMenu(viewController: self, metadata: metadata)
-    }
-}
-
-extension NCViewerVideo : UINavigationControllerDelegate {
-
-    override func willMove(toParent parent: UIViewController?) {
-        super.willMove(toParent: parent)
-        
-        if parent == nil {
-            if NCViewerVideoCommon.shared.player != nil && NCViewerVideoCommon.shared.player.rate != 0 {
-                NCViewerVideoCommon.shared.player.pause()
-            }
-            
-            if NCViewerVideoCommon.shared.isMediaObserver {
-                NCViewerVideoCommon.shared.isMediaObserver = false
-                NCViewerVideoCommon.shared.removeObserver()
-            }
-        }
-     }
-}