Skip to content

Commit

Permalink
Set the platform event property to tv on tvOS and mobile on watchOS
Browse files Browse the repository at this point in the history
  • Loading branch information
matus-tomlein committed Feb 1, 2024
1 parent b394803 commit 1407b13
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion Sources/Core/Utils/Utilities.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion Tests/TestUtils.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 1407b13

Please sign in to comment.