From f6a6b4a66b0e59bbe462474be21ed224e14cb640 Mon Sep 17 00:00:00 2001 From: Lorenzo Pichilli Date: Mon, 22 Jun 2020 00:07:12 +0200 Subject: [PATCH] v3.4.0 --- CHANGELOG.md | 2 +- android/build.gradle | 2 +- .../InAppWebView/InAppWebViewClient.java | 6 +++++- example/.flutter-plugins-dependencies | 2 +- example/android/app/build.gradle | 4 ++-- example/ios/Flutter/flutter_export_environment.sh | 3 ++- example/lib/in_app_webiew_example.screen.dart | 14 +++++++------- example/test_driver/.env.dart | 2 +- 8 files changed, 20 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 302de33d..6c98fa8e 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,7 @@ - Added `animated` option to `scrollTo` and `scrollBy` webview methods - Added error and message to the `ServerTrustChallenge` class for iOS (class used by the `onReceivedServerTrustAuthRequest` event) - Added `contentInsetAdjustmentBehavior` webview iOS-specific option -- Added `copy` methods for webview class options +- Added `copy` methods for webview options class - Added `SslCertificate` class and `X509Certificate` class and parser - Added `values` property for all the custom Enums - Updated Android workaround to hide the Keyboard when the user click outside on something not focusable such as input or a textarea. diff --git a/android/build.gradle b/android/build.gradle index 338d0102..b93d2876 100755 --- a/android/build.gradle +++ b/android/build.gradle @@ -22,7 +22,7 @@ rootProject.allprojects { apply plugin: 'com.android.library' android { - compileSdkVersion 29 + compileSdkVersion 30 defaultConfig { minSdkVersion 17 diff --git a/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/InAppWebView/InAppWebViewClient.java b/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/InAppWebView/InAppWebViewClient.java index 3d4c5416..b26670dc 100755 --- a/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/InAppWebView/InAppWebViewClient.java +++ b/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/InAppWebView/InAppWebViewClient.java @@ -253,7 +253,9 @@ public class InAppWebViewClient extends WebViewClient { @Override public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) { - super.onReceivedError(view, errorCode, description, failingUrl); +// // Used to show instantly a custom error page +// view.stopLoading(); +// view.loadUrl("about:blank"); ((inAppBrowserActivity != null) ? inAppBrowserActivity.webView : flutterWebView.webView).isLoading = false; previousAuthRequestFailureCount = 0; @@ -266,6 +268,8 @@ public class InAppWebViewClient extends WebViewClient { obj.put("code", errorCode); obj.put("message", description); channel.invokeMethod("onLoadError", obj); + + super.onReceivedError(view, errorCode, description, failingUrl); } @RequiresApi(api = Build.VERSION_CODES.M) diff --git a/example/.flutter-plugins-dependencies b/example/.flutter-plugins-dependencies index d811a670..9267504a 100755 --- a/example/.flutter-plugins-dependencies +++ b/example/.flutter-plugins-dependencies @@ -1 +1 @@ -{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"e2e","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/e2e-0.2.4+4/","dependencies":[]},{"name":"flutter_downloader","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_downloader-1.4.4/","dependencies":[]},{"name":"flutter_inappwebview","path":"/Users/lorenzopichilli/Desktop/flutter_inappwebview/","dependencies":[]},{"name":"path_provider","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider-1.6.10/","dependencies":[]},{"name":"permission_handler","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/permission_handler-5.0.1/","dependencies":[]}],"android":[{"name":"e2e","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/e2e-0.2.4+4/","dependencies":[]},{"name":"flutter_downloader","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_downloader-1.4.4/","dependencies":[]},{"name":"flutter_inappwebview","path":"/Users/lorenzopichilli/Desktop/flutter_inappwebview/","dependencies":[]},{"name":"path_provider","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider-1.6.10/","dependencies":[]},{"name":"permission_handler","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/permission_handler-5.0.1/","dependencies":[]}],"macos":[{"name":"path_provider_macos","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_macos-0.0.4+3/","dependencies":[]}],"linux":[{"name":"path_provider_linux","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_linux-0.0.1+1/","dependencies":[]}],"windows":[],"web":[]},"dependencyGraph":[{"name":"e2e","dependencies":[]},{"name":"flutter_downloader","dependencies":[]},{"name":"flutter_inappwebview","dependencies":[]},{"name":"path_provider","dependencies":["path_provider_macos","path_provider_linux"]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_macos","dependencies":[]},{"name":"permission_handler","dependencies":[]}],"date_created":"2020-06-18 15:48:06.962625","version":"1.17.3"} \ No newline at end of file +{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"e2e","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/e2e-0.2.4+4/","dependencies":[]},{"name":"flutter_downloader","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_downloader-1.4.4/","dependencies":[]},{"name":"flutter_inappwebview","path":"/Users/lorenzopichilli/Desktop/flutter_inappwebview/","dependencies":[]},{"name":"path_provider","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider-1.6.10/","dependencies":[]},{"name":"permission_handler","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/permission_handler-5.0.1/","dependencies":[]}],"android":[{"name":"e2e","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/e2e-0.2.4+4/","dependencies":[]},{"name":"flutter_downloader","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_downloader-1.4.4/","dependencies":[]},{"name":"flutter_inappwebview","path":"/Users/lorenzopichilli/Desktop/flutter_inappwebview/","dependencies":[]},{"name":"path_provider","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider-1.6.10/","dependencies":[]},{"name":"permission_handler","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/permission_handler-5.0.1/","dependencies":[]}],"macos":[{"name":"path_provider_macos","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_macos-0.0.4+3/","dependencies":[]}],"linux":[{"name":"path_provider_linux","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_linux-0.0.1+1/","dependencies":[]}],"windows":[],"web":[]},"dependencyGraph":[{"name":"e2e","dependencies":[]},{"name":"flutter_downloader","dependencies":[]},{"name":"flutter_inappwebview","dependencies":[]},{"name":"path_provider","dependencies":["path_provider_macos","path_provider_linux"]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_macos","dependencies":[]},{"name":"permission_handler","dependencies":[]}],"date_created":"2020-06-22 00:03:09.205244","version":"1.17.4"} \ No newline at end of file diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle index 778cf26c..f745f672 100755 --- a/example/android/app/build.gradle +++ b/example/android/app/build.gradle @@ -30,7 +30,7 @@ android { targetCompatibility 1.8 } - compileSdkVersion 28 + compileSdkVersion 30 lintOptions { disable 'InvalidPackage' @@ -40,7 +40,7 @@ android { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId "com.pichillilorenzo.flutter_inappwebviewexample" minSdkVersion 17 - targetSdkVersion 28 + targetSdkVersion 30 versionCode flutterVersionCode.toInteger() versionName flutterVersionName testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" diff --git a/example/ios/Flutter/flutter_export_environment.sh b/example/ios/Flutter/flutter_export_environment.sh index 4882a9e9..2dce6e0f 100755 --- a/example/ios/Flutter/flutter_export_environment.sh +++ b/example/ios/Flutter/flutter_export_environment.sh @@ -2,10 +2,11 @@ # This is a generated file; do not edit or check into version control. export "FLUTTER_ROOT=/Users/lorenzopichilli/flutter" export "FLUTTER_APPLICATION_PATH=/Users/lorenzopichilli/Desktop/flutter_inappwebview/example" -export "FLUTTER_TARGET=lib/main.dart" +export "FLUTTER_TARGET=/Users/lorenzopichilli/Desktop/flutter_inappwebview/example/test_driver/app.dart" export "FLUTTER_BUILD_DIR=build" export "SYMROOT=${SOURCE_ROOT}/../build/ios" export "OTHER_LDFLAGS=$(inherited) -framework Flutter" export "FLUTTER_FRAMEWORK_DIR=/Users/lorenzopichilli/flutter/bin/cache/artifacts/engine/ios" export "FLUTTER_BUILD_NAME=1.0.0" export "FLUTTER_BUILD_NUMBER=1" +export "TRACK_WIDGET_CREATION=true" diff --git a/example/lib/in_app_webiew_example.screen.dart b/example/lib/in_app_webiew_example.screen.dart index 9ec9e6b5..61893af3 100755 --- a/example/lib/in_app_webiew_example.screen.dart +++ b/example/lib/in_app_webiew_example.screen.dart @@ -26,25 +26,25 @@ class _InAppWebViewExampleScreenState extends State { contextMenu = ContextMenu( menuItems: [ ContextMenuItem(androidId: 1, iosId: "1", title: "Special", action: () async { - //print("Menu item Special clicked!"); + print("Menu item Special clicked!"); print(await webView.getSelectedText()); await webView.clearFocus(); }) ], options: ContextMenuOptions( - hideDefaultSystemContextMenuItems: false + hideDefaultSystemContextMenuItems: true ), onCreateContextMenu: (hitTestResult) async { - //print("onCreateContextMenu"); + print("onCreateContextMenu"); print(hitTestResult.extra); print(await webView.getSelectedText()); }, onHideContextMenu: () { - //print("onHideContextMenu"); + print("onHideContextMenu"); }, onContextMenuActionItemClicked: (contextMenuItemClicked) async { var id = (Platform.isAndroid) ? contextMenuItemClicked.androidId : contextMenuItemClicked.iosId; - // print("onContextMenuActionItemClicked: " + id.toString() + " " + contextMenuItemClicked.title); + print("onContextMenuActionItemClicked: " + id.toString() + " " + contextMenuItemClicked.title); } ); } @@ -80,8 +80,8 @@ class _InAppWebViewExampleScreenState extends State { BoxDecoration(border: Border.all(color: Colors.blueAccent)), child: InAppWebView( contextMenu: contextMenu, - // initialUrl: "https://github.com/flutter", - initialFile: "assets/index.html", + initialUrl: "https://github.com/flutter", + // initialFile: "assets/index.html", initialHeaders: {}, initialOptions: InAppWebViewGroupOptions( crossPlatform: InAppWebViewOptions( diff --git a/example/test_driver/.env.dart b/example/test_driver/.env.dart index 672d39f3..403c309b 100755 --- a/example/test_driver/.env.dart +++ b/example/test_driver/.env.dart @@ -1 +1 @@ -final environment = {"NODE_SERVER_IP":"192.168.1.123"}; \ No newline at end of file +final environment = {"NODE_SERVER_IP":"192.168.1.122"}; \ No newline at end of file