|
@@ -52,13 +52,13 @@ import NCCommunication
|
|
|
|
|
|
// Download file
|
|
|
|
|
|
- @objc func download(metadata: tableMetadata, selector: String, setFavorite: Bool, checkExistsFileSystem: Bool) {
|
|
|
+ @objc func download(metadata: tableMetadata, selector: String, setFavorite: Bool) {
|
|
|
for operation in downloadQueue.operations as! [NCOperationDownload] {
|
|
|
if operation.metadata.ocId == metadata.ocId {
|
|
|
return
|
|
|
}
|
|
|
}
|
|
|
- downloadQueue.addOperation(NCOperationDownload.init(metadata: metadata, selector: selector, setFavorite: setFavorite, checkExistsFileSystem: checkExistsFileSystem))
|
|
|
+ downloadQueue.addOperation(NCOperationDownload.init(metadata: metadata, selector: selector, setFavorite: setFavorite))
|
|
|
}
|
|
|
@objc func downloadCancelAll() {
|
|
|
downloadQueue.cancelAll()
|
|
@@ -181,25 +181,17 @@ class NCOperationDownload: ConcurrentOperation {
|
|
|
var metadata: tableMetadata
|
|
|
var selector: String
|
|
|
var setFavorite: Bool
|
|
|
- var checkExistsFileSystem: Bool
|
|
|
|
|
|
- init(metadata: tableMetadata, selector: String, setFavorite: Bool, checkExistsFileSystem: Bool) {
|
|
|
+ init(metadata: tableMetadata, selector: String, setFavorite: Bool) {
|
|
|
self.metadata = tableMetadata.init(value: metadata)
|
|
|
self.selector = selector
|
|
|
self.setFavorite = setFavorite
|
|
|
- self.checkExistsFileSystem = checkExistsFileSystem
|
|
|
}
|
|
|
|
|
|
override func start() {
|
|
|
if isCancelled {
|
|
|
self.finish()
|
|
|
} else {
|
|
|
- if checkExistsFileSystem {
|
|
|
- if CCUtility.fileProviderStorageExists(metadata.ocId, fileNameView: metadata.fileNameView) {
|
|
|
- self.finish()
|
|
|
- return
|
|
|
- }
|
|
|
- }
|
|
|
NCNetworking.shared.download(metadata: metadata, selector: self.selector, setFavorite: self.setFavorite) { (_) in
|
|
|
self.finish()
|
|
|
}
|
|
@@ -316,7 +308,7 @@ class NCOperationSynchronization: ConcurrentOperation {
|
|
|
} else {
|
|
|
let localFile = NCManageDatabase.sharedInstance.getTableLocalFile(predicate: NSPredicate(format: "ocId == %@", metadata.ocId))
|
|
|
if localFile == nil || localFile?.etag != metadata.etag {
|
|
|
- NCOperationQueue.shared.download(metadata: metadata, selector: self.selector, setFavorite: false, checkExistsFileSystem: false)
|
|
|
+ NCOperationQueue.shared.download(metadata: metadata, selector: self.selector, setFavorite: false)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -332,7 +324,7 @@ class NCOperationSynchronization: ConcurrentOperation {
|
|
|
}
|
|
|
|
|
|
for metadata in metadatasChanged.metadatasLocalUpdate {
|
|
|
- NCOperationQueue.shared.download(metadata: metadata, selector: self.selector, setFavorite: false, checkExistsFileSystem: false)
|
|
|
+ NCOperationQueue.shared.download(metadata: metadata, selector: self.selector, setFavorite: false)
|
|
|
}
|
|
|
}
|
|
|
// Update etag directory
|
|
@@ -348,7 +340,7 @@ class NCOperationSynchronization: ConcurrentOperation {
|
|
|
if self.download {
|
|
|
let localFile = NCManageDatabase.sharedInstance.getTableLocalFile(predicate: NSPredicate(format: "ocId == %@", metadata.ocId))
|
|
|
if localFile == nil || localFile?.etag != metadata.etag {
|
|
|
- NCOperationQueue.shared.download(metadata: metadata, selector: self.selector, setFavorite: false, checkExistsFileSystem: false)
|
|
|
+ NCOperationQueue.shared.download(metadata: metadata, selector: self.selector, setFavorite: false)
|
|
|
}
|
|
|
}
|
|
|
self.finish()
|