Bladeren bron

Fix Schedule pagination to auto-load meetings in six-card batches.

Made-with: Cursor
huzaifahayat12 1 week geleden
bovenliggende
commit
508e743cb2
1 gewijzigde bestanden met toevoegingen van 6 en 8 verwijderingen
  1. 6 8
      meetings_app/ViewController.swift

+ 6 - 8
meetings_app/ViewController.swift

@@ -5734,6 +5734,11 @@ private extension ViewController {
5734 5734
         guard nextCount > schedulePageVisibleCount else { return }
5735 5735
         schedulePageVisibleCount = nextCount
5736 5736
         renderSchedulePageCards()
5737
+        // If we're still near the bottom after adding a batch (large viewport),
5738
+        // immediately evaluate again so pagination keeps advancing in chunks of 6.
5739
+        DispatchQueue.main.async { [weak self] in
5740
+            self?.schedulePageScrolled()
5741
+        }
5737 5742
     }
5738 5743
 
5739 5744
     private func schedulePageScrolled() {
@@ -5742,7 +5747,7 @@ private extension ViewController {
5742 5747
         let contentHeight = scroll.documentView?.bounds.height ?? 0
5743 5748
         guard contentHeight > 0 else { return }
5744 5749
         let remaining = contentHeight - (contentBounds.origin.y + contentBounds.height)
5745
-        if remaining < 180 {
5750
+        if remaining <= 200 {
5746 5751
             appendSchedulePageBatchIfNeeded()
5747 5752
         }
5748 5753
     }
@@ -5809,13 +5814,6 @@ private extension ViewController {
5809 5814
             spacer.setContentHuggingPriority(.defaultLow, for: .horizontal)
5810 5815
             pagination.addArrangedSubview(spacer)
5811 5816
 
5812
-            let loadMore = makeSchedulePagePillButton(
5813
-                title: "Load more",
5814
-                action: #selector(schedulePageLoadMorePressed(_:))
5815
-            )
5816
-            loadMore.widthAnchor.constraint(equalToConstant: 118).isActive = true
5817
-            pagination.addArrangedSubview(loadMore)
5818
-
5819 5817
             stack.addArrangedSubview(pagination)
5820 5818
             pagination.widthAnchor.constraint(equalTo: stack.widthAnchor).isActive = true
5821 5819
         }