diff --git a/Demo/Sources/Players/InlinePlayer/InlinePlayerViewModel.swift b/Demo/Sources/Players/InlinePlayer/InlinePlayerViewModel.swift index c97c13b7a..ff859d125 100644 --- a/Demo/Sources/Players/InlinePlayer/InlinePlayerViewModel.swift +++ b/Demo/Sources/Players/InlinePlayer/InlinePlayerViewModel.swift @@ -28,4 +28,12 @@ final class InlinePlayerViewModel: ObservableObject { } } -extension InlinePlayerViewModel: PictureInPicturePersistable {} +extension InlinePlayerViewModel: PictureInPicturePersistable { + func pictureInPictureWillStart() {} + + func pictureInPictureDidStart() {} + + func pictureInPictureWillStop() {} + + func pictureInPictureDidStop() {} +} diff --git a/Demo/Sources/Players/Player/PlayerViewModel.swift b/Demo/Sources/Players/Player/PlayerViewModel.swift index 01c2ea28d..208951953 100644 --- a/Demo/Sources/Players/Player/PlayerViewModel.swift +++ b/Demo/Sources/Players/Player/PlayerViewModel.swift @@ -28,4 +28,12 @@ final class PlayerViewModel: ObservableObject { } } -extension PlayerViewModel: PictureInPicturePersistable {} +extension PlayerViewModel: PictureInPicturePersistable { + func pictureInPictureWillStart() {} + + func pictureInPictureDidStart() {} + + func pictureInPictureWillStop() {} + + func pictureInPictureDidStop() {} +} diff --git a/Demo/Sources/Players/SystemPlayer/SystemPlayerViewModel.swift b/Demo/Sources/Players/SystemPlayer/SystemPlayerViewModel.swift index d0e36af27..60161bb21 100644 --- a/Demo/Sources/Players/SystemPlayer/SystemPlayerViewModel.swift +++ b/Demo/Sources/Players/SystemPlayer/SystemPlayerViewModel.swift @@ -28,4 +28,12 @@ final class SystemPlayerViewModel: ObservableObject { } } -extension SystemPlayerViewModel: PictureInPicturePersistable {} +extension SystemPlayerViewModel: PictureInPicturePersistable { + func pictureInPictureWillStart() {} + + func pictureInPictureDidStart() {} + + func pictureInPictureWillStop() {} + + func pictureInPictureDidStop() {} +} diff --git a/Demo/Sources/Showcase/Multi/MultiViewModel.swift b/Demo/Sources/Showcase/Multi/MultiViewModel.swift index f2459bca8..4cd892a3f 100644 --- a/Demo/Sources/Showcase/Multi/MultiViewModel.swift +++ b/Demo/Sources/Showcase/Multi/MultiViewModel.swift @@ -111,7 +111,13 @@ final class MultiViewModel: ObservableObject { } extension MultiViewModel: PictureInPicturePersistable { + func pictureInPictureWillStart() {} + func pictureInPictureDidStart() { inactivePlayer.pause() } + + func pictureInPictureWillStop() {} + + func pictureInPictureDidStop() {} } diff --git a/Demo/Sources/Showcase/Playlist/PlaylistViewModel.swift b/Demo/Sources/Showcase/Playlist/PlaylistViewModel.swift index 19dd2b3b1..005c1dcb7 100644 --- a/Demo/Sources/Showcase/Playlist/PlaylistViewModel.swift +++ b/Demo/Sources/Showcase/Playlist/PlaylistViewModel.swift @@ -146,4 +146,12 @@ final class PlaylistViewModel: ObservableObject { } } -extension PlaylistViewModel: PictureInPicturePersistable {} +extension PlaylistViewModel: PictureInPicturePersistable { + func pictureInPictureWillStart() {} + + func pictureInPictureDidStart() {} + + func pictureInPictureWillStop() {} + + func pictureInPictureDidStop() {} +} diff --git a/Sources/Analytics/UserInterface/PageViewTracking.swift b/Sources/Analytics/UserInterface/PageViewTracking.swift index 16d3db808..6f38bf231 100644 --- a/Sources/Analytics/UserInterface/PageViewTracking.swift +++ b/Sources/Analytics/UserInterface/PageViewTracking.swift @@ -19,17 +19,10 @@ public protocol PageViewTracking { /// The Commanders Act page view data. var commandersActPageView: CommandersActPageView { get } - /// A Boolean to enable or disable automatic tracking. Defaults to `true`. + /// A Boolean to enable or disable automatic tracking. var isTrackedAutomatically: Bool { get } } -public extension PageViewTracking { - /// The default automatic tracking setting. - var isTrackedAutomatically: Bool { - true - } -} - extension UIViewController { static func setupViewControllerTracking() { method_exchangeImplementations( diff --git a/Sources/Analytics/UserInterface/View.swift b/Sources/Analytics/UserInterface/View.swift index e48336071..4189c4cd1 100644 --- a/Sources/Analytics/UserInterface/View.swift +++ b/Sources/Analytics/UserInterface/View.swift @@ -6,7 +6,7 @@ import SwiftUI -private final class TrackerViewController: UIViewController, PageViewTracking { +private final class TrackerViewController: UIViewController { let comScorePageView: ComScorePageView let commandersActPageView: CommandersActPageView @@ -46,3 +46,9 @@ public extension View { } } } + +extension TrackerViewController: PageViewTracking { + var isTrackedAutomatically: Bool { + true + } +} diff --git a/Sources/Player/Interfaces/PictureInPicturePersistable.swift b/Sources/Player/Interfaces/PictureInPicturePersistable.swift index 7e40dd99a..2270c0ef1 100644 --- a/Sources/Player/Interfaces/PictureInPicturePersistable.swift +++ b/Sources/Player/Interfaces/PictureInPicturePersistable.swift @@ -27,20 +27,6 @@ public protocol PictureInPicturePersistable: AnyObject { func pictureInPictureDidStop() } -public extension PictureInPicturePersistable { - /// Default implementation. Does nothing. - func pictureInPictureWillStart() {} - - /// Default implementation. Does nothing. - func pictureInPictureDidStart() {} - - /// Default implementation. Does nothing. - func pictureInPictureWillStop() {} - - /// Default implementation. Does nothing. - func pictureInPictureDidStop() {} -} - extension PictureInPicturePersistable { /// The currently persisted instance, if any. public static var persisted: Self? { diff --git a/Tests/AnalyticsTests/ComScore/ComScorePageViewTests.swift b/Tests/AnalyticsTests/ComScore/ComScorePageViewTests.swift index 0cb4776fb..babf16bf4 100644 --- a/Tests/AnalyticsTests/ComScore/ComScorePageViewTests.swift +++ b/Tests/AnalyticsTests/ComScore/ComScorePageViewTests.swift @@ -23,6 +23,10 @@ private class AutomaticMockViewController: UIViewController, PageViewTracking { .init(name: pageName, type: "type") } + var isTrackedAutomatically: Bool { + true + } + init(title: String? = nil) { super.init(nibName: nil, bundle: nil) self.title = title