Skip to content

Commit

Permalink
updated binaries.
Browse files Browse the repository at this point in the history
  • Loading branch information
KojiNakamaru committed Jul 17, 2023
1 parent ccc9180 commit 7d3eb1a
Show file tree
Hide file tree
Showing 10 changed files with 62 additions and 4 deletions.
10 changes: 8 additions & 2 deletions dist/package-nofragment/Assets/Plugins/WebViewObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,8 @@ private static extern void _CWebViewPlugin_Reload(
private static extern void _CWebViewPlugin_SetBasicAuthInfo(IntPtr instance, string userName, string password);
[DllImport("__Internal")]
private static extern void _CWebViewPlugin_ClearCache(IntPtr instance, bool includeDiskFiles);
[DllImport("__Internal")]
private static extern void _CWebViewPlugin_SetSuspended(IntPtr instance, bool suspended);
#elif UNITY_WEBGL
[DllImport("__Internal")]
private static extern void _gree_unity_webview_init(string name);
Expand Down Expand Up @@ -670,7 +672,10 @@ public void Pause()
#elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX
//TODO: UNSUPPORTED
#elif UNITY_IPHONE
//TODO: UNSUPPORTED
// NOTE: this suspends media playback only.
if (webView == null)
return;
_CWebViewPlugin_SetSuspended(webView, true);
#elif UNITY_ANDROID
if (webView == null)
return;
Expand All @@ -687,7 +692,8 @@ public void Resume()
#elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX
//TODO: UNSUPPORTED
#elif UNITY_IPHONE
//TODO: UNSUPPORTED
// NOTE: this resumes media playback only.
_CWebViewPlugin_SetSuspended(webView, false);
#elif UNITY_ANDROID
if (webView == null)
return;
Expand Down
18 changes: 18 additions & 0 deletions dist/package-nofragment/Assets/Plugins/iOS/WebView.mm
Original file line number Diff line number Diff line change
Expand Up @@ -925,6 +925,16 @@ - (void)clearCache:(BOOL)includeDiskFiles
NSDate *date = [NSDate dateWithTimeIntervalSince1970:0];
[[WKWebsiteDataStore defaultDataStore] removeDataOfTypes:types modifiedSince:date completionHandler:^{}];
}

- (void)setAllMediaPlaybackSuspended:(BOOL)suspended
{
NSOperatingSystemVersion version = { 15, 0, 0 };
if ([[NSProcessInfo processInfo] isOperatingSystemAtLeastVersion:version]) {
if ([webView isKindOfClass:[WKWebView class]]) {
[(WKWebView *)webView setAllMediaPlaybackSuspended:suspended completionHandler:nil];
}
}
}
@end

extern "C" {
Expand Down Expand Up @@ -956,6 +966,7 @@ void _CWebViewPlugin_SetMargins(
const char *_CWebViewPlugin_GetCustomHeaderValue(void *instance, const char *headerKey);
void _CWebViewPlugin_SetBasicAuthInfo(void *instance, const char *userName, const char *password);
void _CWebViewPlugin_ClearCache(void *instance, BOOL includeDiskFiles);
void _CWebViewPlugin_SetSuspended(void *instance, BOOL suspended);
}

void *_CWebViewPlugin_Init(const char *gameObjectName, BOOL transparent, BOOL zoom, const char *ua, BOOL enableWKWebView, int contentMode, BOOL allowsLinkPreview, BOOL allowsBackForwardNavigationGestures, int radius)
Expand Down Expand Up @@ -1182,4 +1193,11 @@ void _CWebViewPlugin_ClearCache(void *instance, BOOL includeDiskFiles)
[webViewPlugin clearCache:includeDiskFiles];
}

void _CWebViewPlugin_SetSuspended(void *instance, BOOL suspended)
{
if (instance == NULL)
return;
CWebViewPlugin *webViewPlugin = (__bridge CWebViewPlugin *)instance;
[webViewPlugin setAllMediaPlaybackSuspended:suspended];
}
#endif // !(__IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_9_0)
Original file line number Diff line number Diff line change
Expand Up @@ -1059,6 +1059,7 @@ void _CWebViewPlugin_SetMargins(
const char *_CWebViewPlugin_GetCustomHeaderValue(void *instance, const char *headerKey);
void _CWebViewPlugin_SetBasicAuthInfo(void *instance, const char *userName, const char *password);
void _CWebViewPlugin_ClearCache(void *instance, BOOL includeDiskFiles);
void _CWebViewPlugin_SetSuspended(void *instance, BOOL suspended);
}

void *_CWebViewPlugin_Init(const char *gameObjectName, BOOL transparent, BOOL zoom, const char *ua, BOOL enableWKWebView, int contentMode, BOOL allowsLinkPreview, BOOL allowsBackForwardNavigationGestures, int radius)
Expand Down Expand Up @@ -1280,4 +1281,8 @@ void _CWebViewPlugin_ClearCache(void *instance, BOOL includeDiskFiles)
// no op
}

void _CWebViewPlugin_SetSuspended(void *instance, BOOL suspended)
{
// no op
}
#endif // __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_9_0
10 changes: 8 additions & 2 deletions dist/package/Assets/Plugins/WebViewObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,8 @@ private static extern void _CWebViewPlugin_Reload(
private static extern void _CWebViewPlugin_SetBasicAuthInfo(IntPtr instance, string userName, string password);
[DllImport("__Internal")]
private static extern void _CWebViewPlugin_ClearCache(IntPtr instance, bool includeDiskFiles);
[DllImport("__Internal")]
private static extern void _CWebViewPlugin_SetSuspended(IntPtr instance, bool suspended);
#elif UNITY_WEBGL
[DllImport("__Internal")]
private static extern void _gree_unity_webview_init(string name);
Expand Down Expand Up @@ -670,7 +672,10 @@ public void Pause()
#elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX
//TODO: UNSUPPORTED
#elif UNITY_IPHONE
//TODO: UNSUPPORTED
// NOTE: this suspends media playback only.
if (webView == null)
return;
_CWebViewPlugin_SetSuspended(webView, true);
#elif UNITY_ANDROID
if (webView == null)
return;
Expand All @@ -687,7 +692,8 @@ public void Resume()
#elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX
//TODO: UNSUPPORTED
#elif UNITY_IPHONE
//TODO: UNSUPPORTED
// NOTE: this resumes media playback only.
_CWebViewPlugin_SetSuspended(webView, false);
#elif UNITY_ANDROID
if (webView == null)
return;
Expand Down
18 changes: 18 additions & 0 deletions dist/package/Assets/Plugins/iOS/WebView.mm
Original file line number Diff line number Diff line change
Expand Up @@ -925,6 +925,16 @@ - (void)clearCache:(BOOL)includeDiskFiles
NSDate *date = [NSDate dateWithTimeIntervalSince1970:0];
[[WKWebsiteDataStore defaultDataStore] removeDataOfTypes:types modifiedSince:date completionHandler:^{}];
}

- (void)setAllMediaPlaybackSuspended:(BOOL)suspended
{
NSOperatingSystemVersion version = { 15, 0, 0 };
if ([[NSProcessInfo processInfo] isOperatingSystemAtLeastVersion:version]) {
if ([webView isKindOfClass:[WKWebView class]]) {
[(WKWebView *)webView setAllMediaPlaybackSuspended:suspended completionHandler:nil];
}
}
}
@end

extern "C" {
Expand Down Expand Up @@ -956,6 +966,7 @@ void _CWebViewPlugin_SetMargins(
const char *_CWebViewPlugin_GetCustomHeaderValue(void *instance, const char *headerKey);
void _CWebViewPlugin_SetBasicAuthInfo(void *instance, const char *userName, const char *password);
void _CWebViewPlugin_ClearCache(void *instance, BOOL includeDiskFiles);
void _CWebViewPlugin_SetSuspended(void *instance, BOOL suspended);
}

void *_CWebViewPlugin_Init(const char *gameObjectName, BOOL transparent, BOOL zoom, const char *ua, BOOL enableWKWebView, int contentMode, BOOL allowsLinkPreview, BOOL allowsBackForwardNavigationGestures, int radius)
Expand Down Expand Up @@ -1182,4 +1193,11 @@ void _CWebViewPlugin_ClearCache(void *instance, BOOL includeDiskFiles)
[webViewPlugin clearCache:includeDiskFiles];
}

void _CWebViewPlugin_SetSuspended(void *instance, BOOL suspended)
{
if (instance == NULL)
return;
CWebViewPlugin *webViewPlugin = (__bridge CWebViewPlugin *)instance;
[webViewPlugin setAllMediaPlaybackSuspended:suspended];
}
#endif // !(__IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_9_0)
5 changes: 5 additions & 0 deletions dist/package/Assets/Plugins/iOS/WebViewWithUIWebView.mm
Original file line number Diff line number Diff line change
Expand Up @@ -1059,6 +1059,7 @@ void _CWebViewPlugin_SetMargins(
const char *_CWebViewPlugin_GetCustomHeaderValue(void *instance, const char *headerKey);
void _CWebViewPlugin_SetBasicAuthInfo(void *instance, const char *userName, const char *password);
void _CWebViewPlugin_ClearCache(void *instance, BOOL includeDiskFiles);
void _CWebViewPlugin_SetSuspended(void *instance, BOOL suspended);
}

void *_CWebViewPlugin_Init(const char *gameObjectName, BOOL transparent, BOOL zoom, const char *ua, BOOL enableWKWebView, int contentMode, BOOL allowsLinkPreview, BOOL allowsBackForwardNavigationGestures, int radius)
Expand Down Expand Up @@ -1280,4 +1281,8 @@ void _CWebViewPlugin_ClearCache(void *instance, BOOL includeDiskFiles)
// no op
}

void _CWebViewPlugin_SetSuspended(void *instance, BOOL suspended)
{
// no op
}
#endif // __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_9_0
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 7d3eb1a

Please sign in to comment.