Browse Source

clear code

marinofaggiana 5 years ago
parent
commit
bec3ce7821
2 changed files with 0 additions and 35 deletions
  1. 0 27
      iOSClient/Database/NCManageDatabase.swift
  2. 0 8
      iOSClient/Media/NCMedia.swift

+ 0 - 27
iOSClient/Database/NCManageDatabase.swift

@@ -2123,33 +2123,6 @@ class NCManageDatabase: NSObject {
         return Calendar.current.date(bySettingHour: 0, minute: 0, second: 0, of: Date())!
     }
     
-    @objc func AlignMediaMetadata(account: String) {
-        
-        let realm = try! Realm()
-        realm.refresh()
-        
-        let sortProperties = [SortDescriptor(keyPath: "date", ascending: false), SortDescriptor(keyPath: "fileNameView", ascending: false)]
-        let results = realm.objects(tableMedia.self).filter(NSPredicate(format: "account == %@", account)).sorted(by: sortProperties)
-        if results.count == 0 {
-            return
-        }
-        
-        do {
-            try realm.write {
-                for result in results {
-                    if let tableMetadata = realm.objects(tableMetadata.self).filter(NSPredicate(format: "fileID == %@", result.fileID)).first {
-                        if result.etag != tableMetadata.etag {
-                            realm.add(tableMedia.init(value: tableMetadata), update: true)
-                        }
-                    }
-                }
-            }
-        } catch let error {
-            print("[LOG] Could not write to database: ", error)
-            realm.cancelWrite()
-        }
-    }
-    
     //MARK: -
     //MARK: Table Photo Library
     

+ 0 - 8
iOSClient/Media/NCMedia.swift

@@ -143,14 +143,6 @@ class NCMedia: UIViewController, DropdownMenuDelegate, DZNEmptyDataSetSource, DZ
         }
     }
     
-    override func viewWillDisappear(_ animated: Bool) {
-        super.viewWillDisappear(animated)
-        
-        DispatchQueue.global().async {
-            NCManageDatabase.sharedInstance.AlignMediaMetadata(account: self.appDelegate.activeAccount)
-        }
-    }
-    
     override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {
         super.viewWillTransition(to: size, with: coordinator)