Browse Source

Update Message NCPlayerToolBar

Signed-off-by: marinofaggiana <96728420+MarinoFaggianaAstraIridium@users.noreply.github.com>
marinofaggiana 3 years ago
parent
commit
320b73190e

+ 1 - 1
iOSClient/Viewer/NCViewerMedia/NCPlayer/NCPlayer.swift

@@ -79,7 +79,7 @@ class NCPlayer: NSObject {
                 }
                 break
             case .failed:
-                #if MFFF
+                #if MFFFLIB
                 self.convertVideo(error: error)
                 #else
                 if let title = error?.localizedDescription, let description = error?.localizedFailureReason {

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

@@ -44,7 +44,8 @@ class NCPlayerToolBar: UIView {
     @IBOutlet weak var playerMessageHeightConstraint: NSLayoutConstraint!
     @IBOutlet weak var playerMessageProgressView: UIProgressView!
     @IBOutlet weak var playerMessageTitle: UILabel!
-    @IBOutlet weak var playerMessageComment: UILabel!
+    @IBOutlet weak var playerMessageTitleTopConstraint: NSLayoutConstraint!
+    @IBOutlet weak var playerMessageDescription: UILabel!
     @IBOutlet weak var playerMessageButton: UIButton!
     @IBOutlet weak var playerMessageCommentBottomConstraint: NSLayoutConstraint!
 
@@ -279,7 +280,7 @@ class NCPlayerToolBar: UIView {
         if metadata.livePhoto { return }
         if metadata.classFile != NCCommunicationCommon.typeClassFile.video.rawValue && metadata.classFile != NCCommunicationCommon.typeClassFile.audio.rawValue { return }
 
-        #if MFFF
+        #if MFFFLIB
         if MFFF.shared.existsMFFFSession(url: URL(fileURLWithPath: CCUtility.getDirectoryProviderStorageOcId(metadata.ocId, fileNameView: metadata.fileNameView))) {
             self.hide()
             return
@@ -389,6 +390,7 @@ class NCPlayerToolBar: UIView {
     
     func showMessage(_ title: String, description: String?, backgroundColor: UIColor = NCBrandColor.shared.brand, isHiddenPregress: Bool = true, hiddenAfterSeconds: Double = 0) {
         
+        self.playerMessageHeightConstraint.constant = 120
         self.playerMessage.backgroundColor = backgroundColor
 
         self.playerMessageTitle.text = NSLocalizedString(title, comment: "")
@@ -398,19 +400,25 @@ class NCPlayerToolBar: UIView {
         self.playerMessageButton.setBackgroundImage(UIImage(named: "stop")!.image(color: .black, size: 30), for: .normal)
         
         if let description = description {
-            self.playerMessageComment.text = NSLocalizedString(description, comment: "")      
+            self.playerMessageDescription.isHidden = false
+            self.playerMessageDescription.text = NSLocalizedString(description, comment: "")
+            self.playerMessageTitleTopConstraint.constant = 8
+        } else {
+            self.playerMessageDescription.isHidden = true
+            self.playerMessageHeightConstraint.constant = 65
+            self.playerMessageDescription.text = ""
+            self.playerMessageTitleTopConstraint.constant = 20
         }
-        self.playerMessageComment.textColor = NCBrandColor.shared.brandText
+        self.playerMessageDescription.textColor = NCBrandColor.shared.brandText
         
         self.playerMessageProgressView.progress = 0
         self.playerMessageProgressView.tintColor = .black
         self.playerMessageProgressView.isHidden = isHiddenPregress
         
-        playerMessageCommentBottomConstraint.constant = 30
-        playerMessageHeightConstraint.constant = 120
+        self.playerMessageCommentBottomConstraint.constant = 30
         if isHiddenPregress {
-            playerMessageCommentBottomConstraint.constant = 5
-            playerMessageHeightConstraint.constant = 90
+            self.playerMessageCommentBottomConstraint.constant = 5
+            self.playerMessageHeightConstraint.constant = 90
         }
         
         UIView.animate(withDuration: 0.3, animations: {
@@ -577,7 +585,7 @@ class NCPlayerToolBar: UIView {
     
     @IBAction func playerMessageButtonTouchInside(_ sender: UIButton) {
        
-        #if MFFF
+        #if MFFFLIB
         if let metadata = metadata {
             MFFF.shared.stopMFFFSession(url: URL(fileURLWithPath: CCUtility.getDirectoryProviderStorageOcId(metadata.ocId, fileNameView: metadata.fileNameView)))
         }

+ 1 - 1
iOSClient/Viewer/NCViewerMedia/NCViewerMedia.swift

@@ -163,7 +163,7 @@ class NCViewerMedia: UIViewController {
                 self.viewerMediaPage?.updateCommandCenter(ncplayer: ncplayer, metadata: self.metadata)
             }
             
-            #if MFFF
+            #if MFFFLIB
             MFFF.shared.delegate = self.ncplayer
             if !MFFF.shared.existsMFFFSession(url: URL(fileURLWithPath: CCUtility.getDirectoryProviderStorageOcId(metadata.ocId, fileNameView: metadata.fileNameView))) {
                 self.playerToolBar.hideMessage()

+ 10 - 12
iOSClient/Viewer/NCViewerMedia/NCViewerMediaPage.storyboard

@@ -394,26 +394,27 @@
                                             <outlet property="playbackSlider" destination="SR4-e8-1hC" id="Khx-Oe-NEQ"/>
                                             <outlet property="playerMessage" destination="dcP-0P-XaU" id="Elb-g9-KLN"/>
                                             <outlet property="playerMessageButton" destination="IBy-FL-p7m" id="oCg-wD-wui"/>
-                                            <outlet property="playerMessageComment" destination="0ay-aW-oWe" id="iR2-lY-e92"/>
                                             <outlet property="playerMessageCommentBottomConstraint" destination="mQr-bP-ade" id="UTD-j1-pNq"/>
+                                            <outlet property="playerMessageDescription" destination="0ay-aW-oWe" id="6iU-2Q-5al"/>
                                             <outlet property="playerMessageHeightConstraint" destination="Hj6-hL-o4b" id="hbN-pd-ZtS"/>
                                             <outlet property="playerMessageProgressView" destination="xph-h7-QuN" id="mJi-16-HJC"/>
                                             <outlet property="playerMessageTitle" destination="hDm-OS-aGd" id="aHa-Zu-vYF"/>
+                                            <outlet property="playerMessageTitleTopConstraint" destination="hZH-VC-Bs7" id="3Mh-Eb-8XB"/>
                                             <outlet property="playerTopToolBarView" destination="dgJ-dQ-lSp" id="22g-Yn-k5r"/>
                                         </connections>
                                     </view>
                                     <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="dcP-0P-XaU" userLabel="Player Message">
                                         <rect key="frame" x="15" y="606" width="384" height="120"/>
                                         <subviews>
-                                            <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Title" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="hDm-OS-aGd">
-                                                <rect key="frame" x="15" y="8" width="354" height="19"/>
-                                                <fontDescription key="fontDescription" type="boldSystem" pointSize="14"/>
+                                            <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="description" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="0ay-aW-oWe">
+                                                <rect key="frame" x="15" y="30" width="354" height="60"/>
+                                                <fontDescription key="fontDescription" type="system" pointSize="13"/>
                                                 <nil key="textColor"/>
                                                 <nil key="highlightedColor"/>
                                             </label>
-                                            <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Comment" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="0ay-aW-oWe">
-                                                <rect key="frame" x="15" y="30" width="354" height="60"/>
-                                                <fontDescription key="fontDescription" type="system" pointSize="13"/>
+                                            <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="title" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="hDm-OS-aGd">
+                                                <rect key="frame" x="15" y="8" width="354" height="19"/>
+                                                <fontDescription key="fontDescription" type="boldSystem" pointSize="14"/>
                                                 <nil key="textColor"/>
                                                 <nil key="highlightedColor"/>
                                             </label>
@@ -436,7 +437,7 @@
                                                 </connections>
                                             </button>
                                         </subviews>
-                                        <color key="backgroundColor" systemColor="systemTealColor"/>
+                                        <color key="backgroundColor" systemColor="systemBackgroundColor"/>
                                         <constraints>
                                             <constraint firstAttribute="height" constant="120" id="Hj6-hL-o4b"/>
                                             <constraint firstAttribute="trailing" secondItem="0ay-aW-oWe" secondAttribute="trailing" constant="15.000000000000057" id="KK6-KV-ov5"/>
@@ -514,14 +515,11 @@
         <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="pip.enter" catalog="system" width="32" height="32"/>
         <image name="play.fill" catalog="system" width="116" height="128"/>
         <image name="taskCancelDownload" width="25" height="25"/>
         <systemColor name="systemBackgroundColor">
             <color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
         </systemColor>
-        <systemColor name="systemTealColor">
-            <color red="0.18823529411764706" green="0.69019607843137254" blue="0.7803921568627451" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
-        </systemColor>
     </resources>
 </document>