marinofaggiana 4 years ago
parent
commit
e10258bfe6

+ 1 - 1
iOSClient/Favorites/NCFavorite.swift

@@ -65,7 +65,7 @@ class NCFavorite: NCCollectionViewCommon  {
             }
         }
         
-        self.dataSource = NCDataSource.init(metadatasSource: metadatasSource, directoryOnTop: directoryOnTop, filterLivePhoto: true)
+        self.dataSource = NCDataSource.init(metadatasSource: metadatasSource, directoryOnTop: directoryOnTop, favoriteOnTop: true, filterLivePhoto: true)
         
         refreshControl.endRefreshing()
         collectionView.reloadData()

+ 1 - 1
iOSClient/FileViewInFolder/NCFileViewInFolder.swift

@@ -90,7 +90,7 @@ class NCFileViewInFolder: NCCollectionViewCommon  {
             }
         }
         
-        dataSource = NCDataSource.init(metadatasSource: metadatasSource, directoryOnTop: directoryOnTop, filterLivePhoto: true)
+        dataSource = NCDataSource.init(metadatasSource: metadatasSource, directoryOnTop: directoryOnTop, favoriteOnTop: true, filterLivePhoto: true)
         
         refreshControl.endRefreshing()
         collectionView.reloadData()

+ 1 - 1
iOSClient/Files/NCFiles.swift

@@ -84,7 +84,7 @@ class NCFiles: NCCollectionViewCommon  {
             }
         }
         
-        dataSource = NCDataSource.init(metadatasSource: metadatasSource, directoryOnTop: directoryOnTop, filterLivePhoto: true)
+        dataSource = NCDataSource.init(metadatasSource: metadatasSource, directoryOnTop: directoryOnTop, favoriteOnTop: true, filterLivePhoto: true)
         
         refreshControl.endRefreshing()
         collectionView.reloadData()

+ 4 - 2
iOSClient/Main/NCDataSource.swift

@@ -30,16 +30,18 @@ class NCDataSource: NSObject {
     public var metadataLocalImage: [String:String] = [:]
 
     private var directoryOnTop: Bool = true
+    private var favoriteOnTop: Bool = true
     private var filterLivePhoto: Bool = true
     
     override init() {
         super.init()
     }
     
-    init(metadatasSource: [tableMetadata], directoryOnTop: Bool, filterLivePhoto: Bool) {
+    init(metadatasSource: [tableMetadata], directoryOnTop: Bool, favoriteOnTop: Bool, filterLivePhoto: Bool) {
         super.init()
         
         self.directoryOnTop = directoryOnTop
+        self.favoriteOnTop = favoriteOnTop
         self.filterLivePhoto = filterLivePhoto
         
         createMetadatas(metadatasSource: metadatasSource)
@@ -84,7 +86,7 @@ class NCDataSource: NSObject {
             }
                
             // Organized the metadata
-            if metadata.favorite {
+            if metadata.favorite && favoriteOnTop {
                 if metadata.directory {
                     metadataFavoriteDirectory.append(metadata)
                 } else {

+ 1 - 1
iOSClient/Offline/NCOffline.swift

@@ -80,7 +80,7 @@ class NCOffline: NCCollectionViewCommon  {
             }
         }
         
-        self.dataSource = NCDataSource.init(metadatasSource: metadatasSource, directoryOnTop: directoryOnTop, filterLivePhoto: true)
+        self.dataSource = NCDataSource.init(metadatasSource: metadatasSource, directoryOnTop: directoryOnTop, favoriteOnTop: true, filterLivePhoto: true)
         
         refreshControl.endRefreshing()
         collectionView.reloadData()

+ 1 - 1
iOSClient/Recent/NCRecent.swift

@@ -52,7 +52,7 @@ class NCRecent: NCCollectionViewCommon  {
         (layout, _, _, groupBy, _, titleButton, itemForLine) = NCUtility.shared.getLayoutForView(key: layoutKey, serverUrl: "")
 
         metadatasSource = NCManageDatabase.sharedInstance.getMetadatas(predicate: NSPredicate(format: "account == %@", appDelegate.account), page: 1, limit: 100, sorted: "date", ascending: false)
-        self.dataSource = NCDataSource.init(metadatasSource: metadatasSource, directoryOnTop: false, filterLivePhoto: true)
+        self.dataSource = NCDataSource.init(metadatasSource: metadatasSource, directoryOnTop: false, favoriteOnTop: true, filterLivePhoto: true)
         
         refreshControl.endRefreshing()
         collectionView.reloadData()

+ 1 - 1
iOSClient/Select/NCSelect.swift

@@ -747,7 +747,7 @@ extension NCSelect {
         }
         
         let metadatasSource = NCManageDatabase.sharedInstance.getMetadatas(predicate: predicate!, page: 0, limit: 0, sorted: sort, ascending: ascending)
-        self.dataSource = NCDataSource.init(metadatasSource: metadatasSource, directoryOnTop: directoryOnTop, filterLivePhoto: true)
+        self.dataSource = NCDataSource.init(metadatasSource: metadatasSource, directoryOnTop: directoryOnTop, favoriteOnTop: true, filterLivePhoto: true)
         
         if withLoadFolder {
             loadFolder()

+ 1 - 1
iOSClient/Transfers/NCTransfers.swift

@@ -207,7 +207,7 @@ class NCTransfers: NCCollectionViewCommon  {
         (layout, _, _, groupBy, _, titleButton, itemForLine) = NCUtility.shared.getLayoutForView(key: layoutKey, serverUrl: "")
         
         metadatasSource = NCManageDatabase.sharedInstance.getMetadatas(predicate: NSPredicate(format: "(session CONTAINS 'upload') OR (session CONTAINS 'download')"), page: 1, limit: 100, sorted: "sessionTaskIdentifier", ascending: false)
-        self.dataSource = NCDataSource.init(metadatasSource: metadatasSource, directoryOnTop: false, filterLivePhoto: false)
+        self.dataSource = NCDataSource.init(metadatasSource: metadatasSource, directoryOnTop: false, favoriteOnTop: false, filterLivePhoto: false)
         
         refreshControl.endRefreshing()
         collectionView.reloadData()