Browse Source

Improvements

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

+ 1 - 1
iOSClient/Menu/NCViewer+Menu.swift

@@ -137,7 +137,7 @@ extension NCViewer {
         //
         // CONVERSION VIDEO TO MPEG4 (MFFF Lib)
         //
-        #if MFFF
+        #if MFFFLIB
         if metadata.classFile == NCCommunicationCommon.typeClassFile.video.rawValue {
             
             actions.append(

+ 15 - 4
iOSClient/Supporting Files/en.lproj/Localizable.strings

@@ -138,7 +138,7 @@
 "_move_or_copy_"            = "Move or copy";
 "_copy_"                    = "Copy";
 "_now_"                     = "Now";
-"_wait_"                    = "Please wait …";
+"_wait_"                    = "Please wait…";
 "_attention_"               = "Attention";
 "_recent_"                  = "Recent";
 "_view_in_folder_"          = "View in folder";
@@ -163,7 +163,7 @@
 "_settings_account_request_" = "Request account at startup";
 "_print_"                   = "Print";
 "_alias_"                   = "Alias";
-"_alias_footer_"            = "Give your account names a descriptive name such as Home, Office, School …";
+"_alias_footer_"            = "Give your account names a descriptive name such as Home, Office, School…";
 "_upload_chunk_"            = "The file you are uploading is large, keep the app in the foreground until complete";
 "_upload_e2ee_"             = "The file you are uploading is encrypted, keep the app in the foreground until complete";
 "_chunk_size_mb_"           = "Chunk size in MB";
@@ -242,7 +242,7 @@
 "_network_not_available_"   = "Network unavailable";
 "_file_too_big_"            = "File too large to be encrypted/decrypted";
 "_file_too_big_max_100_"    = "File too large (max 100 kb.)";
-"_...loading..._"           = "Loading …";
+"_...loading..._"           = "Loading…";
 "_download_plist_"          = " ";
 "_no_reuploadfile_"         = "Could not find nor resend file. Delete the upload and reload the file to upload it.";
 "_file_already_exists_"     = "Unable to complete the operation, a file with the same name exists";
@@ -822,4 +822,15 @@
 "_copy_path_"               = "Copy path";
 "_certificates_"            = "Certificates";
 "_privacy_screen_"          = "Splash screen when app inactive";
-
+// Video
+"_video_conversion_"        = "Video conversion";
+"_preparation_video_"       = "Video preparation in progress…";
+"_downloading_"             = "Downloading";
+"_download_error_"          = "Download error";
+"_subtitle_"                = "Subtitle";
+"_dts_to_ac3_"              = "The DTS is not supported, it requires a conversion to Dolby Digital";
+"_reuired_conversion_"      = "This video takes a long time to convert.";
+"_stay_app_foreground_"     = "Stay with the app in the foreground…";
+"_conversion_available_"    = "The conversion is always available on menu";
+"_video_format_not_recognized_"     = "This video is not compatible, do you want to try to convert it?";
+"_conversion_max_compatibility_"    = "Max compatibility, the conversion can take much longer";

+ 3 - 5
iOSClient/Viewer/NCViewerMedia/NCPlayer/NCPlayer.swift

@@ -69,7 +69,7 @@ class NCPlayer: NSObject {
         if CCUtility.fileProviderStorageExists(metadata.ocId, fileNameView: NCGlobal.shared.fileNameVideoEncoded) {
             self.url = URL(fileURLWithPath: CCUtility.getDirectoryProviderStorageOcId(metadata.ocId, fileNameView: NCGlobal.shared.fileNameVideoEncoded))
         }
-
+              
         openAVPlayer() { status, error in
             
             switch status {
@@ -232,7 +232,7 @@ class NCPlayer: NSObject {
 
         playerToolBar?.updateToolBar()
     }
-
+    
     // MARK: -
 
     func isPlay() -> Bool {
@@ -279,9 +279,7 @@ class NCPlayer: NSObject {
 
     @objc func generatorImagePreview() {
 
-        guard let time = player?.currentTime() else { return }
-        if metadata.livePhoto { return }
-        if metadata.classFile == NCCommunicationCommon.typeClassFile.audio.rawValue { return }
+        guard let time = player?.currentTime(), !metadata.livePhoto, metadata.classFile != NCCommunicationCommon.typeClassFile.audio.rawValue  else { return }
 
         var image: UIImage?
 

+ 25 - 34
iOSClient/Viewer/NCViewerMedia/NCPlayer/NCPlayerToolBar.swift

@@ -40,14 +40,11 @@ class NCPlayerToolBar: UIView {
     @IBOutlet weak var playbackSlider: UISlider!
     @IBOutlet weak var labelLeftTime: UILabel!
     @IBOutlet weak var labelCurrentTime: UILabel!
-
     @IBOutlet weak var playerMessageHeightConstraint: NSLayoutConstraint!
     @IBOutlet weak var playerMessageProgressView: UIProgressView!
     @IBOutlet weak var playerMessageTitle: UILabel!
-    @IBOutlet weak var playerMessageTitleTopConstraint: NSLayoutConstraint!
     @IBOutlet weak var playerMessageDescription: UILabel!
     @IBOutlet weak var playerMessageButton: UIButton!
-    @IBOutlet weak var playerMessageCommentBottomConstraint: NSLayoutConstraint!
 
     enum sliderEventType {
         case began
@@ -157,7 +154,7 @@ class NCPlayerToolBar: UIView {
     }
 
     public func updateToolBar() {
-
+        
         guard let ncplayer = self.ncplayer else { return }
 
         // MUTE
@@ -223,6 +220,7 @@ class NCPlayerToolBar: UIView {
     // MARK: Handle Notifications
 
     @objc func handleRouteChange(notification: Notification) {
+        
         guard let userInfo = notification.userInfo, let reasonValue = userInfo[AVAudioSessionRouteChangeReasonKey] as? UInt, let reason = AVAudioSession.RouteChangeReason(rawValue: reasonValue) else { return }
 
         switch reason {
@@ -275,9 +273,7 @@ class NCPlayerToolBar: UIView {
 
     public func show(enableTimerAutoHide: Bool = false) {
 
-        guard let metadata = self.metadata else { return }
-        if ncplayer == nil { return }
-        if metadata.livePhoto { return }
+        guard let metadata = self.metadata, ncplayer != nil, !metadata.livePhoto else { return }
         if metadata.classFile != NCCommunicationCommon.typeClassFile.video.rawValue && metadata.classFile != NCCommunicationCommon.typeClassFile.audio.rawValue { return }
 
         #if MFFFLIB
@@ -292,7 +288,7 @@ class NCPlayerToolBar: UIView {
             startTimerAutoHide()
         }
         if !self.isHidden { return }
-
+        
         UIView.animate(withDuration: 0.3, animations: {
             self.alpha = 1
             self.playerTopToolBarView.alpha = 1
@@ -342,8 +338,7 @@ class NCPlayerToolBar: UIView {
 
     func skip(seconds: Float64) {
 
-        guard let ncplayer = ncplayer else { return }
-        guard let player = ncplayer.player else { return }
+        guard let ncplayer = ncplayer, let player = ncplayer.player else { return }
 
         let currentTime = player.currentTime()
         var newTime: CMTime = .zero
@@ -388,45 +383,41 @@ class NCPlayerToolBar: UIView {
     
     // MARK: - Message
     
-    func showMessage(_ title: String, description: String?, backgroundColor: UIColor = NCBrandColor.shared.brand, isHiddenPregress: Bool = true, hiddenAfterSeconds: Double = 0) {
+    func showMessage(_ title: String, description: String? = nil, backgroundColor: UIColor = NCBrandColor.shared.brand, isProgressHidden: Bool = true, hiddenAfterSeconds: Double = 0) {
         
-        self.playerMessageHeightConstraint.constant = 120
         self.playerMessage.backgroundColor = backgroundColor
-
-        self.playerMessageTitle.text = NSLocalizedString(title, comment: "")
         self.playerMessageTitle.textColor = NCBrandColor.shared.brandText
+        self.playerMessageDescription.textColor = NCBrandColor.shared.brandText
 
-        self.playerMessageButton.isHidden = isHiddenPregress
-        self.playerMessageButton.setBackgroundImage(UIImage(named: "stop")!.image(color: .black, size: 30), for: .normal)
-
+        self.playerMessageTitle.text = NSLocalizedString(title, comment: "")
+        
         if let description = description {
-            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.playerMessageTitle.text = ""
+            self.playerMessageTitle.isHidden = true
+            self.playerMessageDescription.font = UIFont.boldSystemFont(ofSize: 14.0)
+            self.playerMessageDescription.text = NSLocalizedString(title, comment: "")
         }
-        self.playerMessageDescription.textColor = NCBrandColor.shared.brandText
-
+        
         self.playerMessageProgressView.progress = 0
         self.playerMessageProgressView.tintColor = .black
-        self.playerMessageProgressView.isHidden = isHiddenPregress
-
-        self.playerMessageCommentBottomConstraint.constant = 30
-        if isHiddenPregress {
-            self.playerMessageCommentBottomConstraint.constant = 5
+        self.playerMessageProgressView.isHidden = isProgressHidden
+        
+        self.playerMessageButton.isHidden = isProgressHidden
+        self.playerMessageButton.setBackgroundImage(UIImage(named: "stop")!.image(color: .black, size: 30), for: .normal)
+        
+        if isProgressHidden && description != nil {
             self.playerMessageHeightConstraint.constant = 90
         }
-
+        
         UIView.animate(withDuration: 0.3, animations: {
             self.playerMessage.alpha = 1
         }, completion: { (_: Bool) in
             self.playerMessage.isHidden = false
         })
-
+        
         timerAutoHideMessage?.invalidate()
         if hiddenAfterSeconds > 0 {
             timerAutoHideMessage = Timer.scheduledTimer(timeInterval: hiddenAfterSeconds, target: self, selector: #selector(hideMessage), userInfo: nil, repeats: false)
@@ -434,9 +425,9 @@ class NCPlayerToolBar: UIView {
     }
     
     @objc func hideMessage() {
-
+        
         self.playerMessageProgressView.progress = 0
-
+        
         UIView.animate(withDuration: 0.3, animations: {
             self.playerMessage.alpha = 0
         }, completion: { (_: Bool) in
@@ -449,7 +440,7 @@ class NCPlayerToolBar: UIView {
         self.playerMessageProgressView.progress = progress
     }
     
-    func isHiddenMessage() -> Bool {
+    func isMessageHidden() -> Bool {
         
         timerAutoHideMessage?.invalidate()
         return self.playerMessage.isHidden

+ 11 - 9
iOSClient/Viewer/NCViewerMedia/NCViewerMediaPage.storyboard

@@ -394,26 +394,30 @@
                                             <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="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">
+                                    <view hidden="YES" 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="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"/>
+                                                <constraints>
+                                                    <constraint firstAttribute="height" constant="60" id="bKn-Vz-IHT"/>
+                                                </constraints>
                                                 <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="title" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="hDm-OS-aGd">
-                                                <rect key="frame" x="15" y="8" width="354" height="19"/>
+                                                <rect key="frame" x="15" y="5" width="354" height="20"/>
+                                                <constraints>
+                                                    <constraint firstAttribute="height" constant="20" id="hgP-I5-k0D"/>
+                                                </constraints>
                                                 <fontDescription key="fontDescription" type="boldSystem" pointSize="14"/>
                                                 <nil key="textColor"/>
                                                 <nil key="highlightedColor"/>
@@ -439,20 +443,18 @@
                                         </subviews>
                                         <color key="backgroundColor" systemColor="systemBackgroundColor"/>
                                         <constraints>
+                                            <constraint firstItem="0ay-aW-oWe" firstAttribute="centerY" secondItem="dcP-0P-XaU" secondAttribute="centerY" id="2O1-Ll-kTg"/>
+                                            <constraint firstItem="hDm-OS-aGd" firstAttribute="top" secondItem="dcP-0P-XaU" secondAttribute="top" constant="5" id="EoF-FL-wGD"/>
                                             <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"/>
                                             <constraint firstItem="xph-h7-QuN" firstAttribute="leading" secondItem="dcP-0P-XaU" secondAttribute="leading" constant="15" id="PG4-3d-CnT"/>
-                                            <constraint firstItem="0ay-aW-oWe" firstAttribute="top" secondItem="hDm-OS-aGd" secondAttribute="bottom" constant="3" id="VoM-4v-uHz"/>
                                             <constraint firstItem="IBy-FL-p7m" firstAttribute="leading" secondItem="xph-h7-QuN" secondAttribute="trailing" constant="10" id="Wxd-Wo-eC1"/>
                                             <constraint firstAttribute="trailing" secondItem="IBy-FL-p7m" secondAttribute="trailing" constant="5" id="bbL-qa-ywb"/>
                                             <constraint firstItem="0ay-aW-oWe" firstAttribute="leading" secondItem="dcP-0P-XaU" secondAttribute="leading" constant="15" id="efH-Ty-CxK"/>
-                                            <constraint firstItem="hDm-OS-aGd" firstAttribute="top" secondItem="dcP-0P-XaU" secondAttribute="top" constant="8" id="hZH-VC-Bs7"/>
                                             <constraint firstAttribute="bottom" secondItem="IBy-FL-p7m" secondAttribute="bottom" constant="5" id="hj6-vu-1oD"/>
                                             <constraint firstAttribute="bottom" secondItem="xph-h7-QuN" secondAttribute="bottom" constant="18" id="ktP-qt-9Vo"/>
-                                            <constraint firstAttribute="bottom" secondItem="0ay-aW-oWe" secondAttribute="bottom" constant="30" id="mQr-bP-ade"/>
                                             <constraint firstItem="hDm-OS-aGd" firstAttribute="leading" secondItem="dcP-0P-XaU" secondAttribute="leading" constant="15" id="uJh-HI-mhr"/>
                                             <constraint firstAttribute="trailing" secondItem="hDm-OS-aGd" secondAttribute="trailing" constant="15" id="waz-yc-nK3"/>
-                                            <constraint firstItem="0ay-aW-oWe" firstAttribute="top" secondItem="dcP-0P-XaU" secondAttribute="top" constant="30" id="xau-Hg-qaU"/>
                                         </constraints>
                                     </view>
                                 </subviews>
@@ -515,7 +517,7 @@
         <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="32" height="32"/>
+        <image name="pip.enter" catalog="system" width="128" height="96"/>
         <image name="play.fill" catalog="system" width="116" height="128"/>
         <image name="taskCancelDownload" width="25" height="25"/>
         <systemColor name="systemBackgroundColor">