This commit is contained in:
anlicheng 2025-04-11 14:26:18 +08:00
parent acb51093c4
commit cfe9dd5c2e

View File

@ -84,18 +84,19 @@ struct IndexMainView: View {
.frame(width: 370)
.coordinateSpace(name: "indexScrollView")
.onScrollPhaseChange { oldPhase, newPhase in
print("scroll old: \(oldPhase), new: \(newPhase), footer-offset: \(footerOffset)")
guard !footerRefreshing && !showDateNavPopover else {
return
}
print("scroll old: \(oldPhase), new: \(newPhase), footer-offset: \(footerOffset)")
//
let height = Int(UIScreen.main.bounds.height)
if newPhase == .idle && self.footerOffset < height + 500 {
let distance = height - footerOffset
if newPhase == .idle && (distance >= 0 && distance < 50) {
self.footerRefreshing = true
Task {
await self.indexModel.loadMoreUpdateDramas(userId: self.userId, mode: .next)
await MainActor.run {
DispatchQueue.main.asyncAfter(deadline: .now() + 0.2) {
self.footerRefreshing = false
}
}