[tvOS][Bug] Fixes season selector only showing a single season. (#950)
This commit is contained in:
parent
552260e25e
commit
e72c5160c3
|
@ -117,7 +117,7 @@ final class SeriesItemViewModel: ItemViewModel, MenuPosterHStackModel {
|
||||||
func select(section: BaseItemDto) {
|
func select(section: BaseItemDto) {
|
||||||
self.menuSelection = section
|
self.menuSelection = section
|
||||||
|
|
||||||
if !menuSections.keys.contains(section) {
|
if let episodes = menuSections[section], episodes.isEmpty {
|
||||||
getEpisodesForSeason(section)
|
getEpisodesForSeason(section)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -132,7 +132,11 @@ final class SeriesItemViewModel: ItemViewModel, MenuPosterHStackModel {
|
||||||
let response = try await userSession.client.send(request)
|
let response = try await userSession.client.send(request)
|
||||||
|
|
||||||
guard let seasons = response.value.items else { return }
|
guard let seasons = response.value.items else { return }
|
||||||
|
await MainActor.run {
|
||||||
|
for season in seasons {
|
||||||
|
self.menuSections[season] = []
|
||||||
|
}
|
||||||
|
}
|
||||||
if let firstSeason = seasons.first {
|
if let firstSeason = seasons.first {
|
||||||
self.getEpisodesForSeason(firstSeason)
|
self.getEpisodesForSeason(firstSeason)
|
||||||
await MainActor.run {
|
await MainActor.run {
|
||||||
|
|
|
@ -159,7 +159,6 @@ extension SeriesEpisodeSelector {
|
||||||
}
|
}
|
||||||
.onChange(of: viewModel.menuSelection) { _ in
|
.onChange(of: viewModel.menuSelection) { _ in
|
||||||
lastFocusedEpisodeID = items.first?.id
|
lastFocusedEpisodeID = items.first?.id
|
||||||
wrappedScrollView?.scrollToTop(animated: false)
|
|
||||||
}
|
}
|
||||||
.onChange(of: focusedEpisodeID) { episodeIndex in
|
.onChange(of: focusedEpisodeID) { episodeIndex in
|
||||||
guard let episodeIndex = episodeIndex else { return }
|
guard let episodeIndex = episodeIndex else { return }
|
||||||
|
|
Loading…
Reference in New Issue