From 1407b133e2747a91d0406df741c2de0da1144923 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matu=CC=81s=CC=8C=20Tomlein?= Date: Thu, 1 Feb 2024 09:24:26 +0100 Subject: [PATCH] Set the platform event property to tv on tvOS and mobile on watchOS --- Sources/Core/Utils/Utilities.swift | 4 +++- Tests/TestUtils.swift | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Sources/Core/Utils/Utilities.swift b/Sources/Core/Utils/Utilities.swift index 4643893fe..81617904a 100644 --- a/Sources/Core/Utils/Utilities.swift +++ b/Sources/Core/Utils/Utilities.swift @@ -36,11 +36,13 @@ class Utilities { /// Returns the platform type of the device.. /// - Returns: A string of the platform type. class var platform: DevicePlatform { - #if os(iOS) || os(visionOS) + #if os(iOS) || os(visionOS) || os(watchOS) return .mobile // TODO: use the headset platform by default in visionOS once Enrich 4 is commonly used // #elseif os(visionOS) // return .headset + #elseif os(tvOS) + return .connectedTV #else return .desktop #endif diff --git a/Tests/TestUtils.swift b/Tests/TestUtils.swift index aaff99fd2..cd87b6c69 100644 --- a/Tests/TestUtils.swift +++ b/Tests/TestUtils.swift @@ -34,8 +34,10 @@ class TestUtils: XCTestCase { } func testGetPlatform() { -#if os(iOS) || os(visionOS) +#if os(iOS) || os(visionOS) || os(watchOS) XCTAssertEqual(Utilities.platform, .mobile) +#elseif os(tvOS) + XCTAssertEqual(Utilities.platform, .connectedTV) #else XCTAssertEqual(Utilities.platform, .desktop) #endif