Skip to content

Commit f817191

Browse files
authored
Merge pull request #135 from immutable/feat/clear-gree-cache-storage
feat: ability to clear android and ios gree cache and storage
2 parents 1a869c7 + f767c25 commit f817191

File tree

16 files changed

+847
-336
lines changed

16 files changed

+847
-336
lines changed

Plugins/Android/Gree-Android/webview-nofragment/src/main/java/net/gree/unitywebview/CWebViewPluginNoUi.java

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
import android.webkit.WebResourceRequest;
4343
import android.webkit.WebResourceResponse;
4444
import android.webkit.WebSettings;
45+
import android.webkit.WebStorage;
4546
import android.webkit.WebView;
4647
import android.webkit.WebViewClient;
4748

@@ -288,4 +289,32 @@ public void run() {
288289
}
289290
});
290291
}
292+
293+
public void ClearCache(final boolean includeDiskFiles)
294+
{
295+
final Activity a = UnityPlayer.currentActivity;
296+
if (CWebViewPluginNoUi.isDestroyed(a)) {
297+
return;
298+
}
299+
a.runOnUiThread(new Runnable() {public void run() {
300+
if (mWebView == null) {
301+
return;
302+
}
303+
mWebView.clearCache(includeDiskFiles);
304+
}});
305+
}
306+
307+
public void ClearStorage()
308+
{
309+
final Activity a = UnityPlayer.currentActivity;
310+
if (CWebViewPluginNoUi.isDestroyed(a)) {
311+
return;
312+
}
313+
a.runOnUiThread(new Runnable() {public void run() {
314+
if (mWebView == null) {
315+
return;
316+
}
317+
WebStorage.getInstance().deleteAllData();
318+
}});
319+
}
291320
}

0 commit comments

Comments
 (0)