marinofaggiana 4 年之前
父節點
當前提交
77c297f5a4
共有 2 個文件被更改,包括 3 次插入3 次删除
  1. 2 2
      iOSClient/Database/NCManageDatabase.swift
  2. 1 1
      iOSClient/Media/NCMedia.swift

+ 2 - 2
iOSClient/Database/NCManageDatabase.swift

@@ -2392,12 +2392,12 @@ class NCManageDatabase: NSObject {
         return tableMetadata.init(value: result)
     }
    
-    @objc func getMedias(account: String, predicate: NSPredicate, sortKeyPath: String) -> [tableMetadata]? {
+    @objc func getMedias(account: String, predicate: NSPredicate) -> [tableMetadata]? {
         
         let realm = try! Realm()
         realm.refresh()
         
-        let sortProperties = [SortDescriptor(keyPath: sortKeyPath, ascending: false), SortDescriptor(keyPath: "fileNameView", ascending: false)]
+        let sortProperties = [SortDescriptor(keyPath: "date", ascending: false), SortDescriptor(keyPath: "fileNameView", ascending: false)]
         let results = realm.objects(tableMedia.self).filter(predicate).sorted(by: sortProperties)
         if results.count == 0 {
             return nil

+ 1 - 1
iOSClient/Media/NCMedia.swift

@@ -559,7 +559,7 @@ extension NCMedia {
         
         DispatchQueue.global().async {
             
-            let metadatas = NCManageDatabase.sharedInstance.getMedias(account: self.appDelegate.activeAccount, predicate: NSPredicate(format: "account == %@", self.appDelegate.activeAccount), sortKeyPath: "date")
+            let metadatas = NCManageDatabase.sharedInstance.getMedias(account: self.appDelegate.activeAccount, predicate: NSPredicate(format: "account == %@", self.appDelegate.activeAccount))
             self.sectionDatasource = CCSectionMetadata.creataDataSourseSectionMetadata(metadatas, listProgressMetadata: nil, groupByField: "date", filterTypeFileImage: self.filterTypeFileImage, filterTypeFileVideo: self.filterTypeFileVideo, sorted: "date", ascending: false, activeAccount: self.appDelegate.activeAccount)
             
             DispatchQueue.main.async {