Browse Source

create storyboard for ToolBar

Signed-off-by: marinofaggiana <ios@nextcloud.com>
marinofaggiana 3 years ago
parent
commit
c39854dc3a

+ 4 - 0
Nextcloud.xcodeproj/project.pbxproj

@@ -144,6 +144,7 @@
 		F72D404923D2082500A97FD0 /* NCViewerNextcloudText.swift in Sources */ = {isa = PBXBuildFile; fileRef = F72D404823D2082500A97FD0 /* NCViewerNextcloudText.swift */; };
 		F72D7EB7263B1207000B3DFC /* MarkdownKit in Frameworks */ = {isa = PBXBuildFile; productRef = F72D7EB6263B1207000B3DFC /* MarkdownKit */; };
 		F72DA9B425F53E4E00B87DB1 /* SwiftRichString in Frameworks */ = {isa = PBXBuildFile; productRef = F72DA9B325F53E4E00B87DB1 /* SwiftRichString */; };
+		F732D23327CF8AED000B0F1B /* NCPlayerToolBar.xib in Resources */ = {isa = PBXBuildFile; fileRef = F732D23227CF8AED000B0F1B /* NCPlayerToolBar.xib */; };
 		F733598125C1C188002ABA72 /* NCAskAuthorization.swift in Sources */ = {isa = PBXBuildFile; fileRef = F733598025C1C188002ABA72 /* NCAskAuthorization.swift */; };
 		F7362A1F220C853A005101B5 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F7362A1E220C853A005101B5 /* LaunchScreen.storyboard */; };
 		F7381EE1218218C9000B1560 /* NCOffline.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7381EDA218218C9000B1560 /* NCOffline.swift */; };
@@ -613,6 +614,7 @@
 		F72E0B9C21AD60BC00898D7B /* WeScan.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WeScan.framework; path = Carthage/Build/iOS/WeScan.framework; sourceTree = "<group>"; };
 		F7320934201B812F008A0888 /* ko */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ko; path = ko.lproj/Localizable.strings; sourceTree = "<group>"; };
 		F732093B201B81E4008A0888 /* es-419 */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "es-419"; path = "es-419.lproj/Localizable.strings"; sourceTree = "<group>"; };
+		F732D23227CF8AED000B0F1B /* NCPlayerToolBar.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = NCPlayerToolBar.xib; sourceTree = "<group>"; };
 		F733598025C1C188002ABA72 /* NCAskAuthorization.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCAskAuthorization.swift; sourceTree = "<group>"; };
 		F733B65121997CC1001C1FFA /* TLPhotoPicker.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = TLPhotoPicker.framework; path = Carthage/Build/iOS/TLPhotoPicker.framework; sourceTree = "<group>"; };
 		F7362A1E220C853A005101B5 /* LaunchScreen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = LaunchScreen.storyboard; sourceTree = "<group>"; };
@@ -1381,6 +1383,7 @@
 			isa = PBXGroup;
 			children = (
 				F79EDAA126B004980007D134 /* NCPlayer.swift */,
+				F732D23227CF8AED000B0F1B /* NCPlayerToolBar.xib */,
 				F79EDA9F26B004980007D134 /* NCPlayerToolBar.swift */,
 				F716B75E26F09DF600D37EFC /* NCKTVHTTPCache.swift */,
 			);
@@ -2227,6 +2230,7 @@
 				F704B5E32430AA6F00632F5F /* NCCreateFormUploadConflict.storyboard in Resources */,
 				F77B0F611D118A16002130FE /* Acknowledgements.rtf in Resources */,
 				F7EDE509262DA9D600414FE6 /* NCSelectCommandViewSelect.xib in Resources */,
+				F732D23327CF8AED000B0F1B /* NCPlayerToolBar.xib in Resources */,
 				F73D11FA253C5F4800DF9BEC /* NCViewerNextcloudText.storyboard in Resources */,
 				F7EDE51B262DD0C400414FE6 /* NCSelectCommandViewCopyMove.xib in Resources */,
 				F73B422B2476764F00A30FD3 /* NCNotification.storyboard in Resources */,

+ 4 - 17
iOSClient/Viewer/NCViewerMedia/NCPlayer/NCPlayerToolBar.swift

@@ -31,6 +31,7 @@ import MediaPlayer
 class NCPlayerToolBar: UIView {
 
     @IBOutlet weak var playerTopToolBarView: UIView!
+    @IBOutlet weak var playerToolBarView: UIView!
     @IBOutlet weak var pipButton: UIButton!
     @IBOutlet weak var muteButton: UIButton!
     @IBOutlet weak var playButton: UIButton!
@@ -60,19 +61,13 @@ class NCPlayerToolBar: UIView {
     override func awakeFromNib() {
         super.awakeFromNib()
 
-        // for disable gesture of UIPageViewController
-        let panRecognizer = UIPanGestureRecognizer(target: self, action: nil)
-        addGestureRecognizer(panRecognizer)
-        let singleTapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(didSingleTapWith(gestureRecognizer:)))
-        addGestureRecognizer(singleTapGestureRecognizer)
-
-        self.layer.cornerRadius = 15
-        self.layer.masksToBounds = true
+        playerToolBarView.layer.cornerRadius = 15
+        playerToolBarView.layer.masksToBounds = true
 
         let blurEffectView = UIVisualEffectView(effect: UIBlurEffect(style: .dark))
         blurEffectView.frame = self.bounds
         blurEffectView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
-        self.insertSubview(blurEffectView, at: 0)
+        playerToolBarView.insertSubview(blurEffectView, at: 0)
 
         playerTopToolBarView.layer.cornerRadius = 10
         playerTopToolBarView.layer.masksToBounds = true
@@ -280,10 +275,8 @@ class NCPlayerToolBar: UIView {
         
         UIView.animate(withDuration: 0.3, animations: {
             self.alpha = 1
-            self.playerTopToolBarView.alpha = 1
         }, completion: { (_: Bool) in
             self.isHidden = false
-            self.playerTopToolBarView.isHidden = false
         })
 
         updateToolBar()
@@ -298,10 +291,8 @@ class NCPlayerToolBar: UIView {
 
         UIView.animate(withDuration: 0.3, animations: {
             self.alpha = 0
-            self.playerTopToolBarView.alpha = 0
         }, completion: { (_: Bool) in
             self.isHidden = true
-            self.playerTopToolBarView.isHidden = true
         })
     }
 
@@ -403,10 +394,6 @@ class NCPlayerToolBar: UIView {
 
     // MARK: - Action
 
-    @objc func didSingleTapWith(gestureRecognizer: UITapGestureRecognizer) {
-        // nothing
-    }
-
     @IBAction func buttonPlayerToolBarTouchInside(_ sender: UIButton) {
         // nothing
     }

+ 192 - 0
iOSClient/Viewer/NCViewerMedia/NCPlayer/NCPlayerToolBar.xib

@@ -0,0 +1,192 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="19529" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
+    <device id="retina6_1" orientation="portrait" appearance="light"/>
+    <dependencies>
+        <deployment identifier="iOS"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="19519"/>
+        <capability name="Image references" minToolsVersion="12.0"/>
+        <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="NCPlayerToolBar" customModule="Nextcloud" customModuleProvider="target">
+            <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="aU7-QX-ePS" userLabel="Player Top Tool Bar">
+                    <rect key="frame" x="304" y="54" width="100" height="45"/>
+                    <subviews>
+                        <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="AKs-cS-3AJ" userLabel="Button Player Top Tool Bar">
+                            <rect key="frame" x="0.0" y="0.0" width="100" height="45"/>
+                            <inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
+                            <connections>
+                                <action selector="buttonPlayerTopToolBarTouchInside:" destination="iN0-l3-epB" eventType="touchUpInside" id="wGC-Hl-fMh"/>
+                            </connections>
+                        </button>
+                        <button opaque="NO" contentMode="scaleToFill" enabled="NO" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Fml-c2-FMY">
+                            <rect key="frame" x="60" y="10" width="25" height="25"/>
+                            <constraints>
+                                <constraint firstAttribute="width" constant="25" id="S8g-UR-4zh"/>
+                                <constraint firstAttribute="height" constant="25" id="zjo-O1-SI2"/>
+                            </constraints>
+                            <state key="normal" image="audioOn"/>
+                            <connections>
+                                <action selector="setMute:" destination="iN0-l3-epB" eventType="touchUpInside" id="5uy-bw-aar"/>
+                            </connections>
+                        </button>
+                        <button opaque="NO" contentMode="scaleToFill" enabled="NO" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="a3d-ja-utA">
+                            <rect key="frame" x="15" y="10" width="25" height="25"/>
+                            <constraints>
+                                <constraint firstAttribute="height" constant="25" id="TIW-zu-jSX"/>
+                                <constraint firstAttribute="width" constant="25" id="jR3-bv-VnZ"/>
+                            </constraints>
+                            <state key="normal" image="pip.enter" catalog="system"/>
+                            <connections>
+                                <action selector="setPip:" destination="iN0-l3-epB" eventType="touchUpInside" id="uhg-Zu-HZ8"/>
+                            </connections>
+                        </button>
+                    </subviews>
+                    <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                    <constraints>
+                        <constraint firstAttribute="trailing" secondItem="Fml-c2-FMY" secondAttribute="trailing" constant="15" id="8ve-6A-eUd"/>
+                        <constraint firstItem="AKs-cS-3AJ" firstAttribute="leading" secondItem="aU7-QX-ePS" secondAttribute="leading" id="9Ze-H6-xI9"/>
+                        <constraint firstAttribute="bottom" secondItem="AKs-cS-3AJ" secondAttribute="bottom" id="FGR-I6-3Wg"/>
+                        <constraint firstAttribute="width" constant="100" id="U30-Kk-nJE"/>
+                        <constraint firstAttribute="height" constant="45" id="YE9-O3-5pU"/>
+                        <constraint firstItem="AKs-cS-3AJ" firstAttribute="top" secondItem="aU7-QX-ePS" secondAttribute="top" id="ZUd-v8-hfs"/>
+                        <constraint firstItem="a3d-ja-utA" firstAttribute="centerY" secondItem="aU7-QX-ePS" secondAttribute="centerY" id="eAW-c1-q9V"/>
+                        <constraint firstItem="a3d-ja-utA" firstAttribute="leading" secondItem="aU7-QX-ePS" secondAttribute="leading" constant="15" id="o3n-I3-S2i"/>
+                        <constraint firstItem="Fml-c2-FMY" firstAttribute="centerY" secondItem="aU7-QX-ePS" secondAttribute="centerY" id="uvf-Tj-ke3"/>
+                        <constraint firstAttribute="trailing" secondItem="AKs-cS-3AJ" secondAttribute="trailing" id="yUJ-b3-to1"/>
+                    </constraints>
+                </view>
+                <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="85m-50-8yp">
+                    <rect key="frame" x="10" y="787" width="394" height="65"/>
+                    <subviews>
+                        <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="1z7-mx-EOF" userLabel="Button Player Tool Bar">
+                            <rect key="frame" x="0.0" y="0.0" width="394" height="65"/>
+                            <connections>
+                                <action selector="buttonPlayerToolBarTouchInside:" destination="iN0-l3-epB" eventType="touchUpInside" id="xCb-8m-kx2"/>
+                            </connections>
+                        </button>
+                        <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="ixi-yR-HDH" userLabel="Container play">
+                            <rect key="frame" x="0.0" y="0.0" width="118" height="65"/>
+                            <subviews>
+                                <button opaque="NO" contentMode="scaleToFill" enabled="NO" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="uP7-aY-x4n">
+                                    <rect key="frame" x="3.5" y="12.5" width="40" height="40"/>
+                                    <constraints>
+                                        <constraint firstAttribute="width" constant="40" id="0jv-Tl-Nch"/>
+                                        <constraint firstAttribute="height" constant="40" id="jnZ-cX-iJY"/>
+                                    </constraints>
+                                    <state key="normal" image="gobackward.10" catalog="system"/>
+                                    <connections>
+                                        <action selector="backButtonSec:" destination="iN0-l3-epB" eventType="touchUpInside" id="pPF-Ca-M2w"/>
+                                    </connections>
+                                </button>
+                                <button opaque="NO" contentMode="scaleToFill" enabled="NO" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="hx9-d5-yiD">
+                                    <rect key="frame" x="39" y="12.5" width="40" height="40"/>
+                                    <constraints>
+                                        <constraint firstAttribute="width" constant="40" id="Ime-ag-2Hm"/>
+                                        <constraint firstAttribute="height" constant="40" id="snM-fJ-0LV"/>
+                                    </constraints>
+                                    <state key="normal">
+                                        <imageReference key="image" image="play.fill" catalog="system" symbolScale="default"/>
+                                        <preferredSymbolConfiguration key="preferredSymbolConfiguration" scale="default"/>
+                                    </state>
+                                    <connections>
+                                        <action selector="playerPause:" destination="iN0-l3-epB" eventType="touchUpInside" id="enk-eL-NtN"/>
+                                    </connections>
+                                </button>
+                                <button opaque="NO" contentMode="scaleToFill" enabled="NO" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="bGn-IC-3V1">
+                                    <rect key="frame" x="74.5" y="12.5" width="40" height="40"/>
+                                    <constraints>
+                                        <constraint firstAttribute="height" constant="40" id="VDT-no-B6f"/>
+                                        <constraint firstAttribute="width" constant="40" id="eA5-wy-Sqb"/>
+                                    </constraints>
+                                    <state key="normal" image="goforward.10" catalog="system"/>
+                                    <connections>
+                                        <action selector="forwardButtonSec:" destination="iN0-l3-epB" eventType="touchUpInside" id="1MY-Wl-aCi"/>
+                                    </connections>
+                                </button>
+                            </subviews>
+                            <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                            <constraints>
+                                <constraint firstItem="hx9-d5-yiD" firstAttribute="centerY" secondItem="ixi-yR-HDH" secondAttribute="centerY" id="Brn-9w-mrJ"/>
+                                <constraint firstItem="bGn-IC-3V1" firstAttribute="centerY" secondItem="ixi-yR-HDH" secondAttribute="centerY" id="JBD-51-iYm"/>
+                                <constraint firstItem="uP7-aY-x4n" firstAttribute="centerY" secondItem="ixi-yR-HDH" secondAttribute="centerY" id="MPU-Hg-zQa"/>
+                                <constraint firstItem="hx9-d5-yiD" firstAttribute="centerX" secondItem="ixi-yR-HDH" secondAttribute="centerX" id="Vyv-jg-Cwu"/>
+                                <constraint firstItem="uP7-aY-x4n" firstAttribute="centerX" secondItem="ixi-yR-HDH" secondAttribute="centerX" multiplier="0.4" id="bwk-Bx-qVb"/>
+                                <constraint firstItem="bGn-IC-3V1" firstAttribute="centerX" secondItem="ixi-yR-HDH" secondAttribute="centerX" multiplier="1.6" id="wJP-ph-5c5"/>
+                            </constraints>
+                        </view>
+                        <slider opaque="NO" contentMode="scaleToFill" enabled="NO" contentHorizontalAlignment="center" contentVerticalAlignment="center" value="0.5" minValue="0.0" maxValue="1" translatesAutoresizingMaskIntoConstraints="NO" id="MY0-FC-j88">
+                            <rect key="frame" x="121" y="17.5" width="265" height="31"/>
+                        </slider>
+                        <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="99:99:99" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="svM-TQ-AyQ">
+                            <rect key="frame" x="338.5" y="47.5" width="45.5" height="12"/>
+                            <fontDescription key="fontDescription" type="system" pointSize="10"/>
+                            <nil key="textColor"/>
+                            <nil key="highlightedColor"/>
+                        </label>
+                        <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="00:00:00" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="OHB-2J-Gqb">
+                            <rect key="frame" x="123" y="47.5" width="45" height="12"/>
+                            <fontDescription key="fontDescription" type="system" pointSize="10"/>
+                            <nil key="textColor"/>
+                            <nil key="highlightedColor"/>
+                        </label>
+                    </subviews>
+                    <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                    <constraints>
+                        <constraint firstItem="ixi-yR-HDH" firstAttribute="centerY" secondItem="85m-50-8yp" secondAttribute="centerY" id="5sz-fh-GbG"/>
+                        <constraint firstItem="OHB-2J-Gqb" firstAttribute="leading" secondItem="MY0-FC-j88" secondAttribute="leading" id="6n7-If-xdS"/>
+                        <constraint firstItem="ixi-yR-HDH" firstAttribute="height" secondItem="85m-50-8yp" secondAttribute="height" id="8xM-7l-FXN"/>
+                        <constraint firstAttribute="height" constant="65" id="9Uv-dV-to4"/>
+                        <constraint firstItem="svM-TQ-AyQ" firstAttribute="top" secondItem="MY0-FC-j88" secondAttribute="bottom" id="Aan-ac-nr9"/>
+                        <constraint firstItem="MY0-FC-j88" firstAttribute="leading" secondItem="ixi-yR-HDH" secondAttribute="trailing" constant="5" id="BAz-4C-w3A"/>
+                        <constraint firstAttribute="trailing" secondItem="svM-TQ-AyQ" secondAttribute="trailing" constant="10" id="JXl-DO-x6b"/>
+                        <constraint firstItem="ixi-yR-HDH" firstAttribute="leading" secondItem="85m-50-8yp" secondAttribute="leading" id="Kh2-nU-bMU"/>
+                        <constraint firstAttribute="bottom" secondItem="1z7-mx-EOF" secondAttribute="bottom" id="Ta0-kB-BQ2"/>
+                        <constraint firstAttribute="trailing" secondItem="1z7-mx-EOF" secondAttribute="trailing" id="V93-UI-XDO"/>
+                        <constraint firstItem="1z7-mx-EOF" firstAttribute="leading" secondItem="85m-50-8yp" secondAttribute="leading" id="ZSd-hQ-3I2"/>
+                        <constraint firstItem="ixi-yR-HDH" firstAttribute="width" secondItem="85m-50-8yp" secondAttribute="width" multiplier="0.3" id="gXG-4n-Ee3"/>
+                        <constraint firstAttribute="trailing" secondItem="MY0-FC-j88" secondAttribute="trailing" constant="10" id="hBO-J2-Kdo"/>
+                        <constraint firstItem="OHB-2J-Gqb" firstAttribute="top" secondItem="MY0-FC-j88" secondAttribute="bottom" id="jdb-Vq-WoF"/>
+                        <constraint firstItem="MY0-FC-j88" firstAttribute="centerY" secondItem="85m-50-8yp" secondAttribute="centerY" id="lG8-DN-rTE"/>
+                        <constraint firstItem="1z7-mx-EOF" firstAttribute="top" secondItem="85m-50-8yp" secondAttribute="top" id="xra-pJ-UgW"/>
+                    </constraints>
+                </view>
+            </subviews>
+            <viewLayoutGuide key="safeArea" id="vUN-kp-3ea"/>
+            <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+            <constraints>
+                <constraint firstItem="vUN-kp-3ea" firstAttribute="trailing" secondItem="aU7-QX-ePS" secondAttribute="trailing" constant="10" id="2h2-gm-Gog"/>
+                <constraint firstItem="85m-50-8yp" firstAttribute="leading" secondItem="vUN-kp-3ea" secondAttribute="leading" constant="10" id="5H2-Gg-PEb"/>
+                <constraint firstItem="vUN-kp-3ea" firstAttribute="trailing" secondItem="85m-50-8yp" secondAttribute="trailing" constant="10" id="BXT-Qo-qFl"/>
+                <constraint firstItem="vUN-kp-3ea" firstAttribute="bottom" secondItem="85m-50-8yp" secondAttribute="bottom" constant="10" id="N7Q-PF-7lb"/>
+                <constraint firstItem="aU7-QX-ePS" firstAttribute="top" secondItem="vUN-kp-3ea" secondAttribute="top" constant="10" id="srY-5w-tyj"/>
+            </constraints>
+            <connections>
+                <outlet property="backButton" destination="uP7-aY-x4n" id="SyC-qV-IMq"/>
+                <outlet property="forwardButton" destination="bGn-IC-3V1" id="0OZ-f2-eWU"/>
+                <outlet property="labelCurrentTime" destination="OHB-2J-Gqb" id="pFy-CJ-x2A"/>
+                <outlet property="labelLeftTime" destination="svM-TQ-AyQ" id="UDV-Lh-12z"/>
+                <outlet property="muteButton" destination="Fml-c2-FMY" id="Fo1-Ep-ZPz"/>
+                <outlet property="pipButton" destination="a3d-ja-utA" id="9nt-RD-IXd"/>
+                <outlet property="playButton" destination="hx9-d5-yiD" id="Enk-Ge-2Yx"/>
+                <outlet property="playbackSlider" destination="MY0-FC-j88" id="bVe-Kc-80k"/>
+                <outlet property="playerToolBarView" destination="85m-50-8yp" id="eZK-p1-v65"/>
+                <outlet property="playerTopToolBarView" destination="aU7-QX-ePS" id="kEC-Og-bfW"/>
+            </connections>
+            <point key="canvasLocation" x="139" y="153"/>
+        </view>
+    </objects>
+    <resources>
+        <image name="audioOn" width="28" height="28"/>
+        <image name="gobackward.10" catalog="system" width="121" height="128"/>
+        <image name="goforward.10" catalog="system" width="121" height="128"/>
+        <image name="pip.enter" catalog="system" width="128" height="96"/>
+        <image name="play.fill" catalog="system" width="116" height="128"/>
+    </resources>
+</document>

+ 29 - 40
iOSClient/Viewer/NCViewerMedia/NCViewerMedia.swift

@@ -36,12 +36,12 @@ class NCViewerMedia: UIViewController {
     @IBOutlet weak var statusViewImage: UIImageView!
     @IBOutlet weak var statusLabel: UILabel!
     @IBOutlet weak var detailView: NCViewerMediaDetailView!
-    @IBOutlet weak var playerToolBar: NCPlayerToolBar!
-
+    
     private var _autoPlay: Bool = false
 
     let appDelegate = UIApplication.shared.delegate as! AppDelegate
-    weak var viewerMediaPage: NCViewerMediaPage?
+    var viewerMediaPage: NCViewerMediaPage?
+    var playerToolBar: NCPlayerToolBar?
     var ncplayer: NCPlayer?
     var image: UIImage?
     var metadata: tableMetadata = tableMetadata()
@@ -92,16 +92,34 @@ class NCViewerMedia: UIViewController {
             statusViewImage.image = nil
             statusLabel.text = ""
         }
-
-        playerToolBar.viewerMediaPage = viewerMediaPage
-
+        
+        if metadata.classFile == NCCommunicationCommon.typeClassFile.video.rawValue || metadata.classFile == NCCommunicationCommon.typeClassFile.audio.rawValue {
+            playerToolBar = Bundle.main.loadNibNamed("NCPlayerToolBar", owner: self, options: nil)?.first as? NCPlayerToolBar
+            if let playerToolBar = playerToolBar {
+                view.addSubview(playerToolBar)
+                playerToolBar.translatesAutoresizingMaskIntoConstraints = false
+                playerToolBar.topAnchor.constraint(equalTo: view.topAnchor, constant: 0).isActive = true
+                playerToolBar.bottomAnchor.constraint(equalTo: view.bottomAnchor, constant: 0).isActive = true
+                playerToolBar.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: 0).isActive = true
+                playerToolBar.trailingAnchor.constraint(equalTo: view.trailingAnchor, constant: 0).isActive = true
+                playerToolBar.viewerMediaPage = viewerMediaPage
+            }
+        }
+        
         detailViewTopConstraint.constant = 0
         detailView.hide()
 
         self.image = nil
         self.imageVideoContainer.image = nil
 
-        reloadImage()
+        loadImage(metadata: metadata) { _, image in
+            self.image = image
+            // do not update if is present the videoLayer
+            let numSublayers = self.imageVideoContainer.layer.sublayers?.count
+            if numSublayers == nil {
+                self.imageVideoContainer.image = image
+            }
+        }
     }
 
     override func viewWillAppear(_ animated: Bool) {
@@ -112,10 +130,6 @@ class NCViewerMedia: UIViewController {
 
         if metadata.classFile == NCCommunicationCommon.typeClassFile.image.rawValue, let viewerMediaPage = self.viewerMediaPage {
             viewerMediaPage.currentScreenMode = viewerMediaPage.saveScreenModeImage
-            if viewerMediaPage.modifiedOcId.contains(metadata.ocId) {
-                viewerMediaPage.modifiedOcId.removeAll(where: { $0 == metadata.ocId })
-                reloadImage()
-            }
         }
 
         if viewerMediaPage?.currentScreenMode == .full {
@@ -193,20 +207,6 @@ class NCViewerMedia: UIViewController {
 
     // MARK: - Image
 
-    func reloadImage() {
-        if let metadata = NCManageDatabase.shared.getMetadataFromOcId(metadata.ocId) {
-            self.metadata = metadata
-            loadImage(metadata: metadata) { _, image in
-                self.image = image
-                // do not update if is present the videoLayer
-                let numSublayers = self.imageVideoContainer.layer.sublayers?.count
-                if numSublayers == nil {
-                    self.imageVideoContainer.image = image
-                }
-            }
-        }
-    }
-
     func loadImage(metadata: tableMetadata, completion: @escaping (_ ocId: String, _ image: UIImage?) -> Void) {
 
         // Download preview
@@ -450,13 +450,8 @@ extension NCViewerMedia {
                 self.detailViewHeighConstraint.constant = 170
             }
             self.view.layoutIfNeeded()
-            self.detailView.show(
-                metadata: self.metadata,
-                image: self.image,
-                textColor: self.viewerMediaPage?.textColor,
-                mediaMetadata: (latitude: latitude, longitude: longitude, location: location, date: date, lensModel: lensModel),
-                ncplayer: self.ncplayer,
-                delegate: self)
+            
+            self.detailView.show(metadata:self.metadata, image: self.image, textColor: self.viewerMediaPage?.textColor, latitude: latitude, longitude: longitude, location: location, date: date, lensModel: lensModel, ncplayer: self.ncplayer ,delegate: self)
                 
             if let image = self.imageVideoContainer.image {
                 let ratioW = self.imageVideoContainer.frame.width / image.size.width
@@ -476,7 +471,7 @@ extension NCViewerMedia {
             }
 
             self.scrollView.pinchGestureRecognizer?.isEnabled = false
-            self.playerToolBar.hide()
+            self.playerToolBar?.hide()
         }
     }
 
@@ -503,13 +498,7 @@ extension NCViewerMedia {
 
         if self.detailView.isShow() {
             CCUtility.setExif(metadata) { (latitude, longitude, location, date, lensModel) in
-                self.detailView.show(
-                    metadata: self.metadata,
-                    image: self.image,
-                    textColor: self.viewerMediaPage?.textColor,
-                    mediaMetadata: (latitude: latitude, longitude: longitude, location: location, date: date, lensModel: lensModel),
-                    ncplayer: self.ncplayer,
-                    delegate: self)
+                self.detailView.show(metadata:self.metadata, image: self.image, textColor: self.viewerMediaPage?.textColor, latitude: latitude, longitude: longitude, location: location, date: date, lensModel: lensModel, ncplayer: self.ncplayer ,delegate: self)
             }
         }
     }

+ 0 - 165
iOSClient/Viewer/NCViewerMedia/NCViewerMediaPage.storyboard

@@ -4,7 +4,6 @@
     <dependencies>
         <deployment identifier="iOS"/>
         <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="19519"/>
-        <capability name="Image references" minToolsVersion="12.0"/>
         <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"/>
@@ -246,159 +245,6 @@
                                             <outlet property="sizeValue" destination="XLb-0a-du9" id="9jm-Ku-sgt"/>
                                         </connections>
                                     </view>
-                                    <view hidden="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="dgJ-dQ-lSp" userLabel="Player Top Tool Bar">
-                                        <rect key="frame" x="299" y="10" width="100" height="45"/>
-                                        <subviews>
-                                            <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="9aW-Pg-83x" userLabel="Button Player Top Tool Bar">
-                                                <rect key="frame" x="0.0" y="0.0" width="100" height="45"/>
-                                                <inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
-                                                <connections>
-                                                    <action selector="buttonPlayerTopToolBarTouchInside:" destination="sBp-t2-eFh" eventType="touchUpInside" id="Afs-Nt-FaQ"/>
-                                                </connections>
-                                            </button>
-                                            <button opaque="NO" contentMode="scaleToFill" enabled="NO" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="8AB-hx-yqN" userLabel="Mute Button">
-                                                <rect key="frame" x="60" y="10" width="25" height="25"/>
-                                                <constraints>
-                                                    <constraint firstAttribute="width" constant="25" id="6yU-23-dkA"/>
-                                                    <constraint firstAttribute="height" constant="25" id="hBk-Ku-BAd"/>
-                                                </constraints>
-                                                <state key="normal" image="audioOn"/>
-                                                <connections>
-                                                    <action selector="setMute:" destination="sBp-t2-eFh" eventType="touchUpInside" id="cVl-BA-mPJ"/>
-                                                </connections>
-                                            </button>
-                                            <button opaque="NO" contentMode="scaleToFill" enabled="NO" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="NwE-zQ-Y5D" userLabel="Mute Button">
-                                                <rect key="frame" x="15" y="10" width="25" height="25"/>
-                                                <constraints>
-                                                    <constraint firstAttribute="width" constant="25" id="CaQ-c0-MES"/>
-                                                    <constraint firstAttribute="height" constant="25" id="N06-qe-ZVY"/>
-                                                </constraints>
-                                                <state key="normal" image="pip.enter" catalog="system"/>
-                                                <connections>
-                                                    <action selector="setPip:" destination="sBp-t2-eFh" eventType="touchUpInside" id="svR-8R-DQY"/>
-                                                </connections>
-                                            </button>
-                                        </subviews>
-                                        <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
-                                        <constraints>
-                                            <constraint firstAttribute="trailing" secondItem="9aW-Pg-83x" secondAttribute="trailing" id="8db-gr-hzG"/>
-                                            <constraint firstItem="NwE-zQ-Y5D" firstAttribute="centerY" secondItem="dgJ-dQ-lSp" secondAttribute="centerY" id="Ad6-Aj-hvc"/>
-                                            <constraint firstAttribute="bottom" secondItem="9aW-Pg-83x" secondAttribute="bottom" id="B8A-Zh-HYL"/>
-                                            <constraint firstAttribute="width" constant="100" id="LTs-QZ-nVw"/>
-                                            <constraint firstAttribute="trailing" secondItem="8AB-hx-yqN" secondAttribute="trailing" constant="15" id="bQK-xA-Jyu"/>
-                                            <constraint firstItem="NwE-zQ-Y5D" firstAttribute="leading" secondItem="dgJ-dQ-lSp" secondAttribute="leading" constant="15" id="cZY-tl-BOh"/>
-                                            <constraint firstItem="9aW-Pg-83x" firstAttribute="leading" secondItem="dgJ-dQ-lSp" secondAttribute="leading" id="clL-y7-JuR"/>
-                                            <constraint firstItem="9aW-Pg-83x" firstAttribute="top" secondItem="dgJ-dQ-lSp" secondAttribute="top" id="jQP-bV-BQ9"/>
-                                            <constraint firstItem="8AB-hx-yqN" firstAttribute="centerY" secondItem="dgJ-dQ-lSp" secondAttribute="centerY" id="uNT-D4-mK3"/>
-                                            <constraint firstAttribute="height" constant="45" id="xf9-B5-HMs"/>
-                                        </constraints>
-                                    </view>
-                                    <view hidden="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="sBp-t2-eFh" customClass="NCPlayerToolBar" customModule="Nextcloud" customModuleProvider="target">
-                                        <rect key="frame" x="15" y="661" width="384" height="65"/>
-                                        <subviews>
-                                            <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="a0D-B0-eGX" userLabel="Button Player Tool Bar">
-                                                <rect key="frame" x="0.0" y="0.0" width="384" height="65"/>
-                                                <connections>
-                                                    <action selector="buttonPlayerToolBarTouchInside:" destination="sBp-t2-eFh" eventType="touchUpInside" id="hyl-lR-OGD"/>
-                                                </connections>
-                                            </button>
-                                            <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Z2D-bl-6Qu" userLabel="Container play">
-                                                <rect key="frame" x="0.0" y="0.0" width="115.33333333333333" height="65"/>
-                                                <subviews>
-                                                    <button opaque="NO" contentMode="scaleToFill" enabled="NO" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Isy-sX-Gji">
-                                                        <rect key="frame" x="3" y="12.666666666666629" width="40" height="40"/>
-                                                        <constraints>
-                                                            <constraint firstAttribute="width" constant="40" id="COm-r2-ubw"/>
-                                                            <constraint firstAttribute="height" constant="40" id="mbb-ql-zCc"/>
-                                                        </constraints>
-                                                        <state key="normal" image="gobackward.10" catalog="system"/>
-                                                        <connections>
-                                                            <action selector="backButtonSec:" destination="sBp-t2-eFh" eventType="touchUpInside" id="Q46-Tp-inF"/>
-                                                        </connections>
-                                                    </button>
-                                                    <button opaque="NO" contentMode="scaleToFill" enabled="NO" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="x3E-b2-obf">
-                                                        <rect key="frame" x="37.666666666666629" y="12.666666666666629" width="40" height="40"/>
-                                                        <constraints>
-                                                            <constraint firstAttribute="width" constant="40" id="Cmv-LX-Phg"/>
-                                                            <constraint firstAttribute="height" constant="40" id="djE-Ml-YD0"/>
-                                                        </constraints>
-                                                        <state key="normal">
-                                                            <imageReference key="image" image="play.fill" catalog="system" symbolScale="default"/>
-                                                            <preferredSymbolConfiguration key="preferredSymbolConfiguration" scale="default"/>
-                                                        </state>
-                                                        <connections>
-                                                            <action selector="playerPause:" destination="sBp-t2-eFh" eventType="touchUpInside" id="pRl-bT-hpi"/>
-                                                        </connections>
-                                                    </button>
-                                                    <button opaque="NO" contentMode="scaleToFill" enabled="NO" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="F9L-PP-AbM">
-                                                        <rect key="frame" x="72" y="12.666666666666629" width="40" height="40"/>
-                                                        <constraints>
-                                                            <constraint firstAttribute="width" constant="40" id="hlL-XQ-OLa"/>
-                                                            <constraint firstAttribute="height" constant="40" id="vEe-Fb-a9N"/>
-                                                        </constraints>
-                                                        <state key="normal" image="goforward.10" catalog="system"/>
-                                                        <connections>
-                                                            <action selector="forwardButtonSec:" destination="sBp-t2-eFh" eventType="touchUpInside" id="QPi-TQ-rNF"/>
-                                                        </connections>
-                                                    </button>
-                                                </subviews>
-                                                <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
-                                                <constraints>
-                                                    <constraint firstItem="F9L-PP-AbM" firstAttribute="centerY" secondItem="Z2D-bl-6Qu" secondAttribute="centerY" id="Hb6-zo-b2N"/>
-                                                    <constraint firstItem="x3E-b2-obf" firstAttribute="centerX" secondItem="Z2D-bl-6Qu" secondAttribute="centerX" id="Hj0-C7-K75"/>
-                                                    <constraint firstItem="F9L-PP-AbM" firstAttribute="centerX" secondItem="Z2D-bl-6Qu" secondAttribute="centerX" multiplier="1.6" id="a8O-oF-jJM"/>
-                                                    <constraint firstItem="Isy-sX-Gji" firstAttribute="centerX" secondItem="Z2D-bl-6Qu" secondAttribute="centerX" multiplier="0.4" id="mLO-jA-XH6"/>
-                                                    <constraint firstItem="Isy-sX-Gji" firstAttribute="centerY" secondItem="Z2D-bl-6Qu" secondAttribute="centerY" id="ngz-yI-ozW"/>
-                                                    <constraint firstItem="x3E-b2-obf" firstAttribute="centerY" secondItem="Z2D-bl-6Qu" secondAttribute="centerY" id="qMZ-ZT-IWE"/>
-                                                </constraints>
-                                            </view>
-                                            <slider opaque="NO" contentMode="scaleToFill" enabled="NO" contentHorizontalAlignment="center" contentVerticalAlignment="center" value="0.5" minValue="0.0" maxValue="1" translatesAutoresizingMaskIntoConstraints="NO" id="SR4-e8-1hC">
-                                                <rect key="frame" x="118.33333333333331" y="17.666666666666629" width="257.66666666666663" height="31"/>
-                                            </slider>
-                                            <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="99:99:99" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="OUD-HH-cXH">
-                                                <rect key="frame" x="328.66666666666669" y="47.666666666666629" width="45.333333333333314" height="12"/>
-                                                <fontDescription key="fontDescription" type="system" pointSize="10"/>
-                                                <nil key="textColor"/>
-                                                <nil key="highlightedColor"/>
-                                            </label>
-                                            <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="00:00:00" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="kVv-X4-6SK">
-                                                <rect key="frame" x="120.33333333333331" y="47.666666666666629" width="45" height="12"/>
-                                                <fontDescription key="fontDescription" type="system" pointSize="10"/>
-                                                <nil key="textColor"/>
-                                                <nil key="highlightedColor"/>
-                                            </label>
-                                        </subviews>
-                                        <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
-                                        <constraints>
-                                            <constraint firstItem="Z2D-bl-6Qu" firstAttribute="width" secondItem="sBp-t2-eFh" secondAttribute="width" multiplier="0.3" id="13g-iK-lwr"/>
-                                            <constraint firstItem="kVv-X4-6SK" firstAttribute="leading" secondItem="SR4-e8-1hC" secondAttribute="leading" id="5hb-O9-gEt"/>
-                                            <constraint firstItem="SR4-e8-1hC" firstAttribute="leading" secondItem="Z2D-bl-6Qu" secondAttribute="trailing" constant="5" id="6He-ZU-Vwa"/>
-                                            <constraint firstItem="Z2D-bl-6Qu" firstAttribute="height" secondItem="sBp-t2-eFh" secondAttribute="height" id="AbA-kH-vt3"/>
-                                            <constraint firstAttribute="height" constant="65" id="EyI-HW-pHA"/>
-                                            <constraint firstItem="SR4-e8-1hC" firstAttribute="centerY" secondItem="sBp-t2-eFh" secondAttribute="centerY" id="L8n-9C-y6b"/>
-                                            <constraint firstItem="a0D-B0-eGX" firstAttribute="leading" secondItem="sBp-t2-eFh" secondAttribute="leading" id="OIL-1t-uuh"/>
-                                            <constraint firstAttribute="trailing" secondItem="SR4-e8-1hC" secondAttribute="trailing" constant="10" id="Q3r-ex-Cpf"/>
-                                            <constraint firstAttribute="bottom" secondItem="a0D-B0-eGX" secondAttribute="bottom" id="a3T-pV-xrr"/>
-                                            <constraint firstItem="Z2D-bl-6Qu" firstAttribute="centerY" secondItem="sBp-t2-eFh" secondAttribute="centerY" id="gdD-MC-K1m"/>
-                                            <constraint firstItem="a0D-B0-eGX" firstAttribute="top" secondItem="sBp-t2-eFh" secondAttribute="top" id="itu-re-FU4"/>
-                                            <constraint firstAttribute="trailing" secondItem="OUD-HH-cXH" secondAttribute="trailing" constant="10" id="j5v-RG-0JI"/>
-                                            <constraint firstItem="Z2D-bl-6Qu" firstAttribute="leading" secondItem="sBp-t2-eFh" secondAttribute="leading" id="jHq-yM-afK"/>
-                                            <constraint firstItem="kVv-X4-6SK" firstAttribute="top" secondItem="SR4-e8-1hC" secondAttribute="bottom" id="l6a-l5-ZvL"/>
-                                            <constraint firstAttribute="trailing" secondItem="a0D-B0-eGX" secondAttribute="trailing" id="lbh-DN-SZF"/>
-                                            <constraint firstItem="OUD-HH-cXH" firstAttribute="top" secondItem="SR4-e8-1hC" secondAttribute="bottom" id="wwk-tz-5dj"/>
-                                        </constraints>
-                                        <connections>
-                                            <outlet property="backButton" destination="Isy-sX-Gji" id="RBh-0O-yAN"/>
-                                            <outlet property="forwardButton" destination="F9L-PP-AbM" id="cc0-4F-r5v"/>
-                                            <outlet property="labelCurrentTime" destination="kVv-X4-6SK" id="vyf-Bb-TPL"/>
-                                            <outlet property="labelLeftTime" destination="OUD-HH-cXH" id="MjW-XN-Uer"/>
-                                            <outlet property="muteButton" destination="8AB-hx-yqN" id="9zQ-k7-auv"/>
-                                            <outlet property="pipButton" destination="NwE-zQ-Y5D" id="veJ-QD-fOd"/>
-                                            <outlet property="playButton" destination="x3E-b2-obf" id="0Nw-L4-W7M"/>
-                                            <outlet property="playbackSlider" destination="SR4-e8-1hC" id="Khx-Oe-NEQ"/>
-                                            <outlet property="playerTopToolBarView" destination="dgJ-dQ-lSp" id="22g-Yn-k5r"/>
-                                        </connections>
-                                    </view>
                                 </subviews>
                                 <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
                                 <constraints>
@@ -417,19 +263,14 @@
                         <viewLayoutGuide key="safeArea" id="Yo6-7W-moG"/>
                         <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
                         <constraints>
-                            <constraint firstItem="Yo6-7W-moG" firstAttribute="trailing" secondItem="dgJ-dQ-lSp" secondAttribute="trailing" constant="15" id="15m-hD-wYt"/>
                             <constraint firstAttribute="bottom" secondItem="CdQ-LC-Trx" secondAttribute="bottom" id="4qB-8y-OcG"/>
                             <constraint firstAttribute="trailing" secondItem="CdQ-LC-Trx" secondAttribute="trailing" id="IwE-oE-d3Y"/>
-                            <constraint firstItem="Yo6-7W-moG" firstAttribute="bottom" secondItem="sBp-t2-eFh" secondAttribute="bottom" constant="10" id="QHF-av-zeT"/>
-                            <constraint firstItem="Yo6-7W-moG" firstAttribute="trailing" secondItem="sBp-t2-eFh" secondAttribute="trailing" constant="15" id="TCr-e0-gnG"/>
                             <constraint firstItem="2AU-85-K8y" firstAttribute="leading" secondItem="Yo6-7W-moG" secondAttribute="leading" constant="10" id="X10-OG-EKg"/>
                             <constraint firstItem="Yo6-7W-moG" firstAttribute="top" secondItem="2AU-85-K8y" secondAttribute="top" constant="-10" id="avO-83-uMQ"/>
                             <constraint firstItem="Yo6-7W-moG" firstAttribute="bottom" secondItem="P8R-4f-zAl" secondAttribute="top" constant="400" id="bor-cg-Alz"/>
                             <constraint firstItem="P8R-4f-zAl" firstAttribute="leading" secondItem="Yo6-7W-moG" secondAttribute="leading" id="dly-i5-fPW"/>
-                            <constraint firstItem="dgJ-dQ-lSp" firstAttribute="top" secondItem="Yo6-7W-moG" secondAttribute="top" constant="10" id="g7l-5Z-sJj"/>
                             <constraint firstItem="CdQ-LC-Trx" firstAttribute="leading" secondItem="fIE-H6-KKc" secondAttribute="leading" id="g8C-2m-KkX"/>
                             <constraint firstItem="CdQ-LC-Trx" firstAttribute="top" secondItem="fIE-H6-KKc" secondAttribute="top" id="hcQ-lB-JwU"/>
-                            <constraint firstItem="sBp-t2-eFh" firstAttribute="leading" secondItem="Yo6-7W-moG" secondAttribute="leading" constant="15" id="hwP-QY-nRI"/>
                             <constraint firstItem="Yo6-7W-moG" firstAttribute="trailing" secondItem="P8R-4f-zAl" secondAttribute="trailing" id="jf2-Nv-gFi"/>
                         </constraints>
                     </view>
@@ -440,7 +281,6 @@
                         <outlet property="imageVideoContainer" destination="kPV-JM-UnM" id="2pA-VW-FuK"/>
                         <outlet property="imageViewBottomConstraint" destination="vEd-X2-yGs" id="wp3-67-aZ2"/>
                         <outlet property="imageViewTopConstraint" destination="tdo-XY-uqv" id="AM2-tz-fSt"/>
-                        <outlet property="playerToolBar" destination="sBp-t2-eFh" id="E24-0a-bN6"/>
                         <outlet property="scrollView" destination="CdQ-LC-Trx" id="3np-FR-s39"/>
                         <outlet property="statusLabel" destination="DAi-gz-qGP" id="zZH-1B-HiI"/>
                         <outlet property="statusViewImage" destination="2AU-85-K8y" id="22h-Ec-bj0"/>
@@ -457,12 +297,7 @@
         </scene>
     </scenes>
     <resources>
-        <image name="audioOn" width="28" height="28"/>
-        <image name="gobackward.10" catalog="system" width="121" height="128"/>
-        <image name="goforward.10" catalog="system" width="121" height="128"/>
         <image name="networkInProgress" width="300" height="300"/>
-        <image name="pip.enter" catalog="system" width="128" height="96"/>
-        <image name="play.fill" catalog="system" width="116" height="128"/>
         <systemColor name="systemBackgroundColor">
             <color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
         </systemColor>

+ 17 - 37
iOSClient/Viewer/NCViewerMedia/NCViewerMediaPage.swift

@@ -44,7 +44,6 @@ class NCViewerMediaPage: UIViewController {
     }
 
     var metadatas: [tableMetadata] = []
-    var modifiedOcId: [String] = []
     var currentIndex = 0
     var nextIndex: Int?
     var ncplayerLivePhoto: NCPlayer?
@@ -97,8 +96,6 @@ class NCViewerMediaPage: UIViewController {
         NotificationCenter.default.addObserver(self, selector: #selector(downloadedFile(_:)), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterDownloadedFile), object: nil)
         NotificationCenter.default.addObserver(self, selector: #selector(triggerProgressTask(_:)), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterProgressTask), object: nil)
 
-        NotificationCenter.default.addObserver(self, selector: #selector(uploadedFile(_:)), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterUploadedFile), object: nil)
-
         NotificationCenter.default.addObserver(self, selector: #selector(hidePlayerToolBar(_:)), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterHidePlayerToolBar), object: nil)
         NotificationCenter.default.addObserver(self, selector: #selector(showPlayerToolBar(_:)), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterShowPlayerToolBar), object: nil)
         
@@ -107,23 +104,24 @@ class NCViewerMediaPage: UIViewController {
         NotificationCenter.default.addObserver(self, selector: #selector(applicationDidBecomeActive(_:)), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterApplicationDidBecomeActive), object: nil)
     }
 
-    deinit {
-        print("#deinit NCViewerMediaPage")
+    override func viewDidDisappear(_ animated: Bool) {
+        super.viewDidDisappear(animated)
+
         // Clear
         if let ncplayer = currentViewController.ncplayer, ncplayer.isPlay() {
             ncplayer.playerPause()
             ncplayer.saveCurrentTime()
         }
-        currentViewController.playerToolBar.stopTimerAutoHide()
+        currentViewController.playerToolBar?.stopTimerAutoHide()
         clearCommandCenter()
 
         metadatas.removeAll()
         ncplayerLivePhoto = nil
-
+        
         #if MFFFLIB
         MFFF.shared.dismissMessage()
         #endif
-
+        
         // Remove Observer
         NotificationCenter.default.removeObserver(self, name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterDeleteFile), object: nil)
         NotificationCenter.default.removeObserver(self, name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterRenameFile), object: nil)
@@ -132,8 +130,6 @@ class NCViewerMediaPage: UIViewController {
         NotificationCenter.default.removeObserver(self, name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterDownloadedFile), object: nil)
         NotificationCenter.default.removeObserver(self, name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterProgressTask), object: nil)
 
-        NotificationCenter.default.removeObserver(self, name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterUploadedFile), object: nil)
-
         NotificationCenter.default.removeObserver(self, name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterHidePlayerToolBar), object: nil)
         NotificationCenter.default.removeObserver(self, name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterShowPlayerToolBar), object: nil)
 
@@ -184,7 +180,7 @@ class NCViewerMediaPage: UIViewController {
             progressView.isHidden = false
 
             if !currentViewController.detailView.isShow() {
-                currentViewController.playerToolBar.show(enableTimerAutoHide: enableTimerAutoHide)
+                currentViewController.playerToolBar?.show(enableTimerAutoHide: enableTimerAutoHide)
             }
 
             NCUtility.shared.colorNavigationController(navigationController, backgroundColor: NCBrandColor.shared.systemBackground, titleColor: NCBrandColor.shared.label, tintColor: nil, withoutShadow: false)
@@ -196,7 +192,7 @@ class NCViewerMediaPage: UIViewController {
             navigationController?.setNavigationBarHidden(true, animated: true)
             progressView.isHidden = true
 
-            currentViewController.playerToolBar.hide()
+            currentViewController.playerToolBar?.hide()
 
             view.backgroundColor = .black
             textColor = .white
@@ -233,22 +229,6 @@ class NCViewerMediaPage: UIViewController {
         }
     }
 
-    @objc func uploadedFile(_ notification: NSNotification) {
-
-        if let userInfo = notification.userInfo as NSDictionary? {
-            if let ocId = userInfo["ocId"] as? String, let metadata = NCManageDatabase.shared.getMetadataFromOcId(ocId), let errorCode = userInfo["errorCode"] as? Int {
-                if errorCode == 0, let index = metadatas.firstIndex(where: {$0.ocId == metadata.ocId}) {
-                    metadatas[index] = metadata
-                    if currentViewController.metadata.ocId == ocId {
-                        currentViewController.reloadImage()
-                    } else {
-                        modifiedOcId.append(ocId)
-                    }
-                }
-            }
-        }
-    }
-
     @objc func deleteFile(_ notification: NSNotification) {
 
         if let userInfo = notification.userInfo as NSDictionary? {
@@ -361,19 +341,19 @@ class NCViewerMediaPage: UIViewController {
         if metadata.classFile == NCCommunicationCommon.typeClassFile.video.rawValue || metadata.classFile == NCCommunicationCommon.typeClassFile.audio.rawValue {
 
             MPRemoteCommandCenter.shared().skipForwardCommand.isEnabled = true
-            skipForwardCommand = MPRemoteCommandCenter.shared().skipForwardCommand.addTarget { [weak self] event in
+            skipForwardCommand = MPRemoteCommandCenter.shared().skipForwardCommand.addTarget { event in
 
                 let seconds = Float64((event as! MPSkipIntervalCommandEvent).interval)
-                self?.currentViewController.playerToolBar.skip(seconds: seconds)
-                return .success
+                self.currentViewController.playerToolBar?.skip(seconds: seconds)
+                return.success
             }
 
             MPRemoteCommandCenter.shared().skipBackwardCommand.isEnabled = true
-            skipBackwardCommand = MPRemoteCommandCenter.shared().skipBackwardCommand.addTarget { [weak self] event in
+            skipBackwardCommand = MPRemoteCommandCenter.shared().skipBackwardCommand.addTarget { event in
 
                 let seconds = Float64((event as! MPSkipIntervalCommandEvent).interval)
-                self?.currentViewController.playerToolBar.skip(seconds: -seconds)
-                return .success
+                self.currentViewController.playerToolBar?.skip(seconds: -seconds)
+                return.success
             }
         }
 
@@ -494,15 +474,15 @@ extension NCViewerMediaPage: UIPageViewControllerDelegate, UIPageViewControllerD
 
         if currentIndex == 0 { return nil }
 
-        let viewerMedia = getViewerMedia(index: currentIndex - 1, metadata: metadatas[currentIndex - 1])
+        let viewerMedia = getViewerMedia(index: currentIndex-1, metadata: metadatas[currentIndex-1])
         return viewerMedia
     }
 
     func pageViewController(_ pageViewController: UIPageViewController, viewControllerAfter viewController: UIViewController) -> UIViewController? {
 
-        if currentIndex == metadatas.count - 1 { return nil }
+        if currentIndex == metadatas.count-1 { return nil }
 
-        let viewerMedia = getViewerMedia(index: currentIndex + 1, metadata: metadatas[currentIndex + 1])
+        let viewerMedia = getViewerMedia(index: currentIndex+1, metadata: metadatas[currentIndex+1])
         return viewerMedia
     }