diff --git a/BCC Media tvOS/BCC Media tvOS.xcodeproj/project.pbxproj b/BCC Media tvOS/BCC Media tvOS.xcodeproj/project.pbxproj index 5aa0e37..74f4e9c 100644 --- a/BCC Media tvOS/BCC Media tvOS.xcodeproj/project.pbxproj +++ b/BCC Media tvOS/BCC Media tvOS.xcodeproj/project.pbxproj @@ -40,7 +40,6 @@ 09055A2C2B57FC540019FB9A /* EpisodeViewer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 090559FF2B57FC540019FB9A /* EpisodeViewer.swift */; }; 09055A2D2B57FC540019FB9A /* CalendarDay.swift in Sources */ = {isa = PBXBuildFile; fileRef = 09055A002B57FC540019FB9A /* CalendarDay.swift */; }; 09055A2E2B57FC540019FB9A /* LockView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 09055A012B57FC540019FB9A /* LockView.swift */; }; - 09055A2F2B57FC540019FB9A /* LivePlayer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 09055A032B57FC540019FB9A /* LivePlayer.swift */; }; 09055A312B57FC540019FB9A /* PlayerListener.swift in Sources */ = {isa = PBXBuildFile; fileRef = 09055A062B57FC540019FB9A /* PlayerListener.swift */; }; 09055A332B57FC540019FB9A /* PlayerOptions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 09055A082B57FC540019FB9A /* PlayerOptions.swift */; }; 09055A342B57FC540019FB9A /* PlayerExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 09055A092B57FC540019FB9A /* PlayerExtensions.swift */; }; @@ -48,7 +47,6 @@ 09055A362B57FC540019FB9A /* FrontPage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 09055A0C2B57FC540019FB9A /* FrontPage.swift */; }; 09055A372B57FC540019FB9A /* Settings.swift in Sources */ = {isa = PBXBuildFile; fileRef = 09055A0D2B57FC540019FB9A /* Settings.swift */; }; 09055A382B57FC540019FB9A /* SignIn.swift in Sources */ = {isa = PBXBuildFile; fileRef = 09055A0E2B57FC540019FB9A /* SignIn.swift */; }; - 09055A392B57FC540019FB9A /* Live.swift in Sources */ = {isa = PBXBuildFile; fileRef = 09055A0F2B57FC540019FB9A /* Live.swift */; }; 09055A3A2B57FC540019FB9A /* Search.swift in Sources */ = {isa = PBXBuildFile; fileRef = 09055A102B57FC540019FB9A /* Search.swift */; }; 09055A3C2B57FD450019FB9A /* Utils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 09055A3B2B57FD450019FB9A /* Utils.swift */; }; 09055A4F2B57FF550019FB9A /* AppOptions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 09055A482B57FF550019FB9A /* AppOptions.swift */; }; @@ -132,7 +130,6 @@ 090559FF2B57FC540019FB9A /* EpisodeViewer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EpisodeViewer.swift; sourceTree = ""; }; 09055A002B57FC540019FB9A /* CalendarDay.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CalendarDay.swift; sourceTree = ""; }; 09055A012B57FC540019FB9A /* LockView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LockView.swift; sourceTree = ""; }; - 09055A032B57FC540019FB9A /* LivePlayer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LivePlayer.swift; sourceTree = ""; }; 09055A062B57FC540019FB9A /* PlayerListener.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PlayerListener.swift; sourceTree = ""; }; 09055A082B57FC540019FB9A /* PlayerOptions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PlayerOptions.swift; sourceTree = ""; }; 09055A092B57FC540019FB9A /* PlayerExtensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PlayerExtensions.swift; sourceTree = ""; }; @@ -140,7 +137,6 @@ 09055A0C2B57FC540019FB9A /* FrontPage.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FrontPage.swift; sourceTree = ""; }; 09055A0D2B57FC540019FB9A /* Settings.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Settings.swift; sourceTree = ""; }; 09055A0E2B57FC540019FB9A /* SignIn.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SignIn.swift; sourceTree = ""; }; - 09055A0F2B57FC540019FB9A /* Live.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Live.swift; sourceTree = ""; }; 09055A102B57FC540019FB9A /* Search.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Search.swift; sourceTree = ""; }; 09055A3B2B57FD450019FB9A /* Utils.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Utils.swift; sourceTree = ""; }; 09055A482B57FF550019FB9A /* AppOptions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppOptions.swift; sourceTree = ""; }; @@ -261,7 +257,6 @@ 090559EC2B57FC540019FB9A /* Sections */, 090559FD2B57FC540019FB9A /* Episodes */, 090559F92B57FC540019FB9A /* Page */, - 09055A022B57FC540019FB9A /* Live */, 09055A042B57FC540019FB9A /* Player */, 090559FC2B57FC540019FB9A /* ItemImage.swift */, 09055A002B57FC540019FB9A /* CalendarDay.swift */, @@ -307,14 +302,6 @@ path = Episodes; sourceTree = ""; }; - 09055A022B57FC540019FB9A /* Live */ = { - isa = PBXGroup; - children = ( - 09055A032B57FC540019FB9A /* LivePlayer.swift */, - ); - path = Live; - sourceTree = ""; - }; 09055A042B57FC540019FB9A /* Player */ = { isa = PBXGroup; children = ( @@ -333,7 +320,6 @@ 09055A0C2B57FC540019FB9A /* FrontPage.swift */, 09055A0D2B57FC540019FB9A /* Settings.swift */, 09055A0E2B57FC540019FB9A /* SignIn.swift */, - 09055A0F2B57FC540019FB9A /* Live.swift */, 09055A102B57FC540019FB9A /* Search.swift */, ); path = Views; @@ -470,11 +456,11 @@ mainGroup = 090559902B57F22F0019FB9A; packageReferences = ( 090559B02B57FB560019FB9A /* XCRemoteSwiftPackageReference "apollo-ios" */, - 090559BD2B57FB600019FB9A /* XCRemoteSwiftPackageReference "Auth0.swift" */, + 090559BD2B57FB600019FB9A /* XCRemoteSwiftPackageReference "Auth0" */, 09055A5E2B5807920019FB9A /* XCRemoteSwiftPackageReference "plugin-ios" */, - 09055A702B594E6B0019FB9A /* XCLocalSwiftPackageReference "API" */, - 09055A732B594E740019FB9A /* XCLocalSwiftPackageReference "Authentication" */, - 09055A762B594E7F0019FB9A /* XCLocalSwiftPackageReference "FeatureFlags" */, + 09055A702B594E6B0019FB9A /* XCLocalSwiftPackageReference "../API" */, + 09055A732B594E740019FB9A /* XCLocalSwiftPackageReference "../Authentication" */, + 09055A762B594E7F0019FB9A /* XCLocalSwiftPackageReference "../FeatureFlags" */, 09DDD6C52B6BB05000E56631 /* XCRemoteSwiftPackageReference "rudder-sdk-ios" */, 817A8CE72C05BCA300E48E23 /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */, 81480B342C3C0CCE0023D5B2 /* XCRemoteSwiftPackageReference "plugin-ios" */, @@ -554,8 +540,6 @@ 09055A362B57FC540019FB9A /* FrontPage.swift in Sources */, 09055A252B57FC540019FB9A /* PosterGridSection.swift in Sources */, 09055A222B57FC540019FB9A /* SectionItem.swift in Sources */, - 09055A392B57FC540019FB9A /* Live.swift in Sources */, - 09055A2F2B57FC540019FB9A /* LivePlayer.swift in Sources */, 09055A382B57FC540019FB9A /* SignIn.swift in Sources */, 0905599D2B57F22F0019FB9A /* BCC_Media_tvOSApp.swift in Sources */, 09055A232B57FC540019FB9A /* ProgressBar.swift in Sources */, @@ -890,15 +874,15 @@ /* End XCConfigurationList section */ /* Begin XCLocalSwiftPackageReference section */ - 09055A702B594E6B0019FB9A /* XCLocalSwiftPackageReference "API" */ = { + 09055A702B594E6B0019FB9A /* XCLocalSwiftPackageReference "../API" */ = { isa = XCLocalSwiftPackageReference; relativePath = ../API; }; - 09055A732B594E740019FB9A /* XCLocalSwiftPackageReference "Authentication" */ = { + 09055A732B594E740019FB9A /* XCLocalSwiftPackageReference "../Authentication" */ = { isa = XCLocalSwiftPackageReference; relativePath = ../Authentication; }; - 09055A762B594E7F0019FB9A /* XCLocalSwiftPackageReference "FeatureFlags" */ = { + 09055A762B594E7F0019FB9A /* XCLocalSwiftPackageReference "../FeatureFlags" */ = { isa = XCLocalSwiftPackageReference; relativePath = ../FeatureFlags; }; @@ -913,7 +897,7 @@ minimumVersion = 1.8.0; }; }; - 090559BD2B57FB600019FB9A /* XCRemoteSwiftPackageReference "Auth0.swift" */ = { + 090559BD2B57FB600019FB9A /* XCRemoteSwiftPackageReference "Auth0" */ = { isa = XCRemoteSwiftPackageReference; repositoryURL = "https://github.com/auth0/Auth0.swift"; requirement = { @@ -975,7 +959,7 @@ }; 090559BE2B57FB600019FB9A /* Auth0 */ = { isa = XCSwiftPackageProductDependency; - package = 090559BD2B57FB600019FB9A /* XCRemoteSwiftPackageReference "Auth0.swift" */; + package = 090559BD2B57FB600019FB9A /* XCRemoteSwiftPackageReference "Auth0" */; productName = Auth0; }; 09055A5F2B5807920019FB9A /* NpawPlugin */ = { diff --git a/BCC Media tvOS/Components/Episodes/EpisodePlayer.swift b/BCC Media tvOS/Components/Episodes/EpisodePlayer.swift index 0a244bd..0d68aee 100644 --- a/BCC Media tvOS/Components/Episodes/EpisodePlayer.swift +++ b/BCC Media tvOS/Components/Episodes/EpisodePlayer.swift @@ -66,7 +66,6 @@ struct EpisodePlayer: View { startFrom: progress ? q.episode.progress ?? 0 : 0, audioLanguage: AppOptions.audioLanguage, subtitleLanguage: AppOptions.subtitleLanguage, - isLive: false, content: .init( title: episode.originalTitle, id: episode.id, diff --git a/BCC Media tvOS/Components/Live/LivePlayer.swift b/BCC Media tvOS/Components/Live/LivePlayer.swift deleted file mode 100644 index 2fb5e4e..0000000 --- a/BCC Media tvOS/Components/Live/LivePlayer.swift +++ /dev/null @@ -1,66 +0,0 @@ -// -// LivePlayer.swift -// BCC Media -// -// Created by Fredrik Vedvik on 29/06/2023. -// - -import SwiftUI - -struct LiveResponse: Codable { - var url: String - - enum CodingKeys: String, CodingKey { - case url - } -} - -struct LivePlayer: View { - @Environment(\.dismiss) var dismiss - - @State var loaded = false - - @State var url: URL? - - @State var playerListener: PlayerListener = PlayerListener() - - func load() { - Task { - playerListener = PlayerListener(expireCallback: { - dismiss() - }) - let token = await authenticationProvider.getAccessToken() - if token != nil { - var req = URLRequest(url: URL(string: "https://livestreamfunctions.brunstad.tv/api/urls/live")!) - req.setValue("Bearer " + token!, forHTTPHeaderField: "Authorization") - - let (data, _) = try await URLSession.shared.data(for: req) - let resp = try JSONDecoder().decode(LiveResponse.self, from: data) - url = URL(string: resp.url)! - - PlayerControls.setItem(url!, .init(title: "Live", audioLanguage: AppOptions.audioLanguage, subtitleLanguage: AppOptions.subtitleLanguage, isLive: true, content: .init(id: "livestream")), playerListener) - } - loaded = true - } - } - - var body: some View { - VStack { - if loaded { - VideoPlayerView(fullscreen: .constant(true)) - } else { - ProgressView() - } - }.onAppear { - load() - }.ignoresSafeArea() - } -} - -extension LivePlayer: Hashable { - static func == (_: LivePlayer, _: LivePlayer) -> Bool { - true - } - - func hash(into _: inout Hasher) {} -} diff --git a/BCC Media tvOS/Components/Player/PlayerOptions.swift b/BCC Media tvOS/Components/Player/PlayerOptions.swift index 8db0096..33c24d2 100644 --- a/BCC Media tvOS/Components/Player/PlayerOptions.swift +++ b/BCC Media tvOS/Components/Player/PlayerOptions.swift @@ -13,8 +13,6 @@ struct PlayerOptions { var audioLanguage: String? var subtitleLanguage: String? - var isLive: Bool - var content: Content struct Content { var title: String? @@ -30,7 +28,6 @@ struct PlayerOptions { startFrom: Int = 0, audioLanguage: String? = nil, subtitleLanguage: String? = nil, - isLive: Bool = false, content: Content = .init() ) { self.title = title @@ -39,8 +36,6 @@ struct PlayerOptions { self.subtitleLanguage = subtitleLanguage ?? AppOptions.standard.subtitleLanguage self.audioLanguage = audioLanguage ?? AppOptions.standard.audioLanguage - self.isLive = isLive - self.content = content } } diff --git a/BCC Media tvOS/Components/Player/VideoPlayerView.swift b/BCC Media tvOS/Components/Player/VideoPlayerView.swift index be269a0..4063dcd 100644 --- a/BCC Media tvOS/Components/Player/VideoPlayerView.swift +++ b/BCC Media tvOS/Components/Player/VideoPlayerView.swift @@ -86,7 +86,6 @@ class PlayerControls: ObservableObject { let c = options.content videoOptions.contentId = c.id - videoOptions.live = options.isLive as NSNumber videoOptions.contentTitle = c.title videoOptions.contentTvShow = c.showId videoOptions.contentSeason = c.seasonId diff --git a/BCC Media tvOS/ContentView.swift b/BCC Media tvOS/ContentView.swift index 251245f..f773922 100644 --- a/BCC Media tvOS/ContentView.swift +++ b/BCC Media tvOS/ContentView.swift @@ -24,14 +24,12 @@ var cardActiveBackgroundColor: Color { } enum StaticDestination: Hashable { - case live case aboutUs case signIn } enum TabType: Hashable { case pages - case live case search case settings } @@ -39,15 +37,7 @@ enum TabType: Hashable { typealias PlayCallback = (Bool, API.GetEpisodeQuery.Data.Episode) async -> Void class Flags: ObservableObject { - @Published var removeLiveTab = true - @Published var forceBccLive = true - @Published var linkToBccLive = true - - func load() { - removeLiveTab = FeatureFlags.has("remove-live-tab") - forceBccLive = FeatureFlags.has("force-bcc-live") - linkToBccLive = FeatureFlags.has("link-to-bcc-live") - } + func load() {} } struct ContentView: View { @@ -305,13 +295,6 @@ struct ContentView: View { .tabItem { Label("tab_home", systemImage: "house.fill").font(.barlow) }.tag(TabType.pages) - if !flags.removeLiveTab && authenticated && bccMember { - LiveView { - path.append(StaticDestination.live) - }.tabItem { - Label("tab_live", systemImage: "video").font(.barlow) - }.tag(TabType.live) - } SearchView( queryString: $searchQuery, clickItem: clickItem, @@ -379,8 +362,6 @@ struct ContentView: View { } .navigationDestination(for: StaticDestination.self) { dest in switch dest { - case .live: - LivePlayer() case .aboutUs: AboutUsView() default: diff --git a/BCC Media tvOS/Utils/Events.swift b/BCC Media tvOS/Utils/Events.swift index 1967e49..61481cb 100644 --- a/BCC Media tvOS/Utils/Events.swift +++ b/BCC Media tvOS/Utils/Events.swift @@ -81,7 +81,6 @@ struct ApplicationOpened: Event { class VideoEvent { var sessionId: String - var livestream: Bool var contentPodId: String var position: Int? var totalLength: Int @@ -89,9 +88,8 @@ class VideoEvent { var fullScreen = true var hasVideo = true - init(sessionId: String, livestream: Bool, contentPodId: String, position: Int? = nil, totalLength: Int, videoPlayer: String = "AVPlayer", fullScreen: Bool = true, hasVideo: Bool = true) { + init(sessionId: String, contentPodId: String, position: Int? = nil, totalLength: Int, videoPlayer: String = "AVPlayer", fullScreen: Bool = true, hasVideo: Bool = true) { self.sessionId = sessionId - self.livestream = livestream self.contentPodId = contentPodId self.position = position self.totalLength = totalLength diff --git a/BCC Media tvOS/Views/Live.swift b/BCC Media tvOS/Views/Live.swift deleted file mode 100644 index c16e340..0000000 --- a/BCC Media tvOS/Views/Live.swift +++ /dev/null @@ -1,77 +0,0 @@ -// -// Created by Fredrik Vedvik on 16/03/2023. -// - -import AVKit -import Foundation -import SwiftUI -import FeatureFlags - -struct LiveView: View { - @EnvironmentObject var flags: Flags - - var play: () -> Void - - init(_ play: @escaping () -> Void) { - self.play = play - } - - private var columns = [GridItem(.flexible()), GridItem(.flexible())] - - @FocusState var isFocused - - @FocusState var newAppFocused - - var body: some View { - VStack(alignment: .leading) { - if !flags.forceBccLive { - HStack(alignment: .top) { - Button { - play() - } label: { - Image(uiImage: UIImage(named: "Live.png")!).frame(width: 1280/2, height: 720/2) - } - .buttonStyle(SectionItemButton(focused: isFocused)) - .focused($isFocused) - .accessibilityLabel(Text("common_live")) - VStack { - Text("common_live").font(.barlowTitle).bold() - } - Spacer() - } - } - if flags.linkToBccLive { - Text("new_live_app").font(.barlowTitle) - Text("go_to_bcc_live_app").font(.barlow) - Button { - let url = URL(string: "https://itunes.apple.com/app/id6476551025") - - UIApplication.shared.open(url!) - } label: { - Image(uiImage: UIImage(named: "tvos_icon_large.png")!).resizable() - } - .buttonStyle(SectionItemButton(focused: newAppFocused)) - .focused($newAppFocused) - .accessibilityLabel(Text("new_live_app")).frame(width: 1280/2, height: 720/2) - } else { - CalendarDay() - } - }.frame(width: 1280) - .onAppear { - Events.page("live") - } - } -} - -func getFlags() -> Flags { - let flags = Flags(); -// flags.forceBccLive = true; - flags.linkToBccLive = true; - return flags -} - -struct LiveView_Previews: PreviewProvider { - static var previews: some View { - LiveView {}.environmentObject(getFlags()) - } -}