fix index view

This commit is contained in:
anlicheng 2025-04-10 16:59:12 +08:00
parent 3051c0253e
commit 046834d9d7
2 changed files with 18 additions and 16 deletions

View File

@ -62,7 +62,7 @@ struct IndexMainView: View {
ScrollView(.vertical, showsIndicators: false) {
Rectangle()
.frame(width: 0, height: 15)
.frame(width: 0, height: 10)
//
LazyVStack(alignment: .center, spacing: 10) {
@ -85,9 +85,7 @@ struct IndexMainView: View {
}
})
if self.footerRefreshing {
ProgressView()
}
ProgressView()
}
.frame(width: 370)
.coordinateSpace(name: "indexScrollView")
@ -169,7 +167,6 @@ struct IndexMainView: View {
.onDisappear {
self.cancel?.cancel()
}
}
}

View File

@ -60,6 +60,10 @@ final class IndexModel {
@ObservationIgnored
private var isLoaded = false
// debug
@ObservationIgnored
private var debug: Bool = false
init() {
self.selectedDate = ""
}
@ -103,14 +107,11 @@ final class IndexModel {
if case let .result(groups) = response {
if groups.count > 0 {
print("--------- before ------------")
displayDramaGroups(self.updateDramaGroups)
displayDramaGroups(self.updateDramaGroups, label: "before")
await MainActor.run {
self.updateDramaGroups = preappendMergeDramaGroups(groups: self.updateDramaGroups, mergeGroups: groups)
}
print("--------- after ------------")
displayDramaGroups(self.updateDramaGroups)
print("--------- ------------")
displayDramaGroups(self.updateDramaGroups, label: "after")
}
}
}
@ -119,15 +120,12 @@ final class IndexModel {
let response = await API.loadMoreUpdateDramas(userId: userId, mode: mode, id: lastId, as: [UpdateDramaGroup].self)
if case let .result(groups) = response {
if groups.count > 0 {
print("--------- before ------------")
displayDramaGroups(self.updateDramaGroups)
displayDramaGroups(self.updateDramaGroups, label: "before")
await MainActor.run {
self.updateDramaGroups = appendMergeDramaGroups(groups: self.updateDramaGroups, mergeGroups: groups)
}
print("----------after-----------")
displayDramaGroups(self.updateDramaGroups)
print("---------------------")
displayDramaGroups(self.updateDramaGroups, label: "after")
}
}
}
@ -204,11 +202,18 @@ final class IndexModel {
}
}
private func displayDramaGroups(_ groups: [UpdateDramaGroup]) {
private func displayDramaGroups(_ groups: [UpdateDramaGroup], label: String = "") {
guard debug else {
return
}
print("--------- \(label) ------------")
for group in groups {
let ids = group.items.map { $0.id}
print("group_id: \(group.group_id), items: \(ids)")
}
print("--------- \(label) END ------------")
print(" ")
}
}