Kaynağa Gözat

coding

Signed-off-by: marinofaggiana <ios@nextcloud.com>
marinofaggiana 2 yıl önce
ebeveyn
işleme
c871705dca

+ 14 - 3
iOSClient/Main/Collection Common/NCCollectionViewCommon.swift

@@ -25,7 +25,7 @@ import UIKit
 import Realm
 import NCCommunication
 
-class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UISearchResultsUpdating, UISearchControllerDelegate, UISearchBarDelegate, NCListCellDelegate, NCGridCellDelegate, NCSectionHeaderMenuDelegate, UIAdaptivePresentationControllerDelegate, NCEmptyDataSetDelegate, UIContextMenuInteractionDelegate, NCAccountRequestDelegate, NCBackgroundImageColorDelegate, NCSelectableNavigationView {
+class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UISearchResultsUpdating, UISearchControllerDelegate, UISearchBarDelegate, NCListCellDelegate, NCGridCellDelegate, NCSectionHeaderMenuDelegate, NCSectionFooterDelegate, UIAdaptivePresentationControllerDelegate, NCEmptyDataSetDelegate, UIContextMenuInteractionDelegate, NCAccountRequestDelegate, NCBackgroundImageColorDelegate, NCSelectableNavigationView {
 
     @IBOutlet weak var collectionView: UICollectionView!
 
@@ -892,6 +892,10 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
         }
     }
 
+    func tapButtonSection(_ sender: Any) {
+        
+    }
+
     func longPressListItem(with objectId: String, gestureRecognizer: UILongPressGestureRecognizer) {
     }
 
@@ -1776,14 +1780,21 @@ extension NCCollectionViewCommon: UICollectionViewDataSource {
             let section = indexPath.section
             let metadataForSection = self.dataSource.getMetadataForSection(indexPath.section)
             let isPaginated = metadataForSection?.searchResult?.isPaginated ?? false
-            
-            footer.setTitleLabel(text: "")
+
+            footer.delegate = self
+
+            footer.setTitleLabel("")
+            footer.setButtonText(NSLocalizedString("_show_more_results_", comment: ""))
             footer.separatorIsHidden(true)
+            footer.buttonIsHidden(true)
 
             if isSearching {
                 if sections > 1 && section != sections - 1 {
                     footer.separatorIsHidden(false)
                 }
+                if isSearching && isPaginated {
+                    footer.buttonIsHidden(false)
+                }
             } else {
                 if sections == 1 || section == sections - 1 {
                     let info = dataSource.getFooterInformation()

+ 7 - 1
iOSClient/Main/Section Header Footer/NCSectionHeaderFooter.swift

@@ -364,11 +364,16 @@ class NCSectionFooter: UICollectionReusableView, NCSectionFooterDelegate {
         }
     }
 
-    func setTitleLabel(text: String) {
+    func setTitleLabel(_ text: String) {
 
         labelSection.text = text
     }
 
+    func setButtonText(_ text: String) {
+
+        buttonSection.setTitle(text, for: .normal)
+    }
+
     func separatorIsHidden(_ isHidden: Bool) {
 
         separator.isHidden = isHidden
@@ -387,6 +392,7 @@ class NCSectionFooter: UICollectionReusableView, NCSectionFooterDelegate {
     // MARK: - Action
 
     @IBAction func touchUpInsideButton(_ sender: Any) {
+        delegate?.tapButtonSection(sender)
     }
 }
 

+ 1 - 1
iOSClient/Select/NCSelect.swift

@@ -652,7 +652,7 @@ extension NCSelect: UICollectionViewDataSource {
             let sections = dataSource.numberOfSections()
             let section = indexPath.section
 
-            footer.setTitleLabel(text: "")
+            footer.setTitleLabel("")
             footer.separatorIsHidden(true)
 
             if sections == 1 || section == sections - 1 {

+ 1 - 0
iOSClient/Supporting Files/en.lproj/Localizable.strings

@@ -871,6 +871,7 @@
 "_scan_"                    = "Scan";
 "_in_"                      = "in";
 "_enter_passphrase_"        = "Enter passphrase (12 words)";
+"_show_more_results_"       = "show more results";
 
 // Video
 "_select_trace_"            = "Select the trace";

+ 1 - 1
iOSClient/Trash/NCTrash+CollectionView.swift

@@ -177,7 +177,7 @@ extension NCTrash: UICollectionViewDataSource {
             guard let footer = collectionView.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: "sectionFooter", for: indexPath) as? NCSectionFooter
             else { return UICollectionReusableView() }
 
-            footer.setTitleLabel(text: setTextFooter(datasource: datasource))
+            footer.setTitleLabel(setTextFooter(datasource: datasource))
             footer.separatorIsHidden(true)
 
             return footer