Explorar o código

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

Made-with: Cursor
huzaifahayat12 hai 1 semana
pai
achega
508e743cb2
Modificáronse 1 ficheiros con 6 adicións e 8 borrados
  1. 6 8
      meetings_app/ViewController.swift

+ 6 - 8
meetings_app/ViewController.swift

@@ -5734,6 +5734,11 @@ private extension ViewController {
5734
         guard nextCount > schedulePageVisibleCount else { return }
5734
         guard nextCount > schedulePageVisibleCount else { return }
5735
         schedulePageVisibleCount = nextCount
5735
         schedulePageVisibleCount = nextCount
5736
         renderSchedulePageCards()
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
     private func schedulePageScrolled() {
5744
     private func schedulePageScrolled() {
@@ -5742,7 +5747,7 @@ private extension ViewController {
5742
         let contentHeight = scroll.documentView?.bounds.height ?? 0
5747
         let contentHeight = scroll.documentView?.bounds.height ?? 0
5743
         guard contentHeight > 0 else { return }
5748
         guard contentHeight > 0 else { return }
5744
         let remaining = contentHeight - (contentBounds.origin.y + contentBounds.height)
5749
         let remaining = contentHeight - (contentBounds.origin.y + contentBounds.height)
5745
-        if remaining < 180 {
5750
+        if remaining <= 200 {
5746
             appendSchedulePageBatchIfNeeded()
5751
             appendSchedulePageBatchIfNeeded()
5747
         }
5752
         }
5748
     }
5753
     }
@@ -5809,13 +5814,6 @@ private extension ViewController {
5809
             spacer.setContentHuggingPriority(.defaultLow, for: .horizontal)
5814
             spacer.setContentHuggingPriority(.defaultLow, for: .horizontal)
5810
             pagination.addArrangedSubview(spacer)
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
             stack.addArrangedSubview(pagination)
5817
             stack.addArrangedSubview(pagination)
5820
             pagination.widthAnchor.constraint(equalTo: stack.widthAnchor).isActive = true
5818
             pagination.widthAnchor.constraint(equalTo: stack.widthAnchor).isActive = true
5821
         }
5819
         }