|
@@ -75,9 +75,19 @@ class NCDataSource: NSObject {
|
|
|
|
|
|
self.sectionsValue = metadatasSource.map { getSectionValue(metadata: $0) }
|
|
|
self.sectionsValue = Array(Set(self.sectionsValue))
|
|
|
-// if let providers = self.providers {
|
|
|
-
|
|
|
-// } else {
|
|
|
+ if let providers = self.providers {
|
|
|
+ var sectionsDictionary: [String:Int] = [:]
|
|
|
+ for section in self.sectionsValue {
|
|
|
+ if let provider = providers.filter({ $0.name.lowercased() == section.lowercased()}).first {
|
|
|
+ sectionsDictionary[section] = provider.order
|
|
|
+ }
|
|
|
+ }
|
|
|
+ self.sectionsValue.removeAll()
|
|
|
+ let sectionsDictionarySorted = sectionsDictionary.sorted(by: { $0.value > $1.value } )
|
|
|
+ for section in sectionsDictionarySorted { self.sectionsValue.append(section.key) }
|
|
|
+ print(sectionsDictionarySorted)
|
|
|
+ print(self.sectionsValue)
|
|
|
+ } else {
|
|
|
self.sectionsValue = self.sectionsValue.sorted {
|
|
|
if self.ascending {
|
|
|
return $0 < $1
|
|
@@ -85,7 +95,7 @@ class NCDataSource: NSObject {
|
|
|
return $0 > $1
|
|
|
}
|
|
|
}
|
|
|
-// }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
internal func createMetadataForSection(sectionValue: String) {
|