diff options
author | Marino Faggiana <marino@marinofaggiana.com> | 2022-11-02 11:54:39 +0300 |
---|---|---|
committer | Marino Faggiana <marino@marinofaggiana.com> | 2022-11-02 11:54:39 +0300 |
commit | 546adfb5013b3c1b5fe6f34e7e77e13dc33a9bcc (patch) | |
tree | 96e341ecb88ce14898481ce200d9ab5f2e88f4e1 | |
parent | 691b42f4ad446921b5bb31c637978e18a5e490e5 (diff) |
#2149
Signed-off-by: Marino Faggiana <marino@marinofaggiana.com>
-rw-r--r-- | Nextcloud.xcodeproj/project.pbxproj | 4 | ||||
-rw-r--r-- | iOSClient/Main/Create cloud/NCCreateFormUploadConflict.swift | 2 | ||||
-rw-r--r-- | iOSClient/Utility/NCUtility.swift | 35 |
3 files changed, 29 insertions, 12 deletions
diff --git a/Nextcloud.xcodeproj/project.pbxproj b/Nextcloud.xcodeproj/project.pbxproj index 1fa7ac3ee..ef19d249f 100644 --- a/Nextcloud.xcodeproj/project.pbxproj +++ b/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; diff --git a/iOSClient/Main/Create cloud/NCCreateFormUploadConflict.swift b/iOSClient/Main/Create cloud/NCCreateFormUploadConflict.swift index 7e57a43cd..d0de8936f 100644 --- a/iOSClient/Main/Create cloud/NCCreateFormUploadConflict.swift +++ b/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 diff --git a/iOSClient/Utility/NCUtility.swift b/iOSClient/Utility/NCUtility.swift index d85efe8b8..e15a14179 100644 --- a/iOSClient/Utility/NCUtility.swift +++ b/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) |