Marino Faggiana 1 жил өмнө
parent
commit
cb60bbc1a5

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

@@ -206,13 +206,13 @@ extension NCViewer {
         }
 
         //
-        // DOWNLOAD IMAGE MAX RESOLUTION
+        // DOWNLOAD LOCALLY
         //
-        if !webView, metadata.session.isEmpty, metadata.classFile == NKCommon.TypeClassFile.image.rawValue, !CCUtility.fileProviderStorageExists(metadata) {
+        if !webView, metadata.session.isEmpty, !CCUtility.fileProviderStorageExists(metadata) {
             actions.append(
                 NCMenuAction(
-                    title: NSLocalizedString("_download_image_max_", comment: ""),
-                    icon: NCUtility.shared.loadImage(named: "square.and.arrow.down"),
+                    title: NSLocalizedString("_download_locally_", comment: ""),
+                    icon: NCUtility.shared.loadImage(named: "icloud.and.arrow.down"),
                     action: { _ in
                         NCNetworking.shared.download(metadata: metadata, selector: "") { _, _ in }
                     }

+ 1 - 1
iOSClient/Supporting Files/en.lproj/Localizable.strings

@@ -134,7 +134,7 @@
 "_of_"                      = "of";
 "_internal_modify_"         = "Edit with internal editor";
 "_database_corrupt_"        = "Oops something went wrong, please enter your credentials but don't worry, your files have remained secure";
-"_download_image_max_"      = "Download the image in full resolution";
+"_download_locally_"        = "Download locally";
 "_livephoto_save_"          = "Save Live Photo to photo album";
 "_livephoto_save_error_"    = "Error during save of Live Photo";
 "_file_conflict_num_"       = "file conflict";

+ 18 - 0
iOSClient/Viewer/NCViewerMedia/NCViewerMediaPage.swift

@@ -229,7 +229,25 @@ class NCViewerMediaPage: UIViewController {
 
     @objc func downloadedFile(_ notification: NSNotification) {
 
+        guard let userInfo = notification.userInfo as NSDictionary?,
+              let ocId = userInfo["ocId"] as? String
+        else {
+            return
+        }
+
         progressView.progress = 0
+        let metadata = metadatas[currentIndex]
+
+        if metadata.ocId == ocId,
+           (metadata.classFile == NKCommon.TypeClassFile.video.rawValue || metadata.classFile == NKCommon.TypeClassFile.audio.rawValue),
+           CCUtility.fileProviderStorageExists(metadata),
+           let ncplayer = currentViewController.ncplayer {
+            ncplayer.playerPause(withSnapshot: false)
+            DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
+                ncplayer.openAVPlayer(url: URL(fileURLWithPath: CCUtility.getDirectoryProviderStorageOcId(metadata.ocId, fileNameView: metadata.fileNameView)!))
+                ncplayer.playerPlay()
+            }
+        }
     }
 
     @objc func triggerProgressTask(_ notification: NSNotification) {