From a677e9c570f1b4ed6bc2b53be3857d17d91a7d0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20D=C3=A9fago?= Date: Wed, 8 May 2024 10:12:31 +0200 Subject: [PATCH] Apply current demo settings to player instances (#872) --- .../Sources/Players/PlayerConfiguration.swift | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/Demo/Sources/Players/PlayerConfiguration.swift b/Demo/Sources/Players/PlayerConfiguration.swift index 73efd134f..5077504ae 100644 --- a/Demo/Sources/Players/PlayerConfiguration.swift +++ b/Demo/Sources/Players/PlayerConfiguration.swift @@ -8,13 +8,19 @@ import Foundation import PillarboxPlayer extension PlayerConfiguration { - static let standard = Self( - usesExternalPlaybackWhileMirroring: !UserDefaults.standard.presenterModeEnabled, - smartNavigationEnabled: UserDefaults.standard.smartNavigationEnabled - ) + static var standard: Self { + let userDefaults = UserDefaults.standard + return .init( + usesExternalPlaybackWhileMirroring: !userDefaults.presenterModeEnabled, + smartNavigationEnabled: userDefaults.smartNavigationEnabled + ) + } - static let externalPlaybackDisabled = Self( - allowsExternalPlayback: false, - smartNavigationEnabled: UserDefaults.standard.smartNavigationEnabled - ) + static var externalPlaybackDisabled: Self { + let userDefaults = UserDefaults.standard + return .init( + allowsExternalPlayback: false, + smartNavigationEnabled: userDefaults.smartNavigationEnabled + ) + } }