|
@@ -675,7 +675,7 @@ extension NCDetailViewController: NCViewerImageViewControllerDelegate, NCViewerI
|
|
|
}
|
|
|
|
|
|
// Automatic download for: Encripted
|
|
|
- } else if metadata.session == "" && CCUtility.fileProviderStorageSize(metadata.ocId, fileNameView: metadata.fileNameView) == 0 && isFolderEncrypted{
|
|
|
+ } else if metadata.status == Int(k_metadataStatusNormal) && CCUtility.fileProviderStorageSize(metadata.ocId, fileNameView: metadata.fileNameView) == 0 && isFolderEncrypted{
|
|
|
|
|
|
if NCManageDatabase.sharedInstance.getMetadata(predicate: NSPredicate(format: "ocId == %@ AND session != ''", metadata.ocId)) == nil {
|
|
|
|
|
@@ -685,15 +685,17 @@ extension NCDetailViewController: NCViewerImageViewControllerDelegate, NCViewerI
|
|
|
completion(index, NCViewerImageCommon.shared.getImageOffOutline(frame: self.view.frame, type: metadata.typeFile), metadata, ZoomScale.default, nil)
|
|
|
|
|
|
// Automatic download for: HEIC - GIF - SVG
|
|
|
- } else if metadata.session == "" && CCUtility.fileProviderStorageSize(metadata.ocId, fileNameView: metadata.fileNameView) == 0 && ((metadata.contentType == "image/heic" && metadata.hasPreview == false) || ext == "GIF" || ext == "SVG") {
|
|
|
+ } else if metadata.status == Int(k_metadataStatusNormal) && CCUtility.fileProviderStorageSize(metadata.ocId, fileNameView: metadata.fileNameView) == 0 && ((metadata.contentType == "image/heic" && metadata.hasPreview == false) || ext == "GIF" || ext == "SVG") {
|
|
|
|
|
|
let serverUrlFileName = metadata.serverUrl + "/" + metadata.fileName
|
|
|
let fileNameLocalPath = CCUtility.getDirectoryProviderStorageOcId(metadata.ocId, fileNameView: metadata.fileName)!
|
|
|
|
|
|
- metadata.session = k_download_session_foreground
|
|
|
+ metadata.status = Int(k_metadataStatusInDownload)
|
|
|
|
|
|
NCCommunication.shared.download(serverUrlFileName: serverUrlFileName, fileNameLocalPath: fileNameLocalPath, taskHandler: { (task) in
|
|
|
|
|
|
+ metadata.status = Int(k_metadataStatusDownloading)
|
|
|
+
|
|
|
}, progressHandler: { (progress) in
|
|
|
|
|
|
self.progress(Float(progress.fractionCompleted))
|
|
@@ -713,7 +715,7 @@ extension NCDetailViewController: NCViewerImageViewControllerDelegate, NCViewerI
|
|
|
completion(index, NCViewerImageCommon.shared.getImageOffOutline(frame: self.view.frame, type: metadata.typeFile), metadata, ZoomScale.default, nil)
|
|
|
}
|
|
|
|
|
|
- metadata.session = ""
|
|
|
+ metadata.status = Int(k_metadataStatusNormal)
|
|
|
self.progress(0)
|
|
|
}
|
|
|
|