route to video player from liveTv
This commit is contained in:
parent
4e8a419dbc
commit
bcc81213ad
|
|
@ -25,9 +25,9 @@ final class LiveTVChannelsCoordinator: NavigationCoordinatable {
|
||||||
NavigationViewCoordinator(ItemCoordinator(item: item))
|
NavigationViewCoordinator(ItemCoordinator(item: item))
|
||||||
}
|
}
|
||||||
|
|
||||||
func makeVideoPlayer(item: BaseItemDto) -> NavigationViewCoordinator<EmptyViewCoordinator> {
|
func makeVideoPlayer(viewModel: VideoPlayerViewModel) -> NavigationViewCoordinator<VideoPlayerCoordinator> {
|
||||||
// NavigationViewCoordinator(VideoPlayerCoordinator(item: item))
|
NavigationViewCoordinator(VideoPlayerCoordinator(viewModel: viewModel))
|
||||||
NavigationViewCoordinator(EmptyViewCoordinator())
|
// NavigationViewCoordinator(EmptyViewCoordinator())
|
||||||
}
|
}
|
||||||
|
|
||||||
@ViewBuilder
|
@ViewBuilder
|
||||||
|
|
|
||||||
|
|
@ -189,6 +189,16 @@ final class LiveTVChannelsViewModel: ViewModel {
|
||||||
func stopScheduleCheckTimer() {
|
func stopScheduleCheckTimer() {
|
||||||
timer?.invalidate()
|
timer?.invalidate()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func fetchVideoPlayerViewModel(item: BaseItemDto, completion: @escaping (VideoPlayerViewModel)->Void) {
|
||||||
|
item.createVideoPlayerViewModel()
|
||||||
|
.sink { completion in
|
||||||
|
self.handleAPIRequestError(completion: completion)
|
||||||
|
} receiveValue: { videoPlayerViewModel in
|
||||||
|
completion(videoPlayerViewModel)
|
||||||
|
}
|
||||||
|
.store(in: &self.cancellables)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extension Array {
|
extension Array {
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,9 @@ struct LiveTVChannelsView: View {
|
||||||
let channel = item.channel
|
let channel = item.channel
|
||||||
if channel.type != "Folder" {
|
if channel.type != "Folder" {
|
||||||
Button {
|
Button {
|
||||||
self.router.route(to: \.videoPlayer, channel)
|
self.viewModel.fetchVideoPlayerViewModel(item: channel) { playerViewModel in
|
||||||
|
self.router.route(to: \.videoPlayer, playerViewModel)
|
||||||
|
}
|
||||||
} label: {
|
} label: {
|
||||||
LiveTVChannelItemElement(channel: channel,
|
LiveTVChannelItemElement(channel: channel,
|
||||||
program: item.program,
|
program: item.program,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue