浏览代码

widget fix order

Signed-off-by: Marino Faggiana <marino@marinofaggiana.com>
Marino Faggiana 2 年之前
父节点
当前提交
94f1346f86
共有 1 个文件被更改,包括 2 次插入1 次删除
  1. 2 1
      iOSClient/Data/NCManageDatabase+DashboardWidget.swift

+ 2 - 1
iOSClient/Data/NCManageDatabase+DashboardWidget.swift

@@ -41,7 +41,8 @@ extension NCManageDatabase {
     func getDashboardWidgetApplications(account: String) -> [tableDashboardWidget] {
     func getDashboardWidgetApplications(account: String) -> [tableDashboardWidget] {
 
 
         let realm = try! Realm()
         let realm = try! Realm()
-        let results = realm.objects(tableDashboardWidget.self).filter("account == %@", account).sorted(byKeyPath: "title", ascending: true)
+        let sortProperties = [SortDescriptor(keyPath: "order", ascending: true), SortDescriptor(keyPath: "title", ascending: true)]
+        let results = realm.objects(tableDashboardWidget.self).filter("account == %@", account).sorted(by: sortProperties)
 
 
         return Array(results.map { tableDashboardWidget.init(value: $0) })
         return Array(results.map { tableDashboardWidget.init(value: $0) })
     }
     }