mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-25 06:25:56 +03:00
Also report all new, updated, and deleted metadatas from updateItemMetadatas in NextcloudFilesDatabaseManager
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
parent
a10b563eb7
commit
e7e850094b
1 changed files with 11 additions and 7 deletions
|
@ -189,24 +189,28 @@ class NextcloudFilesDatabaseManager : NSObject {
|
||||||
return (returningNewMetadatas, returningUpdatedMetadatas)
|
return (returningNewMetadatas, returningUpdatedMetadatas)
|
||||||
}
|
}
|
||||||
|
|
||||||
func updateItemMetadatas(account: String, serverUrl: String, updatedMetadatas: [NextcloudItemMetadataTable]) {
|
func updateItemMetadatas(account: String, serverUrl: String, updatedMetadatas: [NextcloudItemMetadataTable]) -> (newMetadatas: [NextcloudItemMetadataTable]?, updatedMetadatas: [NextcloudItemMetadataTable]?, deletedMetadatas: [NextcloudItemMetadataTable]?) {
|
||||||
let database = ncDatabase()
|
let database = ncDatabase()
|
||||||
|
|
||||||
do {
|
do {
|
||||||
try database.write {
|
try database.write {
|
||||||
let existingMetadatas = ncDatabase().objects(NextcloudItemMetadataTable.self).filter("account == %@ AND serverUrl == %@ AND status == %@", account, serverUrl, NextcloudItemMetadataTable.Status.normal.rawValue)
|
let existingMetadatas = ncDatabase().objects(NextcloudItemMetadataTable.self).filter("account == %@ AND serverUrl == %@ AND status == %@", account, serverUrl, NextcloudItemMetadataTable.Status.normal.rawValue)
|
||||||
|
|
||||||
processItemMetadatasToDelete(databaseToWriteTo: database,
|
let deletedMetadatas = processItemMetadatasToDelete(databaseToWriteTo: database,
|
||||||
existingMetadatas: existingMetadatas,
|
existingMetadatas: existingMetadatas,
|
||||||
updatedMetadatas: updatedMetadatas)
|
updatedMetadatas: updatedMetadatas)
|
||||||
|
|
||||||
processItemMetadatasToUpdate(databaseToWriteTo: database,
|
let metadatasFromUpdate = processItemMetadatasToUpdate(databaseToWriteTo: database,
|
||||||
existingMetadatas: existingMetadatas,
|
existingMetadatas: existingMetadatas,
|
||||||
updatedMetadatas: updatedMetadatas)
|
updatedMetadatas: updatedMetadatas)
|
||||||
|
|
||||||
|
return (metadatasFromUpdate.newMetadatas, metadatasFromUpdate.updatedMetadatas, deletedMetadatas)
|
||||||
}
|
}
|
||||||
} catch let error {
|
} catch let error {
|
||||||
NSLog("Could not update any metadatas, received error: %@", error.localizedDescription)
|
NSLog("Could not update any metadatas, received error: %@", error.localizedDescription)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return (nil, nil, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
func setStatusForItemMetadata(_ metadata: NextcloudItemMetadataTable, status: NextcloudItemMetadataTable.Status) -> NextcloudItemMetadataTable? {
|
func setStatusForItemMetadata(_ metadata: NextcloudItemMetadataTable, status: NextcloudItemMetadataTable.Status) -> NextcloudItemMetadataTable? {
|
||||||
|
|
Loading…
Reference in a new issue