mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-21 20:45:51 +03:00
Favour straight return in updateItemMetadatas rather than unnecessary completionHandler in NextcloudFilesDatabaseManager
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
parent
0526079504
commit
a779fe76cb
2 changed files with 6 additions and 6 deletions
|
@ -175,7 +175,7 @@ class NextcloudFilesDatabaseManager : NSObject {
|
|||
return (returningNewMetadatas, returningUpdatedMetadatas, directoriesNeedingRename)
|
||||
}
|
||||
|
||||
func updateItemMetadatas(account: String, serverUrl: String, updatedMetadatas: [NextcloudItemMetadataTable], updateDirectoryEtags: Bool, completionHandler: @escaping(_ newMetadatas: [NextcloudItemMetadataTable]?, _ updatedMetadatas: [NextcloudItemMetadataTable]?, _ deletedMetadatas: [NextcloudItemMetadataTable]?) -> Void) {
|
||||
func updateItemMetadatas(account: String, serverUrl: String, updatedMetadatas: [NextcloudItemMetadataTable], updateDirectoryEtags: Bool) -> (newMetadatas: [NextcloudItemMetadataTable]?, updatedMetadatas: [NextcloudItemMetadataTable]?, deletedMetadatas: [NextcloudItemMetadataTable]?) {
|
||||
let database = ncDatabase()
|
||||
|
||||
do {
|
||||
|
@ -213,10 +213,10 @@ class NextcloudFilesDatabaseManager : NSObject {
|
|||
}
|
||||
}
|
||||
|
||||
completionHandler(metadatasToCreate, metadatasToUpdate, metadatasToDelete)
|
||||
return (newMetadatas: metadatasToCreate, updatedMetadatas: metadatasToUpdate, deletedMetadatas: metadatasToDelete)
|
||||
} catch let error {
|
||||
Logger.ncFilesDatabase.error("Could not update any item metadatas, received error: \(error.localizedDescription, privacy: .public)")
|
||||
completionHandler(nil, nil, nil)
|
||||
return (nil, nil, nil)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -610,9 +610,9 @@ class FileProviderEnumerator: NSObject, NSFileProviderEnumerator {
|
|||
// that our local copies are up to date -- instead, leave them as the old.
|
||||
// They will get updated when they are the subject of a readServerUrl call.
|
||||
// (See above)
|
||||
dbManager.updateItemMetadatas(account: ncKitAccount, serverUrl: serverUrl, updatedMetadatas: metadatas, updateDirectoryEtags: false) { newMetadatas, updatedMetadatas, deletedMetadatas in
|
||||
completionHandler(metadatas, newMetadatas, updatedMetadatas, deletedMetadatas, nil)
|
||||
}
|
||||
let changedMetadatas = dbManager.updateItemMetadatas(account: ncKitAccount, serverUrl: serverUrl, updatedMetadatas: metadatas, updateDirectoryEtags: false)
|
||||
|
||||
completionHandler(metadatas, changedMetadatas.newMetadatas, changedMetadatas.updatedMetadatas, changedMetadatas.deletedMetadatas, nil)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue