fix index view
This commit is contained in:
parent
3051c0253e
commit
046834d9d7
@ -62,7 +62,7 @@ struct IndexMainView: View {
|
|||||||
|
|
||||||
ScrollView(.vertical, showsIndicators: false) {
|
ScrollView(.vertical, showsIndicators: false) {
|
||||||
Rectangle()
|
Rectangle()
|
||||||
.frame(width: 0, height: 15)
|
.frame(width: 0, height: 10)
|
||||||
|
|
||||||
// 基于日期的更新列表
|
// 基于日期的更新列表
|
||||||
LazyVStack(alignment: .center, spacing: 10) {
|
LazyVStack(alignment: .center, spacing: 10) {
|
||||||
@ -85,9 +85,7 @@ struct IndexMainView: View {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
if self.footerRefreshing {
|
ProgressView()
|
||||||
ProgressView()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
.frame(width: 370)
|
.frame(width: 370)
|
||||||
.coordinateSpace(name: "indexScrollView")
|
.coordinateSpace(name: "indexScrollView")
|
||||||
@ -169,7 +167,6 @@ struct IndexMainView: View {
|
|||||||
.onDisappear {
|
.onDisappear {
|
||||||
self.cancel?.cancel()
|
self.cancel?.cancel()
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -60,6 +60,10 @@ final class IndexModel {
|
|||||||
@ObservationIgnored
|
@ObservationIgnored
|
||||||
private var isLoaded = false
|
private var isLoaded = false
|
||||||
|
|
||||||
|
// 是否显示debug信息
|
||||||
|
@ObservationIgnored
|
||||||
|
private var debug: Bool = false
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
self.selectedDate = ""
|
self.selectedDate = ""
|
||||||
}
|
}
|
||||||
@ -103,14 +107,11 @@ final class IndexModel {
|
|||||||
if case let .result(groups) = response {
|
if case let .result(groups) = response {
|
||||||
if groups.count > 0 {
|
if groups.count > 0 {
|
||||||
|
|
||||||
print("--------- before ------------")
|
displayDramaGroups(self.updateDramaGroups, label: "before")
|
||||||
displayDramaGroups(self.updateDramaGroups)
|
|
||||||
await MainActor.run {
|
await MainActor.run {
|
||||||
self.updateDramaGroups = preappendMergeDramaGroups(groups: self.updateDramaGroups, mergeGroups: groups)
|
self.updateDramaGroups = preappendMergeDramaGroups(groups: self.updateDramaGroups, mergeGroups: groups)
|
||||||
}
|
}
|
||||||
print("--------- after ------------")
|
displayDramaGroups(self.updateDramaGroups, label: "after")
|
||||||
displayDramaGroups(self.updateDramaGroups)
|
|
||||||
print("--------- ------------")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -119,15 +120,12 @@ final class IndexModel {
|
|||||||
let response = await API.loadMoreUpdateDramas(userId: userId, mode: mode, id: lastId, as: [UpdateDramaGroup].self)
|
let response = await API.loadMoreUpdateDramas(userId: userId, mode: mode, id: lastId, as: [UpdateDramaGroup].self)
|
||||||
if case let .result(groups) = response {
|
if case let .result(groups) = response {
|
||||||
if groups.count > 0 {
|
if groups.count > 0 {
|
||||||
print("--------- before ------------")
|
displayDramaGroups(self.updateDramaGroups, label: "before")
|
||||||
displayDramaGroups(self.updateDramaGroups)
|
|
||||||
await MainActor.run {
|
await MainActor.run {
|
||||||
self.updateDramaGroups = appendMergeDramaGroups(groups: self.updateDramaGroups, mergeGroups: groups)
|
self.updateDramaGroups = appendMergeDramaGroups(groups: self.updateDramaGroups, mergeGroups: groups)
|
||||||
}
|
}
|
||||||
|
|
||||||
print("----------after-----------")
|
displayDramaGroups(self.updateDramaGroups, label: "after")
|
||||||
displayDramaGroups(self.updateDramaGroups)
|
|
||||||
print("---------------------")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -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 {
|
for group in groups {
|
||||||
let ids = group.items.map { $0.id}
|
let ids = group.items.map { $0.id}
|
||||||
print("group_id: \(group.group_id), items: \(ids)")
|
print("group_id: \(group.group_id), items: \(ids)")
|
||||||
}
|
}
|
||||||
|
print("--------- \(label) END ------------")
|
||||||
|
print(" ")
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user