|
@@ -2013,6 +2013,25 @@ class NCManageDatabase: NSObject {
|
|
|
NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)")
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ @objc func updateMetadatasFavorite(account: String, metadatas: [tableMetadata]) {
|
|
|
+
|
|
|
+ let realm = try! Realm()
|
|
|
+
|
|
|
+ do {
|
|
|
+ try realm.safeWrite {
|
|
|
+ let results = realm.objects(tableMetadata.self).filter("account == %@ AND favorite == true", account)
|
|
|
+ for result in results {
|
|
|
+ result.favorite = false
|
|
|
+ }
|
|
|
+ for metadata in metadatas {
|
|
|
+ realm.add(metadata, update: .all)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } catch let error {
|
|
|
+ NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)")
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
@objc func setMetadataEncrypted(ocId: String, encrypted: Bool) {
|
|
|
|