Эх сурвалжийг харах

#2149

Signed-off-by: Marino Faggiana <marino@marinofaggiana.com>
Marino Faggiana 2 жил өмнө
parent
commit
546adfb501

+ 2 - 2
Nextcloud.xcodeproj/project.pbxproj

@@ -3607,7 +3607,7 @@
 				CLANG_WARN_UNREACHABLE_CODE = YES;
 				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
 				COPY_PHASE_STRIP = NO;
-				CURRENT_PROJECT_VERSION = 7;
+				CURRENT_PROJECT_VERSION = 8;
 				DEVELOPMENT_TEAM = NKUJUXUJ3B;
 				ENABLE_STRICT_OBJC_MSGSEND = YES;
 				ENABLE_TESTABILITY = YES;
@@ -3670,7 +3670,7 @@
 				CLANG_WARN_UNREACHABLE_CODE = YES;
 				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
 				COPY_PHASE_STRIP = NO;
-				CURRENT_PROJECT_VERSION = 7;
+				CURRENT_PROJECT_VERSION = 8;
 				DEVELOPMENT_TEAM = NKUJUXUJ3B;
 				ENABLE_STRICT_OBJC_MSGSEND = YES;
 				ENABLE_TESTABILITY = YES;

+ 1 - 1
iOSClient/Main/Create cloud/NCCreateFormUploadConflict.swift

@@ -315,7 +315,7 @@ extension NCCreateFormUploadConflict: UITableViewDataSource {
 
             cell.backgroundColor = tableView.backgroundColor
 
-            let metadataNewFile = metadatasUploadInConflict[indexPath.row]
+            let metadataNewFile =  tableMetadata.init(value: metadatasUploadInConflict[indexPath.row])
 
             cell.ocId = metadataNewFile.ocId
             cell.delegate = self

+ 26 - 9
iOSClient/Utility/NCUtility.swift

@@ -527,17 +527,34 @@ class NCUtility: NSObject {
             }
 
             PHImageManager.default().requestAVAsset(forVideo: asset, options: options) { asset, audioMix, info in
-                guard let asset = asset as? AVURLAsset else { return callCompletion(error: true) }
-                NCUtilityFileSystem.shared.deleteFile(filePath: fileNamePath)
-                do {
-                    try FileManager.default.copyItem(at: asset.url, to: URL(fileURLWithPath: fileNamePath))
-                } catch {
+                if let asset = asset as? AVURLAsset {
+                    NCUtilityFileSystem.shared.deleteFile(filePath: fileNamePath)
+                    do {
+                        try FileManager.default.copyItem(at: asset.url, to: URL(fileURLWithPath: fileNamePath))
+                        metadata.creationDate = creationDate as NSDate
+                        metadata.date = modificationDate as NSDate
+                        metadata.size = NCUtilityFileSystem.shared.getFileSize(filePath: fileNamePath)
+                        return callCompletion(error: false)
+                    } catch {
+                        return callCompletion(error: true)
+                    }
+                } else if let asset = asset as? AVComposition, asset.tracks.count > 1, let exporter = AVAssetExportSession(asset: asset, presetName: AVAssetExportPresetPassthrough) {
+                    exporter.outputURL = URL(fileURLWithPath: fileNamePath)
+                    exporter.outputFileType = AVFileType.mp4
+                    exporter.shouldOptimizeForNetworkUse = true
+                    exporter.exportAsynchronously {
+                        if exporter.status == .completed {
+                            metadata.creationDate = creationDate as NSDate
+                            metadata.date = modificationDate as NSDate
+                            metadata.size = NCUtilityFileSystem.shared.getFileSize(filePath: fileNamePath)
+                            return callCompletion(error: false)
+                        } else {
+                            return callCompletion(error: true)
+                        }
+                    }
+                } else {
                     return callCompletion(error: true)
                 }
-                metadata.creationDate = creationDate as NSDate
-                metadata.date = modificationDate as NSDate
-                metadata.size = NCUtilityFileSystem.shared.getFileSize(filePath: fileNamePath)
-                return callCompletion(error: false)
             }
         } else {
             return callCompletion(error: true)