marinofaggiana 4 жил өмнө
parent
commit
e89a1d6cae

+ 3 - 2
iOSClient/Activity/NCActivity.swift

@@ -166,8 +166,9 @@ extension NCActivity: UITableViewDelegate {
 extension NCActivity: UITableViewDataSource {
     
     func numberOfSections(in tableView: UITableView) -> Int {
-        emptyDataSet?.numberOfSections(sectionDate.count)
-        return sectionDate.count
+        let sections = sectionDate.count
+        emptyDataSet?.numberOfSections(sections)
+        return sections
     }
     
     func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {

+ 5 - 4
iOSClient/EmptyView/NCEmptyDataSet.swift

@@ -17,7 +17,7 @@ class NCEmptyDataSet: NSObject {
     var emptyView: NCEmptyView?
     var delegate: NCEmptyDataSetDelegate?
     var timer: Timer?
-    var numberItemsForSection: [Int:Int] = [:]
+    var numberItemsForSection: [Int] = []
     
     init(view: UIView, offset: CGFloat = 0, delegate: NCEmptyDataSetDelegate?) {
         super.init()
@@ -26,6 +26,7 @@ class NCEmptyDataSet: NSObject {
         
             self.delegate = delegate
             self.emptyView = emptyView
+            numberItemsForSection = [Int](repeating: 0, count:1)
             
             emptyView.frame =  CGRect(x:0, y: 0, width:300, height:300)
             emptyView.isHidden = true
@@ -44,7 +45,7 @@ class NCEmptyDataSet: NSObject {
     }
     
     func numberOfSections(_ num: Int) {
-        self.numberItemsForSection.removeAll()
+        numberItemsForSection = [Int](repeating: 0, count:num)
     }
     
     func numberOfItemsInSection(_ num: Int, section: Int) {
@@ -57,7 +58,7 @@ class NCEmptyDataSet: NSObject {
             }
             
             var numberItems: Int = 0
-            for (_, value) in numberItemsForSection {
+            for value in numberItemsForSection {
                 numberItems += value
             }
             if numberItems > 0 {
@@ -71,7 +72,7 @@ class NCEmptyDataSet: NSObject {
     @objc func timerHandler(_ timer: Timer) {
         
         var numberItems: Int = 0
-        for (_, value) in numberItemsForSection {
+        for value in numberItemsForSection {
             numberItems += value
         }
         if numberItems == 0 {