@webspatial/platform-visionos 0.1.15 → 0.1.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/web-spatial/Assets.xcassets/AppIcon.solidimagestack/Back.solidimagestacklayer/Content.imageset/icon.png +0 -0
- package/web-spatial/Assets.xcassets/AppIcon.solidimagestack/Middle.solidimagestacklayer/Content.imageset/icon.png +0 -0
- package/web-spatial/libs/SpatialComponent.swift +1 -1
- package/web-spatial/libs/SpatialObject.swift +4 -1
- package/web-spatial/libs/Utils/CommandManager.swift +5 -2
- package/web-spatial/libs/Utils/PerfClock.swift +43 -0
- package/web-spatial/libs/webView/backend/NativeWebView.swift +6 -4
- package/web-spatial/web_spatialApp.swift +1 -0
- package/web-spatial.xcodeproj/project.pbxproj +4 -0
- package/Packages/RealityKitContent/.swiftpm/xcode/xcuserdata/bytedance.xcuserdatad/xcschemes/xcschememanagement.plist +0 -14
- package/web-spatial.xcodeproj/project.xcworkspace/xcuserdata/bytedance.xcuserdatad/WorkspaceSettings.xcsettings +0 -14
package/package.json
CHANGED
|
Binary file
|
|
Binary file
|
|
@@ -7,10 +7,12 @@ struct SpatialObjectInfo: Codable {
|
|
|
7
7
|
var entityArray: [String]
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
+
// Stats from native code. Objects tracks number of native objects that were created but not yet explicitly destroyed. RefObjects tracks bjects that still have references. After an object is destroyed, we should be cleaning up all of the native references. Expect objects.count == refObjects.count , if not, there is likely a leak.
|
|
10
11
|
struct SpatialObjectStatsInfo: Codable {
|
|
11
12
|
var backend = "AVP"
|
|
12
13
|
var objects: SpatialObjectInfo
|
|
13
14
|
var refObjects: SpatialObjectInfo
|
|
15
|
+
var perfStats: PerfStats
|
|
14
16
|
}
|
|
15
17
|
|
|
16
18
|
class WeakReference<T: AnyObject> {
|
|
@@ -70,7 +72,8 @@ class SpatialObject: EventEmitter, Equatable {
|
|
|
70
72
|
windowArray: Array(weakRefWebviews.keys),
|
|
71
73
|
windowContainerArray: Array(weakRefWindowContainers.keys),
|
|
72
74
|
entityArray: Array(weakRefEntities.keys)
|
|
73
|
-
)
|
|
75
|
+
),
|
|
76
|
+
perfStats: clock.perfStats
|
|
74
77
|
)
|
|
75
78
|
}
|
|
76
79
|
|
|
@@ -456,6 +456,7 @@ class CommandManager {
|
|
|
456
456
|
spatialWindowComponent.getView()!.destroy()
|
|
457
457
|
spatialWindowComponent.setView(wv: spawnedWebView)
|
|
458
458
|
spatialWindowComponent.getView()!.webViewHolder.webViewCoordinator!.webViewRef = spatialWindowComponent
|
|
459
|
+
spatialWindowComponent.didFinishFirstLoad = true
|
|
459
460
|
}
|
|
460
461
|
}
|
|
461
462
|
|
|
@@ -492,6 +493,8 @@ class CommandManager {
|
|
|
492
493
|
}
|
|
493
494
|
|
|
494
495
|
if let backgroundMaterial: BackgroundMaterial = data.update?.style?.backgroundMaterial {
|
|
496
|
+
clock.backgroundSet()
|
|
497
|
+
|
|
495
498
|
if spatialWindowComponent.isLoading {
|
|
496
499
|
spatialWindowComponent.loadingStyles.backgroundMaterial = backgroundMaterial
|
|
497
500
|
}
|
|
@@ -523,7 +526,7 @@ class CommandManager {
|
|
|
523
526
|
|
|
524
527
|
// If the parent window component isn't set, the new container can continue to exist even after other window is closed
|
|
525
528
|
if info.resourceID != "notFound" {
|
|
526
|
-
|
|
529
|
+
let rid = info.resourceID
|
|
527
530
|
let so = SpatialObject.get(rid)
|
|
528
531
|
if let parentWindowComponent = so as? SpatialWindowComponent {
|
|
529
532
|
parentWindowComponent.setWindowContainer(uuid: uuid, wgd: wgd)
|
|
@@ -531,7 +534,7 @@ class CommandManager {
|
|
|
531
534
|
}
|
|
532
535
|
|
|
533
536
|
if info.windowContainerID != "notFound" {
|
|
534
|
-
if
|
|
537
|
+
if let parentContainer = SpatialWindowContainer.getSpatialWindowContainer(info.windowContainerID) {
|
|
535
538
|
parentContainer.childContainers[uuid] = wg
|
|
536
539
|
}
|
|
537
540
|
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import SwiftUI
|
|
2
|
+
|
|
3
|
+
struct PerfStats: Codable {
|
|
4
|
+
// Time from app start until the first call to setMaterial. In milliseconds
|
|
5
|
+
var firstBackgroundSet: Int = 0
|
|
6
|
+
|
|
7
|
+
// Attempts to track the number of commands handled over the last second
|
|
8
|
+
var commandCounter: Int = 0
|
|
9
|
+
var commandCounterStartTime: Int = 0
|
|
10
|
+
var commandsPerSecond = 0.0
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
class PerfClock {
|
|
14
|
+
var perfStats = PerfStats()
|
|
15
|
+
|
|
16
|
+
let createTimeMS: Int
|
|
17
|
+
|
|
18
|
+
init() {
|
|
19
|
+
createTimeMS = PerfClock.getCurrentTimeMS()
|
|
20
|
+
perfStats.commandCounterStartTime = createTimeMS
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
func backgroundSet() {
|
|
24
|
+
if perfStats.firstBackgroundSet == 0 {
|
|
25
|
+
perfStats.firstBackgroundSet = PerfClock.getCurrentTimeMS() - createTimeMS
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
func onMessage() {
|
|
30
|
+
perfStats.commandCounter += 1
|
|
31
|
+
let dt = PerfClock.getCurrentTimeMS() - createTimeMS
|
|
32
|
+
if dt > 1000 {
|
|
33
|
+
perfStats.commandsPerSecond = Double(perfStats.commandCounter) / (Double(1000.0) / Double(dt))
|
|
34
|
+
|
|
35
|
+
perfStats.commandCounter = 0
|
|
36
|
+
perfStats.commandCounterStartTime = PerfClock.getCurrentTimeMS()
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
static func getCurrentTimeMS() -> Int {
|
|
41
|
+
return Int(Date().timeIntervalSince1970 * 1000)
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -48,10 +48,12 @@ class Coordinator: NSObject, WKNavigationDelegate, WKScriptMessageHandler, WKUID
|
|
|
48
48
|
return
|
|
49
49
|
}
|
|
50
50
|
let session = URLSession(configuration: URLSessionConfiguration.default)
|
|
51
|
-
let dataTask = session.dataTask(with: urlRequest) { data, response, _ in
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
51
|
+
let dataTask = session.dataTask(with: urlRequest) { [task = urlSchemeTask as AnyObject] data, response, _ in
|
|
52
|
+
guard let task = task as? WKURLSchemeTask else { return }
|
|
53
|
+
|
|
54
|
+
task.didReceive(response!)
|
|
55
|
+
task.didReceive(data!)
|
|
56
|
+
task.didFinish()
|
|
55
57
|
}
|
|
56
58
|
dataTask.resume()
|
|
57
59
|
return
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
/* Begin PBXBuildFile section */
|
|
10
10
|
2B0B1C102C494E5400E644F9 /* Logger.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2B0B1C0F2C494E5400E644F9 /* Logger.swift */; };
|
|
11
11
|
2B0B430A2CBE21580003CEF3 /* CommandManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2B0B43092CBE21540003CEF3 /* CommandManager.swift */; };
|
|
12
|
+
2B0FF4F42DD2711E00C3F20A /* PerfClock.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2B0FF4F32DD2711800C3F20A /* PerfClock.swift */; };
|
|
12
13
|
2B23CB3F2D0BEE6900E70D95 /* WindowContainerMgr.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2B23CB3E2D0BEE6900E70D95 /* WindowContainerMgr.swift */; };
|
|
13
14
|
2B2F1D692BEBFAAA006897EE /* RealityKitContent in Frameworks */ = {isa = PBXBuildFile; productRef = 2B2F1D682BEBFAAA006897EE /* RealityKitContent */; };
|
|
14
15
|
2B2F1D6B2BEBFAAA006897EE /* web_spatialApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2B2F1D6A2BEBFAAA006897EE /* web_spatialApp.swift */; };
|
|
@@ -60,6 +61,7 @@
|
|
|
60
61
|
/* Begin PBXFileReference section */
|
|
61
62
|
2B0B1C0F2C494E5400E644F9 /* Logger.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Logger.swift; sourceTree = "<group>"; };
|
|
62
63
|
2B0B43092CBE21540003CEF3 /* CommandManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CommandManager.swift; sourceTree = "<group>"; };
|
|
64
|
+
2B0FF4F32DD2711800C3F20A /* PerfClock.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PerfClock.swift; sourceTree = "<group>"; };
|
|
63
65
|
2B23CB3E2D0BEE6900E70D95 /* WindowContainerMgr.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WindowContainerMgr.swift; sourceTree = "<group>"; };
|
|
64
66
|
2B2F1D632BEBFAAA006897EE /* WebSpatial.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = WebSpatial.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
|
65
67
|
2B2F1D672BEBFAAA006897EE /* RealityKitContent */ = {isa = PBXFileReference; lastKnownFileType = wrapper; path = RealityKitContent; sourceTree = "<group>"; };
|
|
@@ -123,6 +125,7 @@
|
|
|
123
125
|
2B0B1C0E2C494E4100E644F9 /* Utils */ = {
|
|
124
126
|
isa = PBXGroup;
|
|
125
127
|
children = (
|
|
128
|
+
2B0FF4F32DD2711800C3F20A /* PerfClock.swift */,
|
|
126
129
|
2BD5880D2DB1236000C0E13B /* version.swift */,
|
|
127
130
|
2BD510552D54A2FF0001E5E6 /* SceneManager.swift */,
|
|
128
131
|
2B0B43092CBE21540003CEF3 /* CommandManager.swift */,
|
|
@@ -375,6 +378,7 @@
|
|
|
375
378
|
2BE1E9032C9035DB00EAE76A /* SpatialInputComponent.swift in Sources */,
|
|
376
379
|
2B2F1D9B2BEDA975006897EE /* PlainWindowContainerView.swift in Sources */,
|
|
377
380
|
2BE1E8FA2C90332400EAE76A /* SpatialObject.swift in Sources */,
|
|
381
|
+
2B0FF4F42DD2711E00C3F20A /* PerfClock.swift in Sources */,
|
|
378
382
|
2BB28CCC2C747DB0007F4BDC /* OpenDismissHandlerUI.swift in Sources */,
|
|
379
383
|
2BDBED632D3FE8EC0065443F /* SpatialModel3DView.swift in Sources */,
|
|
380
384
|
2B67BBAC2D151C1A00BBC689 /* manifest.swift in Sources */,
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
|
-
<plist version="1.0">
|
|
4
|
-
<dict>
|
|
5
|
-
<key>SchemeUserState</key>
|
|
6
|
-
<dict>
|
|
7
|
-
<key>RealityKitContent.xcscheme_^#shared#^_</key>
|
|
8
|
-
<dict>
|
|
9
|
-
<key>orderHint</key>
|
|
10
|
-
<integer>1</integer>
|
|
11
|
-
</dict>
|
|
12
|
-
</dict>
|
|
13
|
-
</dict>
|
|
14
|
-
</plist>
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
|
-
<plist version="1.0">
|
|
4
|
-
<dict>
|
|
5
|
-
<key>BuildLocationStyle</key>
|
|
6
|
-
<string>UseAppPreferences</string>
|
|
7
|
-
<key>CustomBuildLocationType</key>
|
|
8
|
-
<string>RelativeToDerivedData</string>
|
|
9
|
-
<key>DerivedDataLocationStyle</key>
|
|
10
|
-
<string>Default</string>
|
|
11
|
-
<key>ShowSharedSchemesAutomaticallyEnabled</key>
|
|
12
|
-
<true/>
|
|
13
|
-
</dict>
|
|
14
|
-
</plist>
|