Browse Source

Some small gui improvements

Signed-off-by: Marino Faggiana <marino@marinofaggiana.com>
Marino Faggiana 1 năm trước cách đây
mục cha
commit
e9ee88849b

+ 12 - 5
iOSClient/Main/Collection Common/NCListCell.swift

@@ -293,11 +293,18 @@ class NCListCell: UICollectionViewCell, UIGestureRecognizerDelegate, NCCellProto
             labelInfo.isHidden = true
             if let tag = tags.first {
                 tagListView.addTag(tag)
-                if tags.count >= 2 {
-                    tagListView.addTag(tags[1])
-                }
-                if tags.count > 2 {
-                    tagListView.addTag("+\(tags.count-2)")
+                if UIDevice.current.userInterfaceIdiom == .pad {
+                    tagListView.addTag(tag)
+                    if tags.count >= 2 {
+                        tagListView.addTag(tags[1])
+                    }
+                    if tags.count > 2 {
+                        tagListView.addTag("+\(tags.count-2)")
+                    }
+                } else {
+                    if tags.count > 1 {
+                        tagListView.addTag("+\(tags.count-1)")
+                    }
                 }
             }
         }

+ 2 - 2
iOSClient/Main/Collection Common/NCListCell.xib

@@ -66,7 +66,7 @@
                         <nil key="highlightedColor"/>
                     </label>
                     <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="z1r-ZA-ft8" customClass="TagListView" customModule="TagListView">
-                        <rect key="frame" x="60" y="120" width="519" height="15"/>
+                        <rect key="frame" x="60" y="124" width="519" height="15"/>
                         <color key="backgroundColor" systemColor="systemBackgroundColor"/>
                         <constraints>
                             <constraint firstAttribute="height" constant="15" id="9NQ-gM-wQ6"/>
@@ -170,7 +170,7 @@
                 <constraint firstItem="Gu8-oz-zWa" firstAttribute="trailing" secondItem="yhy-xd-w5C" secondAttribute="trailing" id="s2S-RP-cw5"/>
                 <constraint firstItem="AyA-hP-r6w" firstAttribute="centerY" secondItem="Gu8-oz-zWa" secondAttribute="centerY" id="sJp-0x-bdC"/>
                 <constraint firstItem="Gu8-oz-zWa" firstAttribute="trailing" secondItem="o4u-0K-Qpt" secondAttribute="trailing" constant="45" id="tOD-Sd-Uhy"/>
-                <constraint firstAttribute="bottom" secondItem="z1r-ZA-ft8" secondAttribute="bottom" constant="13" id="wfc-n7-tCT"/>
+                <constraint firstAttribute="bottom" secondItem="z1r-ZA-ft8" secondAttribute="bottom" constant="9" id="wfc-n7-tCT"/>
                 <constraint firstItem="jc6-Vg-TaS" firstAttribute="centerY" secondItem="o4u-0K-Qpt" secondAttribute="centerY" id="xnq-6u-TXH"/>
             </constraints>
             <size key="customSize" width="719" height="146"/>

+ 7 - 7
iOSClient/Networking/NCNetworking.swift

@@ -1527,26 +1527,26 @@ class NCNetworking: NSObject, NKCommonDelegate {
 
     // MARK: - Direct Download
 
-    func getVideoUrl(metadata: tableMetadata, completition: @escaping (_ url: URL?, _ autoplay: Bool) -> Void) {
+    func getVideoUrl(metadata: tableMetadata, completition: @escaping (_ url: URL?, _ autoplay: Bool, _ error: NKError) -> Void) {
 
         if !metadata.url.isEmpty {
             if metadata.url.hasPrefix("/") {
-                completition(URL(fileURLWithPath: metadata.url), true)
+                completition(URL(fileURLWithPath: metadata.url), true, .success)
             } else {
-                completition(URL(string: metadata.url), true)
+                completition(URL(string: metadata.url), true, .success)
             }
         } else if CCUtility.fileProviderStorageExists(metadata) {
-            completition(URL(fileURLWithPath: CCUtility.getDirectoryProviderStorageOcId(metadata.ocId, fileNameView: metadata.fileNameView)), false)
+            completition(URL(fileURLWithPath: CCUtility.getDirectoryProviderStorageOcId(metadata.ocId, fileNameView: metadata.fileNameView)), false, .success)
         } else {
             NextcloudKit.shared.getDirectDownload(fileId: metadata.fileId) { account, url, data, error in
                 if error == .success && url != nil {
                     if let url = URL(string: url!) {
-                        completition(url, false)
+                        completition(url, false, error)
                     } else {
-                        completition(nil, false)
+                        completition(nil, false, error)
                     }
                 } else {
-                    completition(nil, false)
+                    completition(nil, false, error)
                 }
             }
         }

+ 6 - 2
iOSClient/Viewer/NCViewerMedia/NCViewerMedia.swift

@@ -149,9 +149,13 @@ class NCViewerMedia: UIViewController {
         if metadata.isMovie {
             if let ncplayer = self.ncplayer {
                 if ncplayer.url == nil {
-                    NCNetworking.shared.getVideoUrl(metadata: metadata) { url, autoplay in
-                        if let url = url {
+                    NCActivityIndicator.shared.startActivity(backgroundView: self.view, style: .medium)
+                    NCNetworking.shared.getVideoUrl(metadata: metadata) { url, autoplay, error in
+                        NCActivityIndicator.shared.stop()
+                        if error == .success, let url = url {
                             ncplayer.openAVPlayer(url: url, autoplay: autoplay)
+                        } else {
+                            NCContentPresenter.shared.showError(error: error)
                         }
                     }
                 } else {

+ 1 - 1
iOSClient/Viewer/NCViewerProviderContextMenu.swift

@@ -239,7 +239,7 @@ class NCViewerProviderContextMenu: UIViewController {
 
     private func viewVideo(metadata: tableMetadata) {
 
-        NCNetworking.shared.getVideoUrl(metadata: metadata) { url, autoplay in
+        NCNetworking.shared.getVideoUrl(metadata: metadata) { url, autoplay, _ in
             if let url = url, let userAgent = CCUtility.getUserAgent() {
                 self.player.media = VLCMedia(url: url)
                 self.player.delegate = self