Support folder-type libraries on tvOS

And fixed a bug in LibraryListView where proper parent ID was not passed
to LibraryViewModel.
This commit is contained in:
Min-Yih Hsu 2022-01-26 22:59:20 +08:00
parent 3f52223be5
commit 87331444be
3 changed files with 12 additions and 13 deletions

View File

@ -62,7 +62,7 @@ struct ItemView: View {
} else {
SeriesItemView(viewModel: SeriesItemViewModel(item: item))
}
case .boxset:
case .boxset, .folder:
CinematicCollectionItemView(viewModel: CollectionItemViewModel(item: item))
default:
Text(L10n.notImplementedYetWithType(item.type ?? ""))

View File

@ -81,7 +81,8 @@ struct LibraryListView: View {
}
} else {
Button {
self.libraryListRouter.route(to: \.library, (viewModel: LibraryViewModel(), title: library.name ?? ""))
self.libraryListRouter.route(to: \.library,
(viewModel: LibraryViewModel(parentID: library.id), title: library.name ?? ""))
}
label: {
ZStack {

View File

@ -56,17 +56,15 @@ struct LibraryView: View {
} cell: { _, cell in
GeometryReader { _ in
if let item = cell.item {
if item.type != "Folder" {
Button {
libraryRouter.route(to: \.modalItem, item)
} label: {
PortraitItemElement(item: item)
}
.buttonStyle(PlainNavigationLinkButtonStyle())
.onAppear {
if item == viewModel.items.last && viewModel.hasNextPage {
viewModel.requestNextPageAsync()
}
Button {
libraryRouter.route(to: \.modalItem, item)
} label: {
PortraitItemElement(item: item)
}
.buttonStyle(PlainNavigationLinkButtonStyle())
.onAppear {
if item == viewModel.items.last && viewModel.hasNextPage {
viewModel.requestNextPageAsync()
}
}
} else if cell.loadingCell {