From 8a38a043af3bfe8a118c743409ac2611e5a3330b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20De=CC=81fago?= Date: Thu, 12 Dec 2024 14:17:44 +0100 Subject: [PATCH 1/3] Prevent item creation from non-official service endpoints --- Sources/CoreBusiness/DataProvider/Server.swift | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/Sources/CoreBusiness/DataProvider/Server.swift b/Sources/CoreBusiness/DataProvider/Server.swift index ba95efa5e..52ff036dd 100644 --- a/Sources/CoreBusiness/DataProvider/Server.swift +++ b/Sources/CoreBusiness/DataProvider/Server.swift @@ -26,15 +26,13 @@ public struct Server { private let baseUrl: URL private let queryItems: [URLQueryItem] - /// Creates a server with custom settings. + /// This API will be removed in a future Pillarbox release. Do not use. /// - /// - Parameters: - /// - baseUrl: The base URL of the server. - /// - queryItems: Additional query items to associate with each request. - /// - /// Useful for servers which can exactly pose as SRG SSR servers and deliver the same playback metadata format and - /// image scaling capabilities. + /// > Warning: This API will be removed in a future Pillarbox release. Do not use. public init(baseUrl: URL, queryItems: [URLQueryItem] = []) { + // FIXME: This initializer must be made private after SAM replaces the IL. The assertion must be removed at + // the same time. + assert(Bundle.main.bundleIdentifier!.hasPrefix("ch.srgssr.Pillarbox-demo"), "This API will be removed in a future Pillarbox release. Do not use.") self.baseUrl = baseUrl self.queryItems = queryItems } From a3d46efaf4aa14d7e3cb9e1f51f443cf4c103d8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20De=CC=81fago?= Date: Thu, 12 Dec 2024 15:57:56 +0100 Subject: [PATCH 2/3] Avoid assertion when running unit tests --- Sources/CoreBusiness/DataProvider/Server.swift | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Sources/CoreBusiness/DataProvider/Server.swift b/Sources/CoreBusiness/DataProvider/Server.swift index 52ff036dd..ff7654926 100644 --- a/Sources/CoreBusiness/DataProvider/Server.swift +++ b/Sources/CoreBusiness/DataProvider/Server.swift @@ -32,7 +32,7 @@ public struct Server { public init(baseUrl: URL, queryItems: [URLQueryItem] = []) { // FIXME: This initializer must be made private after SAM replaces the IL. The assertion must be removed at // the same time. - assert(Bundle.main.bundleIdentifier!.hasPrefix("ch.srgssr.Pillarbox-demo"), "This API will be removed in a future Pillarbox release. Do not use.") + assert(Bundle.main.allowsReservedInitializer, "This API will be removed in a future Pillarbox release. Do not use.") self.baseUrl = baseUrl self.queryItems = queryItems } @@ -69,3 +69,10 @@ public struct Server { } } } + +private extension Bundle { + var allowsReservedInitializer: Bool { + guard let bundleIdentifier = Bundle.main.bundleIdentifier else { return false } + return bundleIdentifier.hasPrefix("ch.srgssr.Pillarbox-demo") || bundleIdentifier.hasPrefix("com.apple.dt.xctest.tool") + } +} From 33a996d25f4addf0a41e12697372291c77066500 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20De=CC=81fago?= Date: Thu, 12 Dec 2024 16:11:11 +0100 Subject: [PATCH 3/3] Fix linting issue with rubocop 1.69.2 --- fastlane/Fastfile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 41a7b30ad..fe1df8e03 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -25,9 +25,8 @@ DEVICES = { ICON_GLOBS = { ios: '/Demo/Resources/Assets.xcassets/AppIcon.appiconset/*.png', - tvos: \ - '/Demo/Resources/Assets.xcassets/App Icon & Top Shelf Image.brandassets/*/Back.imagestacklayer' \ - '/Content.imageset/*.png' + tvos: '/Demo/Resources/Assets.xcassets/App Icon & Top Shelf Image.brandassets/*/Back.imagestacklayer' \ + '/Content.imageset/*.png' }.freeze SHIELD_SCALES = {