From 9a075602f6fceabc587f063a3cb1bfda8e7d7bb4 Mon Sep 17 00:00:00 2001 From: Ethan Pippin Date: Sun, 11 Sep 2022 08:58:39 -0600 Subject: [PATCH] Update LiveTVChannelsView.swift (#569) --- Swiftfin/Views/LiveTVChannelsView.swift | 50 ++++++++++++------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/Swiftfin/Views/LiveTVChannelsView.swift b/Swiftfin/Views/LiveTVChannelsView.swift index 89f70799..c6d25fcc 100644 --- a/Swiftfin/Views/LiveTVChannelsView.swift +++ b/Swiftfin/Views/LiveTVChannelsView.swift @@ -6,10 +6,10 @@ // Copyright (c) 2022 Jellyfin & Jellyfin Contributors // +import CollectionView import Foundation import JellyfinAPI import SwiftUI -import SwiftUICollection typealias LiveTVChannelViewProgram = (timeDisplay: String, title: String) @@ -36,30 +36,30 @@ struct LiveTVChannelsView: View { if viewModel.isLoading == true { ProgressView() } else if !viewModel.channelPrograms.isEmpty { - Text("nothing") -// ASCollectionView(data: viewModel.channelPrograms, dataID: \.self) { channelProgram, _ in -// makeCellView(channelProgram) -// } -// .layout { -// .grid( -// layoutMode: .fixedNumberOfColumns(columns), -// itemSpacing: 16, -// lineSpacing: 4, -// itemSize: .absolute(144) -// ) -// } -// .frame(maxWidth: .infinity, maxHeight: .infinity) -// .ignoresSafeArea() -// .onAppear { -// viewModel.startScheduleCheckTimer() -// self.checkOrientation() -// } -// .onDisappear { -// viewModel.stopScheduleCheckTimer() -// } -// .onReceive(NotificationCenter.default.publisher(for: UIDevice.orientationDidChangeNotification)) { _ in -// self.checkOrientation() -// } + CollectionView(items: viewModel.channelPrograms) { _, program, _ in + makeCellView(program) + } + .layout { _, layoutEnvironment in + .grid( + layoutEnvironment: layoutEnvironment, + layoutMode: .adaptive(withMinItemSize: 144), + itemSpacing: 16, + lineSpacing: 4, + itemSize: .absolute(144) + ) + } + .frame(maxWidth: .infinity, maxHeight: .infinity) + .ignoresSafeArea() + .onAppear { + viewModel.startScheduleCheckTimer() + self.checkOrientation() + } + .onDisappear { + viewModel.stopScheduleCheckTimer() + } + .onReceive(NotificationCenter.default.publisher(for: UIDevice.orientationDidChangeNotification)) { _ in + self.checkOrientation() + } } else { VStack { Text("No results.")