Skip to content

Commit

Permalink
updated binaries.
Browse files Browse the repository at this point in the history
  • Loading branch information
KojiNakamaru committed Mar 11, 2023
1 parent 7022ed4 commit 8c97267
Show file tree
Hide file tree
Showing 14 changed files with 46 additions and 4 deletions.
Binary file modified dist/package-nofragment/Assets/Plugins/Android/WebViewPlugin.aar
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ public void OnPostGenerateGradleAndroidProject(string basePath) {
}
}
}
changed = (androidManifest.SetApplicationTheme("@style/UnityThemeSelector") || changed);
changed = (androidManifest.SetActivityTheme("@style/UnityThemeSelector.Translucent") || changed);
changed = (androidManifest.SetHardwareAccelerated(true) || changed);
#if UNITYWEBVIEW_ANDROID_USES_CLEARTEXT_TRAFFIC
changed = (androidManifest.SetUsesCleartextTraffic(true) || changed);
Expand Down Expand Up @@ -294,6 +296,25 @@ internal bool SetUsesCleartextTraffic(bool enabled) {
return changed;
}

internal bool SetApplicationTheme(string theme) {
bool changed = false;
if (ApplicationElement.GetAttribute("theme", AndroidXmlNamespace) != theme) {
ApplicationElement.SetAttribute("theme", AndroidXmlNamespace, theme);
changed = true;
}
return changed;
}

internal bool SetActivityTheme(string theme) {
bool changed = false;
var activity = GetActivityWithLaunchIntent() as XmlElement;
if (activity.GetAttribute("theme", AndroidXmlNamespace) != theme) {
activity.SetAttribute("theme", AndroidXmlNamespace, theme);
changed = true;
}
return changed;
}

internal bool SetHardwareAccelerated(bool enabled) {
bool changed = false;
var activity = GetActivityWithLaunchIntent() as XmlElement;
Expand Down
Binary file not shown.
2 changes: 1 addition & 1 deletion dist/package-nofragment/Assets/Plugins/iOS/WebView.mm
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ - (id)initWithGameObjectName:(const char *)gameObjectName_ transparent:(BOOL)tra

[webView addObserver:self forKeyPath: @"loading" options: NSKeyValueObservingOptionNew context:nil];

[view addSubview:webView];
[view.superview insertSubview:webView atIndex:0];

return self;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ - (id)initWithGameObjectName:(const char *)gameObjectName_ transparent:(BOOL)tra

[webView addObserver:self forKeyPath: @"loading" options: NSKeyValueObservingOptionNew context:nil];

[view addSubview:webView];
[view.superview insertSubview:webView atIndex:0];

return self;
}
Expand Down
Binary file modified dist/package/Assets/Plugins/Android/WebViewPlugin.aar
Binary file not shown.
21 changes: 21 additions & 0 deletions dist/package/Assets/Plugins/Editor/UnityWebViewPostprocessBuild.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ public void OnPostGenerateGradleAndroidProject(string basePath) {
}
}
}
changed = (androidManifest.SetApplicationTheme("@style/UnityThemeSelector") || changed);
changed = (androidManifest.SetActivityTheme("@style/UnityThemeSelector.Translucent") || changed);
changed = (androidManifest.SetHardwareAccelerated(true) || changed);
#if UNITYWEBVIEW_ANDROID_USES_CLEARTEXT_TRAFFIC
changed = (androidManifest.SetUsesCleartextTraffic(true) || changed);
Expand Down Expand Up @@ -294,6 +296,25 @@ internal bool SetUsesCleartextTraffic(bool enabled) {
return changed;
}

internal bool SetApplicationTheme(string theme) {
bool changed = false;
if (ApplicationElement.GetAttribute("theme", AndroidXmlNamespace) != theme) {
ApplicationElement.SetAttribute("theme", AndroidXmlNamespace, theme);
changed = true;
}
return changed;
}

internal bool SetActivityTheme(string theme) {
bool changed = false;
var activity = GetActivityWithLaunchIntent() as XmlElement;
if (activity.GetAttribute("theme", AndroidXmlNamespace) != theme) {
activity.SetAttribute("theme", AndroidXmlNamespace, theme);
changed = true;
}
return changed;
}

internal bool SetHardwareAccelerated(bool enabled) {
bool changed = false;
var activity = GetActivityWithLaunchIntent() as XmlElement;
Expand Down
Binary file not shown.
2 changes: 1 addition & 1 deletion dist/package/Assets/Plugins/iOS/WebView.mm
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ - (id)initWithGameObjectName:(const char *)gameObjectName_ transparent:(BOOL)tra

[webView addObserver:self forKeyPath: @"loading" options: NSKeyValueObservingOptionNew context:nil];

[view addSubview:webView];
[view.superview insertSubview:webView atIndex:0];

return self;
}
Expand Down
2 changes: 1 addition & 1 deletion dist/package/Assets/Plugins/iOS/WebViewWithUIWebView.mm
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ - (id)initWithGameObjectName:(const char *)gameObjectName_ transparent:(BOOL)tra

[webView addObserver:self forKeyPath: @"loading" options: NSKeyValueObservingOptionNew context:nil];

[view addSubview:webView];
[view.superview insertSubview:webView atIndex:0];

return self;
}
Expand Down
Binary file modified dist/unity-webview-nofragment.unitypackage
Binary file not shown.
Binary file modified dist/unity-webview-nofragment.zip
Binary file not shown.
Binary file modified dist/unity-webview.unitypackage
Binary file not shown.
Binary file modified dist/unity-webview.zip
Binary file not shown.

0 comments on commit 8c97267

Please sign in to comment.