Marino Faggiana před 7 roky
rodič
revize
f3401f8a12
1 změnil soubory, kde provedl 39 přidání a 0 odebrání
  1. 39 0
      iOSClient/FileSystem/NCManageDatabase.swift

+ 39 - 0
iOSClient/FileSystem/NCManageDatabase.swift

@@ -1508,5 +1508,44 @@ class NCManageDatabase: NSObject {
         return copyMetadata
     }
     
+    //MARK: -
+    //MARK: Table Directory
+    
+    func addDirectory(_ directory: tableDirectory) {
+        
+        let tableAccount = self.getAccountActive()
+        if tableAccount == nil {
+            return
+        }
+        
+        let realm = try! Realm()
+        
+        try! realm.write {
+            
+            if (directory.realm == nil) {
+                directory.directoryID = CCUtility.createRandomString(16)  //[CCUtility createRandomString:16];
+            }
+            
+            realm.add(directory, update: true)
+        }
+    }
+    
+    func deleteDirectory(_ predicate: NSPredicate) {
+        
+        let tableAccount = self.getAccountActive()
+        if tableAccount == nil {
+            return
+        }
+        
+        let realm = try! Realm()
+        
+        let results = realm.objects(tableDirectory.self).filter(predicate)
+        
+        try! realm.write {
+            realm.delete(results)
+        }
+    }
+
+
     //MARK: -
 }