Merge pull request #405 from LePips/fix-season-sorting

This commit is contained in:
Ethan Pippin 2022-03-29 20:45:32 -06:00 committed by GitHub
commit 489fa130eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 32 additions and 27 deletions

View File

@ -21,6 +21,10 @@ protocol EpisodesRowManager: ViewModel {
extension EpisodesRowManager { extension EpisodesRowManager {
var sortedSeasons: [BaseItemDto] {
Array(seasonsEpisodes.keys).sorted(by: { $0.indexNumber ?? 0 < $1.indexNumber ?? 0 })
}
// Also retrieves the current season episodes if available // Also retrieves the current season episodes if available
func retrieveSeasons() { func retrieveSeasons() {
TvShowsAPI.getSeasons(seriesId: item.seriesId ?? "", TvShowsAPI.getSeasons(seriesId: item.seriesId ?? "",

View File

@ -120,7 +120,7 @@ struct LiveTVChannelItemElement: View {
.stroke(isFocused ? Color.blue : Color.clear, lineWidth: 4)) .stroke(isFocused ? Color.blue : Color.clear, lineWidth: 4))
.cornerRadius(20) .cornerRadius(20)
.scaleEffect(isFocused ? 1.1 : 1) .scaleEffect(isFocused ? 1.1 : 1)
.focusable(true) // .focusable(true)
.focused($focused) .focused($focused)
.onChange(of: focused) { foc in .onChange(of: focused) { foc in
withAnimation(.linear(duration: 0.15)) { withAnimation(.linear(duration: 0.15)) {

View File

@ -38,31 +38,6 @@ struct LibraryListView: View {
self.mainCoordinator.root(\.liveTV) self.mainCoordinator.root(\.liveTV)
} }
label: { label: {
ZStack {
HStack {
Spacer()
VStack {
Text(library.name ?? "")
.foregroundColor(.white)
.font(.title2)
.fontWeight(.semibold)
}
Spacer()
}.padding(32)
}
.frame(minWidth: 100, maxWidth: .infinity)
.frame(height: 100)
}
.cornerRadius(10)
.shadow(radius: 5)
.padding(.bottom, 5)
}
} else {
Button {
self.libraryListRouter.route(to: \.library,
(viewModel: LibraryViewModel(parentID: library.id), title: library.name ?? ""))
}
label: {
ZStack { ZStack {
HStack { HStack {
Spacer() Spacer()
@ -81,6 +56,31 @@ struct LibraryListView: View {
.cornerRadius(10) .cornerRadius(10)
.shadow(radius: 5) .shadow(radius: 5)
.padding(.bottom, 5) .padding(.bottom, 5)
}
} else {
Button {
self.libraryListRouter.route(to: \.library,
(viewModel: LibraryViewModel(parentID: library.id), title: library.name ?? ""))
}
label: {
ZStack {
HStack {
Spacer()
VStack {
Text(library.name ?? "")
.foregroundColor(.white)
.font(.title2)
.fontWeight(.semibold)
}
Spacer()
}.padding(32)
}
.frame(minWidth: 100, maxWidth: .infinity)
.frame(height: 100)
}
.cornerRadius(10)
.shadow(radius: 5)
.padding(.bottom, 5)
} }
} }
} else { } else {

View File

@ -29,7 +29,8 @@ struct EpisodesRowView<RowManager>: View where RowManager: EpisodesRowManager {
} }
} else { } else {
Menu { Menu {
ForEach(Array(viewModel.seasonsEpisodes.keys).sorted(by: { $0.name ?? "" < $1.name ?? "" }), id: \.self) { season in ForEach(viewModel.sortedSeasons,
id: \.self) { season in
Button { Button {
viewModel.select(season: season) viewModel.select(season: season)
} label: { } label: {