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 {
|
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 ?? "",
|
||||||
|
|
|
@ -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)) {
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
|
@ -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: {
|
||||||
|
|
Loading…
Reference in New Issue