diff --git a/build/Packager/Assets/Plugins/Android/WebViewPlugin-development.aar.tmpl b/build/Packager/Assets/Plugins/Android/WebViewPlugin-development.aar.tmpl index 4c1c08fb..eb588fd3 100644 Binary files a/build/Packager/Assets/Plugins/Android/WebViewPlugin-development.aar.tmpl and b/build/Packager/Assets/Plugins/Android/WebViewPlugin-development.aar.tmpl differ diff --git a/build/Packager/Assets/Plugins/Android/WebViewPlugin-release.aar.tmpl b/build/Packager/Assets/Plugins/Android/WebViewPlugin-release.aar.tmpl index 1dda39be..cf5e5b1c 100644 Binary files a/build/Packager/Assets/Plugins/Android/WebViewPlugin-release.aar.tmpl and b/build/Packager/Assets/Plugins/Android/WebViewPlugin-release.aar.tmpl differ diff --git a/dist/package-nofragment/Assets/Plugins/Android/WebViewPlugin-development.aar.tmpl b/dist/package-nofragment/Assets/Plugins/Android/WebViewPlugin-development.aar.tmpl index d3a6f060..34839a9d 100644 Binary files a/dist/package-nofragment/Assets/Plugins/Android/WebViewPlugin-development.aar.tmpl and b/dist/package-nofragment/Assets/Plugins/Android/WebViewPlugin-development.aar.tmpl differ diff --git a/dist/package-nofragment/Assets/Plugins/Android/WebViewPlugin-release.aar.tmpl b/dist/package-nofragment/Assets/Plugins/Android/WebViewPlugin-release.aar.tmpl index 7da18326..876619cf 100644 Binary files a/dist/package-nofragment/Assets/Plugins/Android/WebViewPlugin-release.aar.tmpl and b/dist/package-nofragment/Assets/Plugins/Android/WebViewPlugin-release.aar.tmpl differ diff --git a/dist/package-nofragment/Assets/Plugins/WebView.bundle/Contents/Info.plist b/dist/package-nofragment/Assets/Plugins/WebView.bundle/Contents/Info.plist index 32b46465..2e8bd2b1 100644 --- a/dist/package-nofragment/Assets/Plugins/WebView.bundle/Contents/Info.plist +++ b/dist/package-nofragment/Assets/Plugins/WebView.bundle/Contents/Info.plist @@ -3,7 +3,7 @@ BuildMachineOSBuild - 23H124 + 24D70 CFBundleDevelopmentRegion English CFBundleExecutable @@ -29,19 +29,19 @@ DTCompiler com.apple.compilers.llvm.clang.1_0 DTPlatformBuild - + 24C94 DTPlatformName macosx DTPlatformVersion - 14.5 + 15.2 DTSDKBuild - 23F73 + 24C94 DTSDKName - macosx14.5 + macosx15.2 DTXcode - 1540 + 1620 DTXcodeBuild - 15F31d + 16C5032a LSMinimumSystemVersion 10.13 diff --git a/dist/package-nofragment/Assets/Plugins/WebView.bundle/Contents/MacOS/WebView b/dist/package-nofragment/Assets/Plugins/WebView.bundle/Contents/MacOS/WebView index 7646c0d2..761eba41 100755 Binary files a/dist/package-nofragment/Assets/Plugins/WebView.bundle/Contents/MacOS/WebView and b/dist/package-nofragment/Assets/Plugins/WebView.bundle/Contents/MacOS/WebView differ diff --git a/dist/package-nofragment/Assets/Plugins/WebViewObject.cs b/dist/package-nofragment/Assets/Plugins/WebViewObject.cs index dce485e9..81f47465 100644 --- a/dist/package-nofragment/Assets/Plugins/WebViewObject.cs +++ b/dist/package-nofragment/Assets/Plugins/WebViewObject.cs @@ -622,7 +622,7 @@ public bool IsInitialized() #if UNITY_WEBPLAYER || UNITY_WEBGL //TODO: UNSUPPORTED return true; -#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX +#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX || UNITY_SERVER //TODO: UNSUPPORTED return true; #elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX || UNITY_IPHONE @@ -676,7 +676,7 @@ public void Init( #endif #elif UNITY_WEBPLAYER Application.ExternalCall("unityWebView.init", name); -#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX +#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX || UNITY_SERVER //TODO: UNSUPPORTED Debug.LogError("Webview is not supported on this platform."); #elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX @@ -728,7 +728,7 @@ protected virtual void OnDestroy() #endif #elif UNITY_WEBPLAYER Application.ExternalCall("unityWebView.destroy", name); -#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX +#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX || UNITY_SERVER //TODO: UNSUPPORTED #elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX if (bg != null) { @@ -757,7 +757,7 @@ public void Pause() { #if UNITY_WEBPLAYER || UNITY_WEBGL //TODO: UNSUPPORTED -#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX +#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX || UNITY_SERVER //TODO: UNSUPPORTED #elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX //TODO: UNSUPPORTED @@ -777,7 +777,7 @@ public void Resume() { #if UNITY_WEBPLAYER || UNITY_WEBGL //TODO: UNSUPPORTED -#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX +#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX || UNITY_SERVER //TODO: UNSUPPORTED #elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX //TODO: UNSUPPORTED @@ -831,7 +831,7 @@ public void SetCenterPositionWithScale(Vector2 center, Vector2 scale) { #if UNITY_WEBPLAYER || UNITY_WEBGL //TODO: UNSUPPORTED -#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX +#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX || UNITY_SERVER //TODO: UNSUPPORTED #else float left = (Screen.width - scale.x) / 2.0f + center.x; @@ -844,7 +844,7 @@ public void SetCenterPositionWithScale(Vector2 center, Vector2 scale) public void SetMargins(int left, int top, int right, int bottom, bool relative = false) { -#if UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX +#if UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX || UNITY_SERVER //TODO: UNSUPPORTED return; #elif UNITY_WEBPLAYER || UNITY_WEBGL @@ -865,7 +865,7 @@ public void SetMargins(int left, int top, int right, int bottom, bool relative = mMarginBottom = bottom; mMarginRelative = relative; float ml, mt, mr, mb; -#if UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX +#if UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX || UNITY_SERVER //TODO: UNSUPPORTED #elif UNITY_WEBPLAYER || UNITY_WEBGL ml = left; @@ -943,7 +943,7 @@ public void SetMargins(int left, int top, int right, int bottom, bool relative = mMarginBottomComputed = mb; mMarginRelativeComputed = r; -#if UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX +#if UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX || UNITY_SERVER //TODO: UNSUPPORTED #elif UNITY_WEBPLAYER Application.ExternalCall("unityWebView.setMargins", name, (int)ml, (int)mt, (int)mr, (int)mb); @@ -980,7 +980,7 @@ public void SetVisibility(bool v) #endif #elif UNITY_WEBPLAYER Application.ExternalCall("unityWebView.setVisibility", name, v); -#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX +#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX || UNITY_SERVER //TODO: UNSUPPORTED #elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX if (webView == IntPtr.Zero) @@ -1117,7 +1117,7 @@ public bool SetURLPattern(string allowPattern, string denyPattern, string hookPa #if UNITY_WEBPLAYER || UNITY_WEBGL //TODO: UNSUPPORTED return false; -#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX +#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX || UNITY_SERVER //TODO: UNSUPPORTED return false; #elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX || UNITY_IPHONE @@ -1141,7 +1141,7 @@ public void LoadURL(string url) #endif #elif UNITY_WEBPLAYER Application.ExternalCall("unityWebView.loadURL", name, url); -#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX +#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX || UNITY_SERVER //TODO: UNSUPPORTED #elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX || UNITY_IPHONE if (webView == IntPtr.Zero) @@ -1162,7 +1162,7 @@ public void LoadHTML(string html, string baseUrl) baseUrl = ""; #if UNITY_WEBPLAYER || UNITY_WEBGL //TODO: UNSUPPORTED -#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX +#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX || UNITY_SERVER //TODO: UNSUPPORTED #elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX || UNITY_IPHONE if (webView == IntPtr.Zero) @@ -1183,7 +1183,7 @@ public void EvaluateJS(string js) #endif #elif UNITY_WEBPLAYER Application.ExternalCall("unityWebView.evaluateJS", name, js); -#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX +#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX || UNITY_SERVER //TODO: UNSUPPORTED #elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX || UNITY_IPHONE if (webView == IntPtr.Zero) @@ -1201,7 +1201,7 @@ public int Progress() #if UNITY_WEBPLAYER || UNITY_WEBGL //TODO: UNSUPPORTED return 0; -#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX +#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX || UNITY_SERVER //TODO: UNSUPPORTED return 0; #elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX || UNITY_IPHONE @@ -1220,7 +1220,7 @@ public bool CanGoBack() #if UNITY_WEBPLAYER || UNITY_WEBGL //TODO: UNSUPPORTED return false; -#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX +#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX || UNITY_SERVER //TODO: UNSUPPORTED return false; #elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX || UNITY_IPHONE @@ -1239,7 +1239,7 @@ public bool CanGoForward() #if UNITY_WEBPLAYER || UNITY_WEBGL //TODO: UNSUPPORTED return false; -#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX +#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX || UNITY_SERVER //TODO: UNSUPPORTED return false; #elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX || UNITY_IPHONE @@ -1257,7 +1257,7 @@ public void GoBack() { #if UNITY_WEBPLAYER || UNITY_WEBGL //TODO: UNSUPPORTED -#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX +#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX || UNITY_SERVER //TODO: UNSUPPORTED #elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX || UNITY_IPHONE if (webView == IntPtr.Zero) @@ -1274,7 +1274,7 @@ public void GoForward() { #if UNITY_WEBPLAYER || UNITY_WEBGL //TODO: UNSUPPORTED -#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX +#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX || UNITY_SERVER //TODO: UNSUPPORTED #elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX || UNITY_IPHONE if (webView == IntPtr.Zero) @@ -1291,7 +1291,7 @@ public void Reload() { #if UNITY_WEBPLAYER || UNITY_WEBGL //TODO: UNSUPPORTED -#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX +#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX || UNITY_SERVER //TODO: UNSUPPORTED #elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX || UNITY_IPHONE if (webView == IntPtr.Zero) @@ -1378,7 +1378,7 @@ public void AddCustomHeader(string headerKey, string headerValue) { #if UNITY_WEBPLAYER || UNITY_WEBGL //TODO: UNSUPPORTED -#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX +#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX || UNITY_SERVER //TODO: UNSUPPORTED #elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX || UNITY_IPHONE if (webView == IntPtr.Zero) @@ -1396,7 +1396,7 @@ public string GetCustomHeaderValue(string headerKey) #if UNITY_WEBPLAYER || UNITY_WEBGL //TODO: UNSUPPORTED return null; -#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX +#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX || UNITY_SERVER //TODO: UNSUPPORTED return null; #elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX || UNITY_IPHONE @@ -1413,7 +1413,7 @@ public string GetCustomHeaderValue(string headerKey) public void RemoveCustomHeader(string headerKey) { #if UNITY_WEBPLAYER || UNITY_WEBGL -#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX +#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX || UNITY_SERVER #elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX || UNITY_IPHONE if (webView == IntPtr.Zero) return; @@ -1429,7 +1429,7 @@ public void ClearCustomHeader() { #if UNITY_WEBPLAYER || UNITY_WEBGL //TODO: UNSUPPORTED -#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX +#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX || UNITY_SERVER //TODO: UNSUPPORTED #elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX || UNITY_IPHONE if (webView == IntPtr.Zero) @@ -1446,7 +1446,7 @@ public void ClearCookies() { #if UNITY_WEBPLAYER || UNITY_WEBGL //TODO: UNSUPPORTED -#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX +#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX || UNITY_SERVER //TODO: UNSUPPORTED #elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX || UNITY_IPHONE if (webView == IntPtr.Zero) @@ -1464,7 +1464,7 @@ public void SaveCookies() { #if UNITY_WEBPLAYER || UNITY_WEBGL //TODO: UNSUPPORTED -#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX +#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX || UNITY_SERVER //TODO: UNSUPPORTED #elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX || UNITY_IPHONE if (webView == IntPtr.Zero) @@ -1482,7 +1482,7 @@ public void GetCookies(string url) { #if UNITY_WEBPLAYER || UNITY_WEBGL //TODO: UNSUPPORTED -#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX +#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX || UNITY_SERVER //TODO: UNSUPPORTED #elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX || UNITY_IPHONE if (webView == IntPtr.Zero) @@ -1501,7 +1501,7 @@ public void SetBasicAuthInfo(string userName, string password) { #if UNITY_WEBPLAYER || UNITY_WEBGL //TODO: UNSUPPORTED -#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX +#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX || UNITY_SERVER //TODO: UNSUPPORTED #elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX //TODO: UNSUPPORTED @@ -1520,7 +1520,7 @@ public void ClearCache(bool includeDiskFiles) { #if UNITY_WEBPLAYER || UNITY_WEBGL //TODO: UNSUPPORTED -#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX +#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX || UNITY_SERVER //TODO: UNSUPPORTED #elif UNITY_IPHONE && !UNITY_EDITOR if (webView == IntPtr.Zero) @@ -1538,7 +1538,7 @@ public void SetTextZoom(int textZoom) { #if UNITY_WEBPLAYER || UNITY_WEBGL //TODO: UNSUPPORTED -#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX +#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX || UNITY_SERVER //TODO: UNSUPPORTED #elif UNITY_IPHONE && !UNITY_EDITOR //TODO: UNSUPPORTED @@ -1553,7 +1553,7 @@ public void SetMixedContentMode(int mode) // 0: MIXED_CONTENT_ALWAYS_ALLOW, 1: { #if UNITY_WEBPLAYER || UNITY_WEBGL //TODO: UNSUPPORTED -#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX +#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX || UNITY_SERVER //TODO: UNSUPPORTED #elif UNITY_IPHONE && !UNITY_EDITOR //TODO: UNSUPPORTED diff --git a/dist/package-nofragment/Assets/Plugins/iOS/WebView.mm b/dist/package-nofragment/Assets/Plugins/iOS/WebView.mm index 4620012e..c1afed3d 100644 --- a/dist/package-nofragment/Assets/Plugins/iOS/WebView.mm +++ b/dist/package-nofragment/Assets/Plugins/iOS/WebView.mm @@ -267,6 +267,12 @@ - (id)initWithGameObjectName:(const char *)gameObjectName_ transparent:(BOOL)tra [view addSubview:webView]; + //set webview for Unity 6 accessibility hierarchy + NSMutableArray *accessibilityElements + = view.accessibilityElements ? [view.accessibilityElements mutableCopy] : [NSMutableArray array]; + [accessibilityElements addObject:(UIAccessibilityElement *)webView]; + view.accessibilityElements = accessibilityElements; + return self; } @@ -284,6 +290,13 @@ - (void)dispose [webView0 stopLoading]; [webView0 removeFromSuperview]; [webView0 removeObserver:self forKeyPath:@"loading"]; + + //remove the WebViewObject from Unity hierarchy tree + UIView *view = UnityGetGLViewController().view; + NSMutableArray *accessibilityElements + = view.accessibilityElements ? [view.accessibilityElements mutableCopy] : [NSMutableArray array]; + [accessibilityElements removeObject: (UIAccessibilityElement *)webView0]; + view.accessibilityElements = accessibilityElements; } basicAuthPassword = nil; basicAuthUserName = nil; diff --git a/dist/package-nofragment/Assets/WebGLTemplates/unity-webview-2020/unity-webview.js b/dist/package-nofragment/Assets/WebGLTemplates/unity-webview-2020/unity-webview.js index d5063389..6a9c777f 100644 --- a/dist/package-nofragment/Assets/WebGLTemplates/unity-webview-2020/unity-webview.js +++ b/dist/package-nofragment/Assets/WebGLTemplates/unity-webview-2020/unity-webview.js @@ -24,8 +24,6 @@ var unityWebView = if (href.substr(0, 6) === 'unity:') { unityInstance.SendMessage(name, "CallFromJS", href.substring(6, href.length)); e.preventDefault(); - } else { - w.location.replace(href); } }); diff --git a/dist/package-nofragment/Assets/WebGLTemplates/unity-webview/unity-webview.js b/dist/package-nofragment/Assets/WebGLTemplates/unity-webview/unity-webview.js index 44dba393..64f473c0 100644 --- a/dist/package-nofragment/Assets/WebGLTemplates/unity-webview/unity-webview.js +++ b/dist/package-nofragment/Assets/WebGLTemplates/unity-webview/unity-webview.js @@ -24,8 +24,6 @@ var unityWebView = if (href.substr(0, 6) === 'unity:') { unityInstance.SendMessage(name, "CallFromJS", href.substring(6, href.length)); e.preventDefault(); - } else { - w.location.replace(href); } }); diff --git a/dist/package/Assets/Plugins/Android/WebViewPlugin-development.aar.tmpl b/dist/package/Assets/Plugins/Android/WebViewPlugin-development.aar.tmpl index 4c1c08fb..eb588fd3 100644 Binary files a/dist/package/Assets/Plugins/Android/WebViewPlugin-development.aar.tmpl and b/dist/package/Assets/Plugins/Android/WebViewPlugin-development.aar.tmpl differ diff --git a/dist/package/Assets/Plugins/Android/WebViewPlugin-release.aar.tmpl b/dist/package/Assets/Plugins/Android/WebViewPlugin-release.aar.tmpl index bc02190d..cf5e5b1c 100644 Binary files a/dist/package/Assets/Plugins/Android/WebViewPlugin-release.aar.tmpl and b/dist/package/Assets/Plugins/Android/WebViewPlugin-release.aar.tmpl differ diff --git a/dist/package/Assets/Plugins/WebView.bundle/Contents/Info.plist b/dist/package/Assets/Plugins/WebView.bundle/Contents/Info.plist index 32b46465..2e8bd2b1 100644 --- a/dist/package/Assets/Plugins/WebView.bundle/Contents/Info.plist +++ b/dist/package/Assets/Plugins/WebView.bundle/Contents/Info.plist @@ -3,7 +3,7 @@ BuildMachineOSBuild - 23H124 + 24D70 CFBundleDevelopmentRegion English CFBundleExecutable @@ -29,19 +29,19 @@ DTCompiler com.apple.compilers.llvm.clang.1_0 DTPlatformBuild - + 24C94 DTPlatformName macosx DTPlatformVersion - 14.5 + 15.2 DTSDKBuild - 23F73 + 24C94 DTSDKName - macosx14.5 + macosx15.2 DTXcode - 1540 + 1620 DTXcodeBuild - 15F31d + 16C5032a LSMinimumSystemVersion 10.13 diff --git a/dist/package/Assets/Plugins/WebView.bundle/Contents/MacOS/WebView b/dist/package/Assets/Plugins/WebView.bundle/Contents/MacOS/WebView index 7646c0d2..761eba41 100755 Binary files a/dist/package/Assets/Plugins/WebView.bundle/Contents/MacOS/WebView and b/dist/package/Assets/Plugins/WebView.bundle/Contents/MacOS/WebView differ diff --git a/dist/package/Assets/Plugins/WebViewObject.cs b/dist/package/Assets/Plugins/WebViewObject.cs index f6bca88c..ac3dacb3 100644 --- a/dist/package/Assets/Plugins/WebViewObject.cs +++ b/dist/package/Assets/Plugins/WebViewObject.cs @@ -625,7 +625,7 @@ public bool IsInitialized() #if UNITY_WEBPLAYER || UNITY_WEBGL //TODO: UNSUPPORTED return true; -#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX +#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX || UNITY_SERVER //TODO: UNSUPPORTED return true; #elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX || UNITY_IPHONE @@ -679,7 +679,7 @@ public void Init( #endif #elif UNITY_WEBPLAYER Application.ExternalCall("unityWebView.init", name); -#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX +#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX || UNITY_SERVER //TODO: UNSUPPORTED Debug.LogError("Webview is not supported on this platform."); #elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX @@ -731,7 +731,7 @@ protected virtual void OnDestroy() #endif #elif UNITY_WEBPLAYER Application.ExternalCall("unityWebView.destroy", name); -#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX +#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX || UNITY_SERVER //TODO: UNSUPPORTED #elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX if (bg != null) { @@ -760,7 +760,7 @@ public void Pause() { #if UNITY_WEBPLAYER || UNITY_WEBGL //TODO: UNSUPPORTED -#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX +#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX || UNITY_SERVER //TODO: UNSUPPORTED #elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX //TODO: UNSUPPORTED @@ -780,7 +780,7 @@ public void Resume() { #if UNITY_WEBPLAYER || UNITY_WEBGL //TODO: UNSUPPORTED -#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX +#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX || UNITY_SERVER //TODO: UNSUPPORTED #elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX //TODO: UNSUPPORTED @@ -800,7 +800,7 @@ public void SetCenterPositionWithScale(Vector2 center, Vector2 scale) { #if UNITY_WEBPLAYER || UNITY_WEBGL //TODO: UNSUPPORTED -#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX +#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX || UNITY_SERVER //TODO: UNSUPPORTED #else float left = (Screen.width - scale.x) / 2.0f + center.x; @@ -813,7 +813,7 @@ public void SetCenterPositionWithScale(Vector2 center, Vector2 scale) public void SetMargins(int left, int top, int right, int bottom, bool relative = false) { -#if UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX +#if UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX || UNITY_SERVER //TODO: UNSUPPORTED return; #elif UNITY_WEBPLAYER || UNITY_WEBGL @@ -834,7 +834,7 @@ public void SetMargins(int left, int top, int right, int bottom, bool relative = mMarginBottom = bottom; mMarginRelative = relative; float ml, mt, mr, mb; -#if UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX +#if UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX || UNITY_SERVER //TODO: UNSUPPORTED #elif UNITY_WEBPLAYER || UNITY_WEBGL ml = left; @@ -912,7 +912,7 @@ public void SetMargins(int left, int top, int right, int bottom, bool relative = mMarginBottomComputed = mb; mMarginRelativeComputed = r; -#if UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX +#if UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX || UNITY_SERVER //TODO: UNSUPPORTED #elif UNITY_WEBPLAYER Application.ExternalCall("unityWebView.setMargins", name, (int)ml, (int)mt, (int)mr, (int)mb); @@ -949,7 +949,7 @@ public void SetVisibility(bool v) #endif #elif UNITY_WEBPLAYER Application.ExternalCall("unityWebView.setVisibility", name, v); -#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX +#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX || UNITY_SERVER //TODO: UNSUPPORTED #elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX if (webView == IntPtr.Zero) @@ -1086,7 +1086,7 @@ public bool SetURLPattern(string allowPattern, string denyPattern, string hookPa #if UNITY_WEBPLAYER || UNITY_WEBGL //TODO: UNSUPPORTED return false; -#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX +#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX || UNITY_SERVER //TODO: UNSUPPORTED return false; #elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX || UNITY_IPHONE @@ -1110,7 +1110,7 @@ public void LoadURL(string url) #endif #elif UNITY_WEBPLAYER Application.ExternalCall("unityWebView.loadURL", name, url); -#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX +#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX || UNITY_SERVER //TODO: UNSUPPORTED #elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX || UNITY_IPHONE if (webView == IntPtr.Zero) @@ -1131,7 +1131,7 @@ public void LoadHTML(string html, string baseUrl) baseUrl = ""; #if UNITY_WEBPLAYER || UNITY_WEBGL //TODO: UNSUPPORTED -#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX +#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX || UNITY_SERVER //TODO: UNSUPPORTED #elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX || UNITY_IPHONE if (webView == IntPtr.Zero) @@ -1152,7 +1152,7 @@ public void EvaluateJS(string js) #endif #elif UNITY_WEBPLAYER Application.ExternalCall("unityWebView.evaluateJS", name, js); -#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX +#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX || UNITY_SERVER //TODO: UNSUPPORTED #elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX || UNITY_IPHONE if (webView == IntPtr.Zero) @@ -1170,7 +1170,7 @@ public int Progress() #if UNITY_WEBPLAYER || UNITY_WEBGL //TODO: UNSUPPORTED return 0; -#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX +#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX || UNITY_SERVER //TODO: UNSUPPORTED return 0; #elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX || UNITY_IPHONE @@ -1189,7 +1189,7 @@ public bool CanGoBack() #if UNITY_WEBPLAYER || UNITY_WEBGL //TODO: UNSUPPORTED return false; -#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX +#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX || UNITY_SERVER //TODO: UNSUPPORTED return false; #elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX || UNITY_IPHONE @@ -1208,7 +1208,7 @@ public bool CanGoForward() #if UNITY_WEBPLAYER || UNITY_WEBGL //TODO: UNSUPPORTED return false; -#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX +#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX || UNITY_SERVER //TODO: UNSUPPORTED return false; #elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX || UNITY_IPHONE @@ -1226,7 +1226,7 @@ public void GoBack() { #if UNITY_WEBPLAYER || UNITY_WEBGL //TODO: UNSUPPORTED -#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX +#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX || UNITY_SERVER //TODO: UNSUPPORTED #elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX || UNITY_IPHONE if (webView == IntPtr.Zero) @@ -1243,7 +1243,7 @@ public void GoForward() { #if UNITY_WEBPLAYER || UNITY_WEBGL //TODO: UNSUPPORTED -#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX +#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX || UNITY_SERVER //TODO: UNSUPPORTED #elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX || UNITY_IPHONE if (webView == IntPtr.Zero) @@ -1260,7 +1260,7 @@ public void Reload() { #if UNITY_WEBPLAYER || UNITY_WEBGL //TODO: UNSUPPORTED -#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX +#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX || UNITY_SERVER //TODO: UNSUPPORTED #elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX || UNITY_IPHONE if (webView == IntPtr.Zero) @@ -1347,7 +1347,7 @@ public void AddCustomHeader(string headerKey, string headerValue) { #if UNITY_WEBPLAYER || UNITY_WEBGL //TODO: UNSUPPORTED -#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX +#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX || UNITY_SERVER //TODO: UNSUPPORTED #elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX || UNITY_IPHONE if (webView == IntPtr.Zero) @@ -1365,7 +1365,7 @@ public string GetCustomHeaderValue(string headerKey) #if UNITY_WEBPLAYER || UNITY_WEBGL //TODO: UNSUPPORTED return null; -#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX +#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX || UNITY_SERVER //TODO: UNSUPPORTED return null; #elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX || UNITY_IPHONE @@ -1382,7 +1382,7 @@ public string GetCustomHeaderValue(string headerKey) public void RemoveCustomHeader(string headerKey) { #if UNITY_WEBPLAYER || UNITY_WEBGL -#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX +#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX || UNITY_SERVER #elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX || UNITY_IPHONE if (webView == IntPtr.Zero) return; @@ -1398,7 +1398,7 @@ public void ClearCustomHeader() { #if UNITY_WEBPLAYER || UNITY_WEBGL //TODO: UNSUPPORTED -#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX +#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX || UNITY_SERVER //TODO: UNSUPPORTED #elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX || UNITY_IPHONE if (webView == IntPtr.Zero) @@ -1415,7 +1415,7 @@ public void ClearCookies() { #if UNITY_WEBPLAYER || UNITY_WEBGL //TODO: UNSUPPORTED -#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX +#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX || UNITY_SERVER //TODO: UNSUPPORTED #elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX || UNITY_IPHONE if (webView == IntPtr.Zero) @@ -1433,7 +1433,7 @@ public void SaveCookies() { #if UNITY_WEBPLAYER || UNITY_WEBGL //TODO: UNSUPPORTED -#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX +#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX || UNITY_SERVER //TODO: UNSUPPORTED #elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX || UNITY_IPHONE if (webView == IntPtr.Zero) @@ -1451,7 +1451,7 @@ public void GetCookies(string url) { #if UNITY_WEBPLAYER || UNITY_WEBGL //TODO: UNSUPPORTED -#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX +#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX || UNITY_SERVER //TODO: UNSUPPORTED #elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX || UNITY_IPHONE if (webView == IntPtr.Zero) @@ -1470,7 +1470,7 @@ public void SetBasicAuthInfo(string userName, string password) { #if UNITY_WEBPLAYER || UNITY_WEBGL //TODO: UNSUPPORTED -#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX +#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX || UNITY_SERVER //TODO: UNSUPPORTED #elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX //TODO: UNSUPPORTED @@ -1489,7 +1489,7 @@ public void ClearCache(bool includeDiskFiles) { #if UNITY_WEBPLAYER || UNITY_WEBGL //TODO: UNSUPPORTED -#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX +#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX || UNITY_SERVER //TODO: UNSUPPORTED #elif UNITY_IPHONE && !UNITY_EDITOR if (webView == IntPtr.Zero) @@ -1507,7 +1507,7 @@ public void SetTextZoom(int textZoom) { #if UNITY_WEBPLAYER || UNITY_WEBGL //TODO: UNSUPPORTED -#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX +#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX || UNITY_SERVER //TODO: UNSUPPORTED #elif UNITY_IPHONE && !UNITY_EDITOR //TODO: UNSUPPORTED @@ -1522,7 +1522,7 @@ public void SetMixedContentMode(int mode) // 0: MIXED_CONTENT_ALWAYS_ALLOW, 1: { #if UNITY_WEBPLAYER || UNITY_WEBGL //TODO: UNSUPPORTED -#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX +#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX || UNITY_SERVER //TODO: UNSUPPORTED #elif UNITY_IPHONE && !UNITY_EDITOR //TODO: UNSUPPORTED diff --git a/dist/package/Assets/Plugins/iOS/WebView.mm b/dist/package/Assets/Plugins/iOS/WebView.mm index 4620012e..c1afed3d 100644 --- a/dist/package/Assets/Plugins/iOS/WebView.mm +++ b/dist/package/Assets/Plugins/iOS/WebView.mm @@ -267,6 +267,12 @@ - (id)initWithGameObjectName:(const char *)gameObjectName_ transparent:(BOOL)tra [view addSubview:webView]; + //set webview for Unity 6 accessibility hierarchy + NSMutableArray *accessibilityElements + = view.accessibilityElements ? [view.accessibilityElements mutableCopy] : [NSMutableArray array]; + [accessibilityElements addObject:(UIAccessibilityElement *)webView]; + view.accessibilityElements = accessibilityElements; + return self; } @@ -284,6 +290,13 @@ - (void)dispose [webView0 stopLoading]; [webView0 removeFromSuperview]; [webView0 removeObserver:self forKeyPath:@"loading"]; + + //remove the WebViewObject from Unity hierarchy tree + UIView *view = UnityGetGLViewController().view; + NSMutableArray *accessibilityElements + = view.accessibilityElements ? [view.accessibilityElements mutableCopy] : [NSMutableArray array]; + [accessibilityElements removeObject: (UIAccessibilityElement *)webView0]; + view.accessibilityElements = accessibilityElements; } basicAuthPassword = nil; basicAuthUserName = nil; diff --git a/dist/package/Assets/WebGLTemplates/unity-webview-2020/unity-webview.js b/dist/package/Assets/WebGLTemplates/unity-webview-2020/unity-webview.js index d5063389..6a9c777f 100644 --- a/dist/package/Assets/WebGLTemplates/unity-webview-2020/unity-webview.js +++ b/dist/package/Assets/WebGLTemplates/unity-webview-2020/unity-webview.js @@ -24,8 +24,6 @@ var unityWebView = if (href.substr(0, 6) === 'unity:') { unityInstance.SendMessage(name, "CallFromJS", href.substring(6, href.length)); e.preventDefault(); - } else { - w.location.replace(href); } }); diff --git a/dist/package/Assets/WebGLTemplates/unity-webview/unity-webview.js b/dist/package/Assets/WebGLTemplates/unity-webview/unity-webview.js index 44dba393..64f473c0 100644 --- a/dist/package/Assets/WebGLTemplates/unity-webview/unity-webview.js +++ b/dist/package/Assets/WebGLTemplates/unity-webview/unity-webview.js @@ -24,8 +24,6 @@ var unityWebView = if (href.substr(0, 6) === 'unity:') { unityInstance.SendMessage(name, "CallFromJS", href.substring(6, href.length)); e.preventDefault(); - } else { - w.location.replace(href); } }); diff --git a/dist/unity-webview-nofragment.unitypackage b/dist/unity-webview-nofragment.unitypackage index b3528e85..7d15e901 100644 Binary files a/dist/unity-webview-nofragment.unitypackage and b/dist/unity-webview-nofragment.unitypackage differ diff --git a/dist/unity-webview-nofragment.zip b/dist/unity-webview-nofragment.zip index 30c93759..83e7038f 100644 Binary files a/dist/unity-webview-nofragment.zip and b/dist/unity-webview-nofragment.zip differ diff --git a/dist/unity-webview.unitypackage b/dist/unity-webview.unitypackage index 1011f539..0e80457a 100644 Binary files a/dist/unity-webview.unitypackage and b/dist/unity-webview.unitypackage differ diff --git a/dist/unity-webview.zip b/dist/unity-webview.zip index d9f1892f..21049fba 100644 Binary files a/dist/unity-webview.zip and b/dist/unity-webview.zip differ diff --git a/plugins/Android/build.gradle b/plugins/Android/build.gradle index c2706edd..964b8282 100644 --- a/plugins/Android/build.gradle +++ b/plugins/Android/build.gradle @@ -7,7 +7,7 @@ buildscript { } } dependencies { - classpath 'com.android.tools.build:gradle:4.1.0' + classpath 'com.android.tools.build:gradle:7.3.0' } } diff --git a/plugins/Android/install.sh b/plugins/Android/install.sh index e5082434..9b4f04cb 100755 --- a/plugins/Android/install.sh +++ b/plugins/Android/install.sh @@ -7,13 +7,13 @@ CWD=`cd $CWD && pwd -P` case $(uname) in Darwin) - export JAVA_HOME='/Applications/Unity/Hub/Editor/2022.3.32f1/PlaybackEngines/AndroidPlayer/OpenJDK' - export ANDROID_SDK_ROOT='/Applications/Unity/Hub/Editor/2022.3.32f1/PlaybackEngines/AndroidPlayer/SDK' + export JAVA_HOME='/Applications/Unity/Hub/Editor/6000.0.37f1/PlaybackEngines/AndroidPlayer/OpenJDK' + export ANDROID_SDK_ROOT='/Applications/Unity/Hub/Editor/6000.0.37f1/PlaybackEngines/AndroidPlayer/SDK' export PATH=$ANDROID_SDK_ROOT/platform-tools:$ANDROID_SDK_ROOT/tools:$ANDROID_SDK_ROOT/tools/bin:$JAVA_HOME/bin:$PATH ;; MINGW64_NT*) - export JAVA_HOME='/c/PROGRA~1/Unity/Hub/Editor/2022.3.32f1/Editor/Data/PlaybackEngines/AndroidPlayer/OpenJDK' - export ANDROID_SDK_ROOT='/c/PROGRA~1/Unity/Hub/Editor/2022.3.32f1/Editor/Data/PlaybackEngines/AndroidPlayer/SDK' + export JAVA_HOME='/c/PROGRA~1/Unity/Hub/Editor/6000.0.37f1/Editor/Data/PlaybackEngines/AndroidPlayer/OpenJDK' + export ANDROID_SDK_ROOT='/c/PROGRA~1/Unity/Hub/Editor/6000.0.37f1/Editor/Data/PlaybackEngines/AndroidPlayer/SDK' export PATH=$ANDROID_SDK_ROOT/platform-tools:$ANDROID_SDK_ROOT/tools:$ANDROID_SDK_ROOT/tools/bin:$JAVA_HOME/bin:$PATH ;; esac @@ -22,14 +22,14 @@ DEST_DIR='../../build/Packager/Assets/Plugins/Android' if [ ! -d "$JAVA_HOME" ] then echo 'Looking for Java Home' - echo 'From Unity Hub, please install 2022.3.32f1 with the android module.' + echo 'From Unity Hub, please install 6000.0.37f1 with the android module.' exit 1 fi # options TARGET="webview" MODE="Release" -UNITY="2022.3.32f1" +UNITY="6000.0.37f1" for OPT in $* do case $OPT in @@ -40,7 +40,7 @@ do MODE="Development" ;; '--zorderpatch') - UNITY='2022.3.32f1' + UNITY='6000.0.37f1' ;; *) cat < apps = pm.queryIntentActivities(intent, 0); // if (apps.size() > 0) { // view.getContext().startActivity(intent); @@ -475,6 +511,27 @@ public boolean shouldOverrideUrlLoading(WebView view, String url) { } return true; } + + private void launchMarket(Context context, Intent intent) { + if (intent == null) { + return; + } + String packageName = intent.getPackage(); + if (packageName == null) { + return; + } + // cf. https://stackoverflow.com/questions/11753000/how-to-open-the-google-play-store-directly-from-my-android-application/11753070#11753070 + try { + intent = new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + packageName)); + context.startActivity(intent); + } catch (android.content.ActivityNotFoundException ex) { + try { + intent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id=" + packageName)); + context.startActivity(intent); + } catch (android.content.ActivityNotFoundException ex2) { + } + } + } }); webView.addJavascriptInterface(mWebViewPlugin , "Unity"); diff --git a/plugins/Android/webview/src/main/java/net/gree/unitywebview/CUnityPlayer.java b/plugins/Android/webview/src/main/java/net/gree/unitywebview/CUnityPlayer.java deleted file mode 100644 index c3f8e613..00000000 --- a/plugins/Android/webview/src/main/java/net/gree/unitywebview/CUnityPlayer.java +++ /dev/null @@ -1,21 +0,0 @@ -package net.gree.unitywebview; - -import com.unity3d.player.*; -import android.content.ContextWrapper; -import android.view.SurfaceView; -import android.view.View; - -public class CUnityPlayer - extends UnityPlayer -{ - public CUnityPlayer(ContextWrapper contextwrapper) { - super(contextwrapper); - } - - public void addView(View child) { - if (child instanceof SurfaceView) { - ((SurfaceView)child).setZOrderOnTop(false); - } - super.addView(child); - } -} diff --git a/plugins/Android/webview/src/main/java/net/gree/unitywebview/CUnityPlayerActivity.java b/plugins/Android/webview/src/main/java/net/gree/unitywebview/CUnityPlayerActivity.java index 983e71a1..fef01875 100644 --- a/plugins/Android/webview/src/main/java/net/gree/unitywebview/CUnityPlayerActivity.java +++ b/plugins/Android/webview/src/main/java/net/gree/unitywebview/CUnityPlayerActivity.java @@ -21,7 +21,7 @@ public class CUnityPlayerActivity extends Activity implements IUnityPlayerLifecycleEvents { public static CUnityPlayerActivity GlobalUnityActivity = null; - protected UnityPlayer mUnityPlayer; // don't change the name of this variable; referenced from native code + protected UnityPlayerForActivityOrService mUnityPlayer; // don't change the name of this variable; referenced from native code // Override this in your custom UnityPlayerActivity to tweak the command line arguments passed to the Unity Android Player // The command line arguments are passed as a string, separated by spaces @@ -56,11 +56,11 @@ public void ResumeUnityPlayer(){ String cmdLine = updateUnityCommandLineArguments(getIntent().getStringExtra("unity")); getIntent().putExtra("unity", cmdLine); - mUnityPlayer = new UnityPlayer(this); + mUnityPlayer = new UnityPlayerForActivityOrService(this); CUnityPlayerActivity.GlobalUnityActivity = this; - setContentView(mUnityPlayer); - mUnityPlayer.requestFocus(); + setContentView(mUnityPlayer.getFrameLayout()); + mUnityPlayer.getFrameLayout().requestFocus(); } // When Unity player unloaded move task to background @@ -108,7 +108,7 @@ public void ResumeUnityPlayer(){ @Override public void onLowMemory() { super.onLowMemory(); - mUnityPlayer.lowMemory(); + mUnityPlayer.onTrimMemory(UnityPlayerForActivityOrService.MemoryUsage.Critical); } // Trim Memory Unity @@ -117,7 +117,7 @@ public void ResumeUnityPlayer(){ super.onTrimMemory(level); if (level == TRIM_MEMORY_RUNNING_CRITICAL) { - mUnityPlayer.lowMemory(); + mUnityPlayer.onTrimMemory(UnityPlayerForActivityOrService.MemoryUsage.Critical); } } diff --git a/plugins/Android/webview/src/main/java/net/gree/unitywebview/CWebViewPlugin.java b/plugins/Android/webview/src/main/java/net/gree/unitywebview/CWebViewPlugin.java index 8d70aeb7..fd411a82 100644 --- a/plugins/Android/webview/src/main/java/net/gree/unitywebview/CWebViewPlugin.java +++ b/plugins/Android/webview/src/main/java/net/gree/unitywebview/CWebViewPlugin.java @@ -75,6 +75,7 @@ import java.io.IOException; import java.io.OutputStream; import java.net.HttpURLConnection; +import java.net.URISyntaxException; import java.net.URL; import java.net.URLEncoder; import java.text.SimpleDateFormat; @@ -189,6 +190,29 @@ public class CWebViewPlugin extends Fragment { private String mBasicAuthUserName; private String mBasicAuthPassword; + // cf. https://chromium.googlesource.com/chromium/src/+/3e5a94daf32200d65dea6072dd4d1b9a2025508b/components/external_intents/android/java/src/org/chromium/components/external_intents/ExternalNavigationHandler.java#121 + private static final int ALLOWED_INTENT_FLAGS + = Intent.FLAG_EXCLUDE_STOPPED_PACKAGES + | Intent.FLAG_ACTIVITY_CLEAR_TOP + | Intent.FLAG_ACTIVITY_SINGLE_TOP + | Intent.FLAG_ACTIVITY_MATCH_EXTERNAL + | Intent.FLAG_ACTIVITY_NEW_TASK + | Intent.FLAG_ACTIVITY_MULTIPLE_TASK + | Intent.FLAG_ACTIVITY_NEW_DOCUMENT + | Intent.FLAG_ACTIVITY_RETAIN_IN_RECENTS + | Intent.FLAG_ACTIVITY_LAUNCH_ADJACENT; + + // cf. https://chromium.googlesource.com/chromium/src/+/3e5a94daf32200d65dea6072dd4d1b9a2025508b/components/external_intents/android/java/src/org/chromium/components/external_intents/ExternalNavigationHandler.java#1808 + private static void sanitizeQueryIntentActivitiesIntent(Intent intent) { + intent.setFlags(intent.getFlags() & ALLOWED_INTENT_FLAGS); + intent.addCategory(Intent.CATEGORY_BROWSABLE); + intent.setComponent(null); + + // Intent Selectors allow intents to bypass the intent filter and potentially send apps URIs + // they were not expecting to handle. https://crbug.com/1254422 + intent.setSelector(null); + } + public void SaveDataURL(final String fileName, final String dataURL) { if (!dataURL.startsWith("data:")) { return; @@ -764,6 +788,18 @@ public boolean shouldOverrideUrlLoading(WebView view, String url) { mWebViewPlugin.call("CallOnStarted", url); // Let webview handle the URL return false; + } else if (url.startsWith("intent://") || url.startsWith("android-app://")) { + Intent intent = null; + try { + intent = Intent.parseUri(url, Intent.URI_INTENT_SCHEME); + // cf. https://www.m3tech.blog/entry/android-webview-intent-scheme + sanitizeQueryIntentActivitiesIntent(intent); + view.getContext().startActivity(intent); + } catch (URISyntaxException ex) { + } catch (ActivityNotFoundException ex) { + launchMarket(view.getContext(), intent); + } + return true; } Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); // PackageManager pm = a.getPackageManager(); @@ -777,6 +813,27 @@ public boolean shouldOverrideUrlLoading(WebView view, String url) { } return true; } + + private void launchMarket(Context context, Intent intent) { + if (intent == null) { + return; + } + String packageName = intent.getPackage(); + if (packageName == null) { + return; + } + // cf. https://stackoverflow.com/questions/11753000/how-to-open-the-google-play-store-directly-from-my-android-application/11753070#11753070 + try { + intent = new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + packageName)); + context.startActivity(intent); + } catch (android.content.ActivityNotFoundException ex) { + try { + intent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id=" + packageName)); + context.startActivity(intent); + } catch (android.content.ActivityNotFoundException ex2) { + } + } + } }); webView.addJavascriptInterface(mWebViewPlugin , "Unity"); diff --git a/plugins/WebGLTemplates/unity-webview-2020/unity-webview.js b/plugins/WebGLTemplates/unity-webview-2020/unity-webview.js index d5063389..6a9c777f 100644 --- a/plugins/WebGLTemplates/unity-webview-2020/unity-webview.js +++ b/plugins/WebGLTemplates/unity-webview-2020/unity-webview.js @@ -24,8 +24,6 @@ var unityWebView = if (href.substr(0, 6) === 'unity:') { unityInstance.SendMessage(name, "CallFromJS", href.substring(6, href.length)); e.preventDefault(); - } else { - w.location.replace(href); } }); diff --git a/plugins/WebGLTemplates/unity-webview/unity-webview.js b/plugins/WebGLTemplates/unity-webview/unity-webview.js index 44dba393..64f473c0 100644 --- a/plugins/WebGLTemplates/unity-webview/unity-webview.js +++ b/plugins/WebGLTemplates/unity-webview/unity-webview.js @@ -24,8 +24,6 @@ var unityWebView = if (href.substr(0, 6) === 'unity:') { unityInstance.SendMessage(name, "CallFromJS", href.substring(6, href.length)); e.preventDefault(); - } else { - w.location.replace(href); } }); diff --git a/plugins/WebViewObject.cs b/plugins/WebViewObject.cs index ef99e605..1db669df 100644 --- a/plugins/WebViewObject.cs +++ b/plugins/WebViewObject.cs @@ -626,7 +626,7 @@ public bool IsInitialized() #if UNITY_WEBPLAYER || UNITY_WEBGL //TODO: UNSUPPORTED return true; -#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX +#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX || UNITY_SERVER //TODO: UNSUPPORTED return true; #elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX || UNITY_IPHONE @@ -680,7 +680,7 @@ public void Init( #endif #elif UNITY_WEBPLAYER Application.ExternalCall("unityWebView.init", name); -#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX +#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX || UNITY_SERVER //TODO: UNSUPPORTED Debug.LogError("Webview is not supported on this platform."); #elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX @@ -732,7 +732,7 @@ protected virtual void OnDestroy() #endif #elif UNITY_WEBPLAYER Application.ExternalCall("unityWebView.destroy", name); -#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX +#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX || UNITY_SERVER //TODO: UNSUPPORTED #elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX if (bg != null) { @@ -761,7 +761,7 @@ public void Pause() { #if UNITY_WEBPLAYER || UNITY_WEBGL //TODO: UNSUPPORTED -#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX +#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX || UNITY_SERVER //TODO: UNSUPPORTED #elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX //TODO: UNSUPPORTED @@ -781,7 +781,7 @@ public void Resume() { #if UNITY_WEBPLAYER || UNITY_WEBGL //TODO: UNSUPPORTED -#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX +#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX || UNITY_SERVER //TODO: UNSUPPORTED #elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX //TODO: UNSUPPORTED @@ -801,7 +801,7 @@ public void SetCenterPositionWithScale(Vector2 center, Vector2 scale) { #if UNITY_WEBPLAYER || UNITY_WEBGL //TODO: UNSUPPORTED -#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX +#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX || UNITY_SERVER //TODO: UNSUPPORTED #else float left = (Screen.width - scale.x) / 2.0f + center.x; @@ -814,7 +814,7 @@ public void SetCenterPositionWithScale(Vector2 center, Vector2 scale) public void SetMargins(int left, int top, int right, int bottom, bool relative = false) { -#if UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX +#if UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX || UNITY_SERVER //TODO: UNSUPPORTED return; #elif UNITY_WEBPLAYER || UNITY_WEBGL @@ -835,7 +835,7 @@ public void SetMargins(int left, int top, int right, int bottom, bool relative = mMarginBottom = bottom; mMarginRelative = relative; float ml, mt, mr, mb; -#if UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX +#if UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX || UNITY_SERVER //TODO: UNSUPPORTED #elif UNITY_WEBPLAYER || UNITY_WEBGL ml = left; @@ -913,7 +913,7 @@ public void SetMargins(int left, int top, int right, int bottom, bool relative = mMarginBottomComputed = mb; mMarginRelativeComputed = r; -#if UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX +#if UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX || UNITY_SERVER //TODO: UNSUPPORTED #elif UNITY_WEBPLAYER Application.ExternalCall("unityWebView.setMargins", name, (int)ml, (int)mt, (int)mr, (int)mb); @@ -950,7 +950,7 @@ public void SetVisibility(bool v) #endif #elif UNITY_WEBPLAYER Application.ExternalCall("unityWebView.setVisibility", name, v); -#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX +#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX || UNITY_SERVER //TODO: UNSUPPORTED #elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX if (webView == IntPtr.Zero) @@ -1087,7 +1087,7 @@ public bool SetURLPattern(string allowPattern, string denyPattern, string hookPa #if UNITY_WEBPLAYER || UNITY_WEBGL //TODO: UNSUPPORTED return false; -#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX +#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX || UNITY_SERVER //TODO: UNSUPPORTED return false; #elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX || UNITY_IPHONE @@ -1111,7 +1111,7 @@ public void LoadURL(string url) #endif #elif UNITY_WEBPLAYER Application.ExternalCall("unityWebView.loadURL", name, url); -#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX +#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX || UNITY_SERVER //TODO: UNSUPPORTED #elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX || UNITY_IPHONE if (webView == IntPtr.Zero) @@ -1132,7 +1132,7 @@ public void LoadHTML(string html, string baseUrl) baseUrl = ""; #if UNITY_WEBPLAYER || UNITY_WEBGL //TODO: UNSUPPORTED -#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX +#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX || UNITY_SERVER //TODO: UNSUPPORTED #elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX || UNITY_IPHONE if (webView == IntPtr.Zero) @@ -1153,7 +1153,7 @@ public void EvaluateJS(string js) #endif #elif UNITY_WEBPLAYER Application.ExternalCall("unityWebView.evaluateJS", name, js); -#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX +#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX || UNITY_SERVER //TODO: UNSUPPORTED #elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX || UNITY_IPHONE if (webView == IntPtr.Zero) @@ -1171,7 +1171,7 @@ public int Progress() #if UNITY_WEBPLAYER || UNITY_WEBGL //TODO: UNSUPPORTED return 0; -#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX +#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX || UNITY_SERVER //TODO: UNSUPPORTED return 0; #elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX || UNITY_IPHONE @@ -1190,7 +1190,7 @@ public bool CanGoBack() #if UNITY_WEBPLAYER || UNITY_WEBGL //TODO: UNSUPPORTED return false; -#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX +#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX || UNITY_SERVER //TODO: UNSUPPORTED return false; #elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX || UNITY_IPHONE @@ -1209,7 +1209,7 @@ public bool CanGoForward() #if UNITY_WEBPLAYER || UNITY_WEBGL //TODO: UNSUPPORTED return false; -#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX +#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX || UNITY_SERVER //TODO: UNSUPPORTED return false; #elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX || UNITY_IPHONE @@ -1227,7 +1227,7 @@ public void GoBack() { #if UNITY_WEBPLAYER || UNITY_WEBGL //TODO: UNSUPPORTED -#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX +#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX || UNITY_SERVER //TODO: UNSUPPORTED #elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX || UNITY_IPHONE if (webView == IntPtr.Zero) @@ -1244,7 +1244,7 @@ public void GoForward() { #if UNITY_WEBPLAYER || UNITY_WEBGL //TODO: UNSUPPORTED -#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX +#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX || UNITY_SERVER //TODO: UNSUPPORTED #elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX || UNITY_IPHONE if (webView == IntPtr.Zero) @@ -1261,7 +1261,7 @@ public void Reload() { #if UNITY_WEBPLAYER || UNITY_WEBGL //TODO: UNSUPPORTED -#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX +#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX || UNITY_SERVER //TODO: UNSUPPORTED #elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX || UNITY_IPHONE if (webView == IntPtr.Zero) @@ -1348,7 +1348,7 @@ public void AddCustomHeader(string headerKey, string headerValue) { #if UNITY_WEBPLAYER || UNITY_WEBGL //TODO: UNSUPPORTED -#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX +#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX || UNITY_SERVER //TODO: UNSUPPORTED #elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX || UNITY_IPHONE if (webView == IntPtr.Zero) @@ -1366,7 +1366,7 @@ public string GetCustomHeaderValue(string headerKey) #if UNITY_WEBPLAYER || UNITY_WEBGL //TODO: UNSUPPORTED return null; -#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX +#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX || UNITY_SERVER //TODO: UNSUPPORTED return null; #elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX || UNITY_IPHONE @@ -1383,7 +1383,7 @@ public string GetCustomHeaderValue(string headerKey) public void RemoveCustomHeader(string headerKey) { #if UNITY_WEBPLAYER || UNITY_WEBGL -#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX +#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX || UNITY_SERVER #elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX || UNITY_IPHONE if (webView == IntPtr.Zero) return; @@ -1399,7 +1399,7 @@ public void ClearCustomHeader() { #if UNITY_WEBPLAYER || UNITY_WEBGL //TODO: UNSUPPORTED -#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX +#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX || UNITY_SERVER //TODO: UNSUPPORTED #elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX || UNITY_IPHONE if (webView == IntPtr.Zero) @@ -1416,7 +1416,7 @@ public void ClearCookies() { #if UNITY_WEBPLAYER || UNITY_WEBGL //TODO: UNSUPPORTED -#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX +#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX || UNITY_SERVER //TODO: UNSUPPORTED #elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX || UNITY_IPHONE if (webView == IntPtr.Zero) @@ -1434,7 +1434,7 @@ public void SaveCookies() { #if UNITY_WEBPLAYER || UNITY_WEBGL //TODO: UNSUPPORTED -#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX +#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX || UNITY_SERVER //TODO: UNSUPPORTED #elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX || UNITY_IPHONE if (webView == IntPtr.Zero) @@ -1452,7 +1452,7 @@ public void GetCookies(string url) { #if UNITY_WEBPLAYER || UNITY_WEBGL //TODO: UNSUPPORTED -#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX +#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX || UNITY_SERVER //TODO: UNSUPPORTED #elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX || UNITY_IPHONE if (webView == IntPtr.Zero) @@ -1471,7 +1471,7 @@ public void SetBasicAuthInfo(string userName, string password) { #if UNITY_WEBPLAYER || UNITY_WEBGL //TODO: UNSUPPORTED -#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX +#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX || UNITY_SERVER //TODO: UNSUPPORTED #elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX //TODO: UNSUPPORTED @@ -1490,7 +1490,7 @@ public void ClearCache(bool includeDiskFiles) { #if UNITY_WEBPLAYER || UNITY_WEBGL //TODO: UNSUPPORTED -#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX +#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX || UNITY_SERVER //TODO: UNSUPPORTED #elif UNITY_IPHONE && !UNITY_EDITOR if (webView == IntPtr.Zero) @@ -1508,7 +1508,7 @@ public void SetTextZoom(int textZoom) { #if UNITY_WEBPLAYER || UNITY_WEBGL //TODO: UNSUPPORTED -#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX +#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX || UNITY_SERVER //TODO: UNSUPPORTED #elif UNITY_IPHONE && !UNITY_EDITOR //TODO: UNSUPPORTED @@ -1523,7 +1523,7 @@ public void SetMixedContentMode(int mode) // 0: MIXED_CONTENT_ALWAYS_ALLOW, 1: { #if UNITY_WEBPLAYER || UNITY_WEBGL //TODO: UNSUPPORTED -#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX +#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX || UNITY_SERVER //TODO: UNSUPPORTED #elif UNITY_IPHONE && !UNITY_EDITOR //TODO: UNSUPPORTED diff --git a/plugins/iOS/WebView.mm b/plugins/iOS/WebView.mm index 4620012e..c1afed3d 100644 --- a/plugins/iOS/WebView.mm +++ b/plugins/iOS/WebView.mm @@ -267,6 +267,12 @@ - (id)initWithGameObjectName:(const char *)gameObjectName_ transparent:(BOOL)tra [view addSubview:webView]; + //set webview for Unity 6 accessibility hierarchy + NSMutableArray *accessibilityElements + = view.accessibilityElements ? [view.accessibilityElements mutableCopy] : [NSMutableArray array]; + [accessibilityElements addObject:(UIAccessibilityElement *)webView]; + view.accessibilityElements = accessibilityElements; + return self; } @@ -284,6 +290,13 @@ - (void)dispose [webView0 stopLoading]; [webView0 removeFromSuperview]; [webView0 removeObserver:self forKeyPath:@"loading"]; + + //remove the WebViewObject from Unity hierarchy tree + UIView *view = UnityGetGLViewController().view; + NSMutableArray *accessibilityElements + = view.accessibilityElements ? [view.accessibilityElements mutableCopy] : [NSMutableArray array]; + [accessibilityElements removeObject: (UIAccessibilityElement *)webView0]; + view.accessibilityElements = accessibilityElements; } basicAuthPassword = nil; basicAuthUserName = nil;