Browse Source

coding

Signed-off-by: marinofaggiana <ios@nextcloud.com>
marinofaggiana 2 năm trước cách đây
mục cha
commit
68769f851d

+ 2 - 2
iOSClient/Data/NCDataSource.swift

@@ -302,10 +302,10 @@ class NCDataSource: NSObject {
         return metadatasForSection.metadatas[indexPath.row]
     }
 
-    func getMetadataForSection(indexPath: IndexPath) -> NCMetadataForSection? {
+    func getMetadataForSection(_ section: Int) -> NCMetadataForSection? {
 
         if metadatasForSection.count == 0 { return nil }
-        return self.metadatasForSection[indexPath.section]
+        return self.metadatasForSection[section]
     }
 
     func getSectionValue(indexPath: IndexPath) -> String {

+ 2 - 1
iOSClient/Main/Collection Common/NCCollectionViewCommon.swift

@@ -1774,7 +1774,7 @@ extension NCCollectionViewCommon: UICollectionViewDataSource {
             let footer = collectionView.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: "sectionFooter", for: indexPath) as! NCSectionFooter
             let sections = dataSource.numberOfSections()
             let section = indexPath.section
-            let metadataForSection = self.dataSource.getMetadataForSection(indexPath: indexPath)
+            let metadataForSection = self.dataSource.getMetadataForSection(indexPath.section)
 
             footer.setTitleLabel(text: "")
             footer.separatorIsHidden(true)
@@ -1850,6 +1850,7 @@ extension NCCollectionViewCommon: UICollectionViewDelegateFlowLayout {
     func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, referenceSizeForFooterInSection section: Int) -> CGSize {
 
         let sections = dataSource.numberOfSections()
+        let metadataForSection = self.dataSource.getMetadataForSection(section)
 
         if section == sections - 1 {
             return CGSize(width: collectionView.frame.width, height: NCGlobal.shared.endHeightFooter)