Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set the platform event property to tv on tvOS and mobile on watchOS #872

Merged
merged 1 commit into from
Feb 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading