Skip to content

Commit

Permalink
Generate viewId UUID for immersive space
Browse files Browse the repository at this point in the history
  • Loading branch information
mscwilson committed Jan 19, 2024
1 parent d2be418 commit fba4365
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Sources/Snowplow/VisionOS/Entities/ImmersiveSpaceEntity.swift
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public class ImmersiveSpaceEntity: SelfDescribingJson {
}

/// - Parameter id: A localized string key to use for the window's title in system menus and in the window's title bar.
/// - Parameter viewId: UUID for the view of the immersive space.
/// - Parameter viewId: UUID for the view of the immersive space. Generated by the tracker if not provided.
/// - Parameter immersionStyle: A specification for the appearance and interaction of a window.
/// - Parameter upperLimbVisibility: A specification for the appearance and interaction of a window.
public init(
Expand All @@ -105,7 +105,7 @@ public class ImmersiveSpaceEntity: SelfDescribingJson {
upperLimbVisibility: UpperLimbVisibility? = nil
) {
self.id = id
self.viewId = viewId
self.viewId = viewId ?? UUID()
self.immersionStyle = immersionStyle
self.upperLimbVisibility = upperLimbVisibility
super.init(schema: swiftuiImmersiveSpaceSchema, andData: [:])
Expand Down
4 changes: 4 additions & 0 deletions Tests/VisionOS/TestVisionOSEvents.swift
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ class TestVisionOSEvents: XCTestCase {

let entities = trackedEvents[0].entities
XCTAssertEqual(1, getImmersiveSpaceEntities(entities).count)

let spaceEntity = getImmersiveSpaceEntities(entities)[0] as? ImmersiveSpaceEntity
let viewId = spaceEntity!.viewId
XCTAssertNotNil(viewId)
}

func testTrackDismissImmersiveSpace() {
Expand Down

0 comments on commit fba4365

Please sign in to comment.