diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml new file mode 100644 index 00000000..a55e7a17 --- /dev/null +++ b/.idea/codeStyles/codeStyleConfig.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/.idea/runConfigurations/example_lib_main_dart.xml b/.idea/runConfigurations/example_lib_main_dart.xml index bac2c8a7..624f56a6 100644 --- a/.idea/runConfigurations/example_lib_main_dart.xml +++ b/.idea/runConfigurations/example_lib_main_dart.xml @@ -1,5 +1,6 @@ + diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 697c2180..c3f13ef6 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -15,38 +15,32 @@ - - + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + @@ -69,29 +63,11 @@ - - - - - - - - - - - - - - - - - - - - + + @@ -100,42 +76,33 @@ - + - - + + - + - + - - - - - - - - - - - + + - + - - + + - + @@ -153,36 +120,36 @@ - CER - ServerTrustChallenge - cONTENTMODE - iOSInAppWebViewUserPreferredContentMode - InAppWebViewUserPreferredContentMode - serverCertificate - onReceivedHttpAuthRequest - preferredContentMode - print - ConsoleMessageLevel - onConsoleMessage - _findLocalPath - package - on - findAll - getFave - Uri - != "an - _channel - getHtml - url + toggleErrorInformationPopup + error-information-popup-container + offline-spri + sprite + icon-offline + ICON + loadImages + RESOURCE_TEMPLATE_ID + adjustDimensions + outerContainerEl + ontouch + fromVa + ContentBlockerActionType getOptions - gestureR - _dispose - dispose - Long - custom - scheme - useOnLoadResource - useShouldOverrideUrlLoading + iOS + Ios + initialOptions + initialOpti + Platform + Platform.i + getOption + .toValue + fromValue( + ?.toMap()); + fromMap + setOptions + fromValue + List< + debuggingEnabled + initialOp activity.getPreferences(0) @@ -192,10 +159,12 @@ throwIsNotOpened ChannelManager Function + ?.toMap() ?? {}); $PROJECT_DIR$/example/android $PROJECT_DIR$/lib/src + $PROJECT_DIR$/lib @@ -204,11 +173,6 @@ @@ -269,17 +238,6 @@ - - - - - - - - - + @@ -316,11 +275,6 @@ - - - - - @@ -330,7 +284,7 @@ - + @@ -346,7 +300,8 @@ - + + @@ -356,7 +311,17 @@ + + @@ -372,15 +337,15 @@ - + + - @@ -507,10 +472,11 @@ - + + - - + + @@ -520,7 +486,7 @@ - + @@ -528,13 +494,14 @@ - + - + - + + @@ -549,6 +516,7 @@ @@ -556,151 +524,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -708,16 +531,6 @@ - - - - - - - - - - @@ -743,23 +556,6 @@ - - - - - - - - - - - - - - - - - @@ -790,15 +586,6 @@ - - - - - - - - - @@ -806,49 +593,13 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -856,53 +607,195 @@ - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - + + + + + + + + + + + + + + - - + + - + - - + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - + - - + + - + diff --git a/CHANGELOG.md b/CHANGELOG.md index e18b5148..2ca29898 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,6 +27,7 @@ - Added `onReceivedServerTrustAuthRequest` and `onReceivedClientCertRequest` events to manage SSL requests - Added `onFindResultReceived` event, `findAllAsync`, `findNext` and `clearMatches` methods - Added `getHtml` method +- Fun: added `getTRexRunnerHtml` and `getTRexRunnerCss` methods to get html (with javascript) and css to recreate the Chromium's t-rex runner game ### BREAKING CHANGES - Deleted `WebResourceRequest` class diff --git a/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/ContentBlocker/ContentBlockerHandler.java b/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/ContentBlocker/ContentBlockerHandler.java index 03440094..1863326a 100644 --- a/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/ContentBlocker/ContentBlockerHandler.java +++ b/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/ContentBlocker/ContentBlockerHandler.java @@ -118,7 +118,7 @@ public class ContentBlockerHandler { if (!trigger.ifTopUrl.isEmpty()) { boolean matchFound = false; for (String topUrl : trigger.ifTopUrl) { - if (webViewUrl[0].equals(topUrl)) { + if (webViewUrl[0].startsWith(topUrl)) { matchFound = true; break; } @@ -128,7 +128,7 @@ public class ContentBlockerHandler { } if (!trigger.unlessTopUrl.isEmpty()) { for (String topUrl : trigger.unlessTopUrl) - if (webViewUrl[0].equals(topUrl)) + if (webViewUrl[0].startsWith(topUrl)) return null; } diff --git a/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/InAppWebView/InAppWebView.java b/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/InAppWebView/InAppWebView.java index 33d2bcfa..4b68fe1c 100644 --- a/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/InAppWebView/InAppWebView.java +++ b/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/InAppWebView/InAppWebView.java @@ -387,6 +387,9 @@ final public class InAppWebView extends InputAwareWebView { if (newOptionsMap.get("javaScriptEnabled") != null && options.javaScriptEnabled != newOptions.javaScriptEnabled) settings.setJavaScriptEnabled(newOptions.javaScriptEnabled); + if (newOptionsMap.get("debuggingEnabled") != null && options.debuggingEnabled != newOptions.debuggingEnabled && Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) + setWebContentsDebuggingEnabled(newOptions.debuggingEnabled); + if (newOptionsMap.get("javaScriptCanOpenWindowsAutomatically") != null && options.javaScriptCanOpenWindowsAutomatically != newOptions.javaScriptCanOpenWindowsAutomatically) settings.setJavaScriptCanOpenWindowsAutomatically(newOptions.javaScriptCanOpenWindowsAutomatically); diff --git a/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/InAppWebView/InAppWebViewClient.java b/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/InAppWebView/InAppWebViewClient.java index 7a2053b9..dd761a67 100644 --- a/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/InAppWebView/InAppWebViewClient.java +++ b/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/InAppWebView/InAppWebViewClient.java @@ -639,18 +639,18 @@ public class InAppWebViewClient extends WebViewClient { Log.e(LOG_TAG, flutterResult.error); } else if (flutterResult.result != null) { - Map res = (Map) flutterResult.result; + Map res = (Map) flutterResult.result; WebResourceResponse response = null; try { - response = webView.contentBlockerHandler.checkUrl(webView, url, res.get("content-type")); + response = webView.contentBlockerHandler.checkUrl(webView, url, res.get("content-type").toString()); } catch (Exception e) { e.printStackTrace(); Log.e(LOG_TAG, e.getMessage()); } if (response != null) return response; - byte[] data = Base64.decode(res.get("base64data"), Base64.DEFAULT); - return new WebResourceResponse(res.get("content-type"), res.get("content-encoding"), new ByteArrayInputStream(data)); + byte[] data = (byte[]) res.get("data"); + return new WebResourceResponse(res.get("content-type").toString(), res.get("content-encoding").toString(), new ByteArrayInputStream(data)); } } diff --git a/example/assets/index.html b/example/assets/index.html index 8b81f09b..071da426 100644 --- a/example/assets/index.html +++ b/example/assets/index.html @@ -36,6 +36,11 @@

+ +