mirror of
https://github.com/jellyfin/Swiftfin.git
synced 2024-12-14 01:18:44 +00:00
pagination bug
This commit is contained in:
parent
ae9381e5a3
commit
04936e75af
@ -71,12 +71,13 @@ struct LibraryView: View {
|
||||
Button {
|
||||
viewModel.requestPreviousPage()
|
||||
} label: {
|
||||
Image(systemName: "chevron.left")
|
||||
Image(systemName: "chevron.left").font(.system(size: 25))
|
||||
}.disabled(viewModel.isHiddenPreviousButton)
|
||||
Spacer()
|
||||
Button {
|
||||
viewModel.requestNextPage()
|
||||
} label: {
|
||||
Image(systemName: "chevron.right")
|
||||
Image(systemName: "chevron.right").font(.system(size: 25))
|
||||
}.disabled(viewModel.isHiddenNextButton)
|
||||
Spacer()
|
||||
}
|
||||
|
@ -121,17 +121,28 @@ final class LibraryViewModel: ObservableObject {
|
||||
self.isLoading = false
|
||||
}, receiveValue: { [weak self] items, count in
|
||||
guard let self = self else { return }
|
||||
if count > 100 {
|
||||
if self.page > 1 {
|
||||
print(count)
|
||||
print(items.count)
|
||||
print(self.page)
|
||||
|
||||
if(count > 100) {
|
||||
self.isHiddenPreviousButton = true
|
||||
self.isHiddenNextButton = true
|
||||
|
||||
if(self.page > 1) {
|
||||
self.isHiddenPreviousButton = false
|
||||
}
|
||||
if count > (self.page * 100) {
|
||||
|
||||
if(self.page * 100 < count) {
|
||||
self.isHiddenNextButton = false
|
||||
}
|
||||
} else {
|
||||
self.isHiddenNextButton = true
|
||||
self.isHiddenPreviousButton = true
|
||||
self.isHiddenNextButton = true
|
||||
}
|
||||
|
||||
print(self.isHiddenPreviousButton)
|
||||
print(self.isHiddenNextButton)
|
||||
|
||||
self.items = items
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user