Merge pull request #405 from LePips/fix-season-sorting
This commit is contained in:
commit
489fa130eb
|
@ -21,6 +21,10 @@ protocol EpisodesRowManager: ViewModel {
|
|||
|
||||
extension EpisodesRowManager {
|
||||
|
||||
var sortedSeasons: [BaseItemDto] {
|
||||
Array(seasonsEpisodes.keys).sorted(by: { $0.indexNumber ?? 0 < $1.indexNumber ?? 0 })
|
||||
}
|
||||
|
||||
// Also retrieves the current season episodes if available
|
||||
func retrieveSeasons() {
|
||||
TvShowsAPI.getSeasons(seriesId: item.seriesId ?? "",
|
||||
|
|
|
@ -120,7 +120,7 @@ struct LiveTVChannelItemElement: View {
|
|||
.stroke(isFocused ? Color.blue : Color.clear, lineWidth: 4))
|
||||
.cornerRadius(20)
|
||||
.scaleEffect(isFocused ? 1.1 : 1)
|
||||
.focusable(true)
|
||||
// .focusable(true)
|
||||
.focused($focused)
|
||||
.onChange(of: focused) { foc in
|
||||
withAnimation(.linear(duration: 0.15)) {
|
||||
|
|
|
@ -38,31 +38,6 @@ struct LibraryListView: View {
|
|||
self.mainCoordinator.root(\.liveTV)
|
||||
}
|
||||
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 {
|
||||
HStack {
|
||||
Spacer()
|
||||
|
@ -81,6 +56,31 @@ struct LibraryListView: View {
|
|||
.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 {
|
||||
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 {
|
||||
|
|
|
@ -29,7 +29,8 @@ struct EpisodesRowView<RowManager>: View where RowManager: EpisodesRowManager {
|
|||
}
|
||||
} else {
|
||||
Menu {
|
||||
ForEach(Array(viewModel.seasonsEpisodes.keys).sorted(by: { $0.name ?? "" < $1.name ?? "" }), id: \.self) { season in
|
||||
ForEach(viewModel.sortedSeasons,
|
||||
id: \.self) { season in
|
||||
Button {
|
||||
viewModel.select(season: season)
|
||||
} label: {
|
||||
|
|
Loading…
Reference in New Issue