@webspatial/platform-visionos 0.1.17 → 0.1.18
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webspatial/platform-visionos",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.18",
|
|
4
4
|
"description": "Used to publish WebSpatial projects to Apple Vision Pro",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"engines": {
|
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
},
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
11
|
-
"url": ""
|
|
11
|
+
"url": "git+https://github.com/webspatial/webspatial-sdk.git",
|
|
12
|
+
"directory": "packages/visionOS"
|
|
12
13
|
},
|
|
13
14
|
"files": [
|
|
14
15
|
"Packages",
|
|
@@ -163,10 +163,12 @@ class Coordinator: NSObject, WKNavigationDelegate, WKScriptMessageHandler, WKUID
|
|
|
163
163
|
for navigationAction: WKNavigationAction,
|
|
164
164
|
windowFeatures: WKWindowFeatures
|
|
165
165
|
) -> WKWebView? {
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
166
|
+
var resource = navigationAction.request.url!.absoluteString
|
|
167
|
+
if pwaManager.isLocal {
|
|
168
|
+
resource = pwaManager.getLocalResourceURL(url: resource)
|
|
169
|
+
}
|
|
170
|
+
if resource != "webspatial://createWindowContext",
|
|
171
|
+
!pwaManager.checkInScope(url: resource)
|
|
170
172
|
{
|
|
171
173
|
// open in safari
|
|
172
174
|
UIApplication.shared.open(navigationAction.request.url!, options: [:], completionHandler: nil)
|
|
@@ -244,6 +246,13 @@ struct WebViewNative: UIViewRepresentable {
|
|
|
244
246
|
myConfig.setURLSchemeHandler(webViewHolder.webViewCoordinator, forURLScheme: "file")
|
|
245
247
|
}
|
|
246
248
|
webViewHolder.appleWebView = WKWebView(frame: .zero, configuration: myConfig)
|
|
249
|
+
let configUA = myConfig.applicationNameForUserAgent as? String ?? ""
|
|
250
|
+
|
|
251
|
+
// change webview ua
|
|
252
|
+
let ua = webViewHolder.appleWebView?.value(forKey: "userAgent") as? String ?? ""
|
|
253
|
+
let webviewVersion = ua.split(separator: configUA)[0].split(separator: "AppleWebKit")[1]
|
|
254
|
+
webViewHolder.appleWebView!.customUserAgent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7; wv) AppleWebKit\(webviewVersion)WebSpatial/\(nativeAPIVersion)"
|
|
255
|
+
|
|
247
256
|
webViewHolder.appleWebView!.uiDelegate = webViewHolder.webViewCoordinator
|
|
248
257
|
webViewHolder.appleWebView!.allowsBackForwardNavigationGestures = true
|
|
249
258
|
webViewHolder.appleWebView!.isInspectable = true
|
|
@@ -100,8 +100,10 @@ struct web_spatialApp: App {
|
|
|
100
100
|
|
|
101
101
|
if let wv = rootEntity?.getComponent(SpatialWindowComponent.self) {
|
|
102
102
|
// remove the webview's name to behave like new opened root scene
|
|
103
|
-
wv.
|
|
104
|
-
wv.
|
|
103
|
+
if wv.getURL() != fileUrl {
|
|
104
|
+
wv.removeWebviewName {
|
|
105
|
+
wv.navigateToURL(url: fileUrl)
|
|
106
|
+
}
|
|
105
107
|
}
|
|
106
108
|
}
|
|
107
109
|
// reset to mainScene size
|