marinofaggiana 4 жил өмнө
parent
commit
12fe1dc95a

+ 8 - 0
Nextcloud.xcodeproj/project.pbxproj

@@ -266,6 +266,8 @@
 		F7C40BF1219994F20004137E /* KTVHTTPCache.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F7C40BF0219994F20004137E /* KTVHTTPCache.framework */; };
 		F7C40BF32199978B0004137E /* MBProgressHUD.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F7C40BF22199978B0004137E /* MBProgressHUD.framework */; };
 		F7C4D88D2534887E00C142DA /* Parchment in Frameworks */ = {isa = PBXBuildFile; productRef = F7C4D88C2534887E00C142DA /* Parchment */; };
+		F7C6E0D1254411D0007E35FE /* NCViewerImageVideo.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F7C6E0D0254411D0007E35FE /* NCViewerImageVideo.storyboard */; };
+		F7C6E0D7254411D9007E35FE /* NCViewerImageVideo.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7C6E0D6254411D8007E35FE /* NCViewerImageVideo.swift */; };
 		F7C7B489245EBA4100D93E60 /* NCViewerQuickLook.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7C7B488245EBA4100D93E60 /* NCViewerQuickLook.swift */; };
 		F7C9555321F0C4CA0024296E /* NCActivity.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F7C9555221F0C4CA0024296E /* NCActivity.storyboard */; };
 		F7C9555521F0C5470024296E /* NCActivity.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7C9555421F0C5470024296E /* NCActivity.swift */; };
@@ -644,6 +646,8 @@
 		F7C40BF22199978B0004137E /* MBProgressHUD.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MBProgressHUD.framework; path = Carthage/Build/iOS/MBProgressHUD.framework; sourceTree = "<group>"; };
 		F7C40C0F2199BA5D0004137E /* Realm.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Realm.framework; path = Carthage/Build/iOS/Realm.framework; sourceTree = "<group>"; };
 		F7C40C112199BA620004137E /* RealmSwift.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = RealmSwift.framework; path = Carthage/Build/iOS/RealmSwift.framework; sourceTree = "<group>"; };
+		F7C6E0D0254411D0007E35FE /* NCViewerImageVideo.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = NCViewerImageVideo.storyboard; sourceTree = "<group>"; };
+		F7C6E0D6254411D8007E35FE /* NCViewerImageVideo.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NCViewerImageVideo.swift; sourceTree = "<group>"; };
 		F7C742C01E7BD01F00D9C973 /* iOSClient.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = iOSClient.entitlements; sourceTree = "<group>"; };
 		F7C742D01E7BD35B00D9C973 /* Share.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = Share.entitlements; sourceTree = "<group>"; };
 		F7C7B488245EBA4100D93E60 /* NCViewerQuickLook.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCViewerQuickLook.swift; sourceTree = "<group>"; };
@@ -1109,6 +1113,8 @@
 		F79018B1240962C7007C9B6D /* NCViewerImage */ = {
 			isa = PBXGroup;
 			children = (
+				F7C6E0D0254411D0007E35FE /* NCViewerImageVideo.storyboard */,
+				F7C6E0D6254411D8007E35FE /* NCViewerImageVideo.swift */,
 				F70753F62542A9C000972D44 /* NCViewerImage.storyboard */,
 				F70753EA2542A99800972D44 /* NCViewerImagePageContainer.swift */,
 				F70753F02542A9A200972D44 /* NCViewerImageZoom.swift */,
@@ -1867,6 +1873,7 @@
 				F758B45A212C564000515F55 /* Scan.storyboard in Resources */,
 				F765F73225237E3F00391DBE /* NCRecent.storyboard in Resources */,
 				F77B0EFE1D118A16002130FE /* CCUploadFromOtherUpp.storyboard in Resources */,
+				F7C6E0D1254411D0007E35FE /* NCViewerImageVideo.storyboard in Resources */,
 				F7FCFFD81D70798C000E6E29 /* CCPeekPop.storyboard in Resources */,
 				F78F74342163757000C2ADAD /* NCTrash.storyboard in Resources */,
 				F79A65C32191D90F00FF6DCC /* NCSelect.storyboard in Resources */,
@@ -2042,6 +2049,7 @@
 				F7AE00F8230E81CB007ACF8A /* NCBrowserWeb.swift in Sources */,
 				F70A58BE24D0349500DED00D /* NCCapabilitiesViewController.swift in Sources */,
 				370D26AF248A3D7A00121797 /* NCImageCellProtocol.swift in Sources */,
+				F7C6E0D7254411D9007E35FE /* NCViewerImageVideo.swift in Sources */,
 				F77B0DF51D118A16002130FE /* CCUtility.m in Sources */,
 				F710D1FE24057E5E00A6033D /* NCActionSheetHeader.swift in Sources */,
 				F790110E21415BF600D7B136 /* NCViewerRichdocument.swift in Sources */,

+ 68 - 0
iOSClient/Viewer/NCViewerImage/NCViewerImageVideo.storyboard

@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="15705" 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="15706"/>
+        <capability name="Safe area layout guides" minToolsVersion="9.0"/>
+        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
+    </dependencies>
+    <scenes>
+        <!--Viewer Image Video-->
+        <scene sceneID="puT-XC-QL4">
+            <objects>
+                <viewController modalPresentationStyle="fullScreen" id="Mmv-kq-uRN" customClass="NCViewerImageVideo" 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="69" width="414" height="773"/>
+                                <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                            </view>
+                            <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="oHy-h6-oBZ">
+                                <rect key="frame" x="8" y="44" width="45" height="26"/>
+                                <subviews>
+                                    <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="QdX-GD-p2D">
+                                        <rect key="frame" x="11.5" y="2" width="22" height="22"/>
+                                        <constraints>
+                                            <constraint firstAttribute="height" constant="22" id="dQc-qo-agC"/>
+                                            <constraint firstAttribute="width" constant="22" id="xnb-gI-bEr"/>
+                                        </constraints>
+                                        <connections>
+                                            <action selector="touchUpInsidecloseButton:" destination="Mmv-kq-uRN" eventType="touchUpInside" id="sQX-6Y-Yg3"/>
+                                        </connections>
+                                    </button>
+                                </subviews>
+                                <color key="backgroundColor" white="0.33333333333333331" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                                <constraints>
+                                    <constraint firstItem="QdX-GD-p2D" firstAttribute="centerX" secondItem="oHy-h6-oBZ" secondAttribute="centerX" id="4aU-y2-eVX"/>
+                                    <constraint firstItem="QdX-GD-p2D" firstAttribute="centerY" secondItem="oHy-h6-oBZ" secondAttribute="centerY" id="mBW-kE-lTZ"/>
+                                    <constraint firstAttribute="height" constant="26" id="qKQ-Gt-Qwc"/>
+                                    <constraint firstAttribute="width" constant="45" id="zII-t1-FVR"/>
+                                </constraints>
+                            </view>
+                        </subviews>
+                        <color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
+                        <constraints>
+                            <constraint firstItem="U2u-Ng-quR" firstAttribute="top" secondItem="I8r-2q-gEp" secondAttribute="top" constant="25" id="JMx-LP-euj"/>
+                            <constraint firstItem="I8r-2q-gEp" firstAttribute="bottom" secondItem="U2u-Ng-quR" secondAttribute="bottom" constant="20" id="OB5-oL-uWd"/>
+                            <constraint firstItem="oHy-h6-oBZ" firstAttribute="leading" secondItem="ZUd-xF-jbc" secondAttribute="leading" constant="8" id="V0z-bW-qho"/>
+                            <constraint firstItem="oHy-h6-oBZ" firstAttribute="top" secondItem="I8r-2q-gEp" secondAttribute="top" id="WU4-yL-oxZ"/>
+                            <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>
+                        <viewLayoutGuide key="safeArea" id="I8r-2q-gEp"/>
+                    </view>
+                    <connections>
+                        <outlet property="backgroundView" destination="U2u-Ng-quR" id="f7b-ke-Ojf"/>
+                        <outlet property="closeButton" destination="QdX-GD-p2D" id="1Qj-mY-fpU"/>
+                        <outlet property="closeView" destination="oHy-h6-oBZ" id="ii6-LY-JDp"/>
+                    </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>
+</document>

+ 65 - 0
iOSClient/Viewer/NCViewerImage/NCViewerImageVideo.swift

@@ -0,0 +1,65 @@
+//
+//  NCViewerImageVideo.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 NCViewerImageVideo: UIViewController {
+    
+    @IBOutlet weak var backgroundView: UIView!
+    @IBOutlet weak var closeView: UIView!
+    @IBOutlet weak var closeButton: UIButton!
+
+    let appDelegate = UIApplication.shared.delegate as! AppDelegate
+    @objc var metadata = tableMetadata()
+
+    required init?(coder: NSCoder) {
+        super.init(coder: coder)        
+    }
+    
+    override func viewDidLoad() {
+        super.viewDidLoad()
+        
+        view.backgroundColor = .black
+        closeView.layer.cornerRadius = 7
+        let image = CCGraphics.changeThemingColorImage(UIImage(named: "exit"), width: 50, height: 50, color: .black)
+        closeButton.setImage(image, for: .normal)
+        
+        let frame = CGRect(x: 0, y: 0, width: self.backgroundView.frame.width, height: self.backgroundView.frame.height)
+        NCViewerVideoCommon.shared.viewMedia(metadata, view: backgroundView, frame: frame)
+    }
+    
+    @IBAction func touchUpInsidecloseButton(_ sender: Any) {
+        
+        if appDelegate.player != nil && appDelegate.player.rate != 0 {
+            appDelegate.player.pause()
+        }
+        
+        if appDelegate.isMediaObserver {
+            appDelegate.isMediaObserver = false
+            NCViewerVideoCommon.shared.removeObserver()
+        }
+
+        dismiss(animated: false) { }
+    }
+}

+ 2 - 2
iOSClient/Viewer/NCViewerVideo/NCViewerVideo.swift

@@ -45,7 +45,7 @@ class NCViewerVideo: UIViewController {
         
         view.backgroundColor = .black
         let frame = CGRect(x: 0, y: 0, width: backgroundView.frame.width, height: backgroundView.frame.height)
-        NCViewerVideoCommon.sharedInstance.viewMedia(metadata, view: backgroundView, frame: frame)
+        NCViewerVideoCommon.shared.viewMedia(metadata, view: backgroundView, frame: frame)
     }
     
     override func viewWillAppear(_ animated: Bool) {
@@ -120,7 +120,7 @@ extension NCViewerVideo : UINavigationControllerDelegate {
             
             if appDelegate.isMediaObserver {
                 appDelegate.isMediaObserver = false
-                NCViewerVideoCommon.sharedInstance.removeObserver()
+                NCViewerVideoCommon.shared.removeObserver()
             }
         }
      }

+ 1 - 1
iOSClient/Viewer/NCViewerVideo/NCViewerVideoCommon.swift

@@ -25,7 +25,7 @@ import Foundation
 import KTVHTTPCache
 
 class NCViewerVideoCommon: NSObject {
-    @objc static let sharedInstance: NCViewerVideoCommon = {
+    @objc static let shared: NCViewerVideoCommon = {
         let viewVideo = NCViewerVideoCommon()
         viewVideo.setupHTTPCache()
         return viewVideo