Fix return of updated and deleted metadatas in database manager

Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
Claudio Cambra 2023-03-10 18:36:01 +01:00
parent f427750f2c
commit 147e06c40a
No known key found for this signature in database
GPG key ID: C839200C384636B0

View file

@ -194,7 +194,7 @@ class NextcloudFilesDatabaseManager : NSObject {
return (returningNewMetadatas, returningUpdatedMetadatas)
}
func updateItemMetadatas(account: String, serverUrl: String, updatedMetadatas: [NextcloudItemMetadataTable]) -> (newMetadatas: [NextcloudItemMetadataTable]?, updatedMetadatas: [NextcloudItemMetadataTable]?, deletedMetadatas: [NextcloudItemMetadataTable]?) {
func updateItemMetadatas(account: String, serverUrl: String, updatedMetadatas: [NextcloudItemMetadataTable], completionHandler: @escaping(_ newMetadatas: [NextcloudItemMetadataTable]?, _ updatedMetadatas: [NextcloudItemMetadataTable]?, _ deletedMetadatas: [NextcloudItemMetadataTable]?) -> Void) {
let database = ncDatabase()
do {
@ -209,13 +209,12 @@ class NextcloudFilesDatabaseManager : NSObject {
existingMetadatas: existingMetadatas,
updatedMetadatas: updatedMetadatas)
return (metadatasFromUpdate.newMetadatas, metadatasFromUpdate.updatedMetadatas, deletedMetadatas)
completionHandler(metadatasFromUpdate.newMetadatas, metadatasFromUpdate.updatedMetadatas, deletedMetadatas)
}
} catch let error {
NSLog("Could not update any metadatas, received error: %@", error.localizedDescription)
completionHandler(nil, nil, nil)
}
return (nil, nil, nil)
}
func setStatusForItemMetadata(_ metadata: NextcloudItemMetadataTable, status: NextcloudItemMetadataTable.Status) -> NextcloudItemMetadataTable? {