From 03a09bffdc376a145c384016c5d08763af135af2 Mon Sep 17 00:00:00 2001 From: Lorenzo Pichilli Date: Mon, 1 Mar 2021 20:24:26 +0100 Subject: [PATCH] fix #696 --- .idea/libraries/Dart_Packages.xml | 738 ------------------ .idea/libraries/Flutter_Plugins.xml | 4 +- CHANGELOG.md | 4 + example/.flutter-plugins-dependencies | 2 +- .../webview_flutter_test.dart | 31 + example/ios/Flutter/Flutter.podspec | 18 + .../ios/Flutter/flutter_export_environment.sh | 7 +- .../lib/headless_in_app_webview.screen.dart | 2 +- flutter_inappwebview.iml | 1 - ios/Classes/InAppWebView/InAppWebView.swift | 1 - pubspec.yaml | 2 +- scripts/publish.sh | 12 + 12 files changed, 75 insertions(+), 747 deletions(-) delete mode 100644 .idea/libraries/Dart_Packages.xml create mode 100644 example/ios/Flutter/Flutter.podspec create mode 100644 scripts/publish.sh diff --git a/.idea/libraries/Dart_Packages.xml b/.idea/libraries/Dart_Packages.xml deleted file mode 100644 index fbbebaa1..00000000 --- a/.idea/libraries/Dart_Packages.xml +++ /dev/null @@ -1,738 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Flutter_Plugins.xml b/.idea/libraries/Flutter_Plugins.xml index 31799730..65bb3679 100755 --- a/.idea/libraries/Flutter_Plugins.xml +++ b/.idea/libraries/Flutter_Plugins.xml @@ -1,6 +1,8 @@ - + + + diff --git a/CHANGELOG.md b/CHANGELOG.md index 7201ab75..2e4a9552 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 5.0.5+1 + +- Fixed "No bounce in inappwebview iOS" [#696](https://github.com/pichillilorenzo/flutter_inappwebview/issues/696) + ## 5.0.5 - Updated Android `WebChromeClient.getDefaultVideoPoster` diff --git a/example/.flutter-plugins-dependencies b/example/.flutter-plugins-dependencies index e0b8fe1f..6b914f7e 100644 --- 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":"flutter_downloader","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_downloader-1.5.2/","dependencies":[]},{"name":"flutter_inappwebview","path":"/Users/lorenzopichilli/Desktop/flutter_inappwebview/","dependencies":[]},{"name":"integration_test","path":"/Users/lorenzopichilli/flutter/packages/integration_test/","dependencies":[]},{"name":"path_provider","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider-2.0.0-nullsafety/","dependencies":[]},{"name":"permission_handler","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/permission_handler-5.1.0+2/","dependencies":[]},{"name":"url_launcher","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-6.0.0-nullsafety.6/","dependencies":[]}],"android":[{"name":"flutter_downloader","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_downloader-1.5.2/","dependencies":[]},{"name":"flutter_inappwebview","path":"/Users/lorenzopichilli/Desktop/flutter_inappwebview/","dependencies":[]},{"name":"integration_test","path":"/Users/lorenzopichilli/flutter/packages/integration_test/","dependencies":[]},{"name":"path_provider","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider-2.0.0-nullsafety/","dependencies":[]},{"name":"permission_handler","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/permission_handler-5.1.0+2/","dependencies":[]},{"name":"url_launcher","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-6.0.0-nullsafety.6/","dependencies":[]}],"macos":[{"name":"path_provider_macos","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_macos-0.0.5-nullsafety/","dependencies":[]},{"name":"url_launcher_macos","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher_macos-0.1.0-nullsafety.2/","dependencies":[]}],"linux":[{"name":"path_provider_linux","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_linux-0.2.0-nullsafety/","dependencies":[]},{"name":"url_launcher_linux","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher_linux-0.1.0-nullsafety.3/","dependencies":[]}],"windows":[{"name":"path_provider_windows","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_windows-0.1.0-nullsafety.3/","dependencies":[]},{"name":"url_launcher_windows","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher_windows-0.1.0-nullsafety.2/","dependencies":[]}],"web":[]},"dependencyGraph":[{"name":"flutter_downloader","dependencies":[]},{"name":"flutter_inappwebview","dependencies":[]},{"name":"integration_test","dependencies":[]},{"name":"path_provider","dependencies":["path_provider_macos","path_provider_linux","path_provider_windows"]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_macos","dependencies":[]},{"name":"path_provider_windows","dependencies":[]},{"name":"permission_handler","dependencies":[]},{"name":"url_launcher","dependencies":["url_launcher_linux","url_launcher_macos","url_launcher_windows"]},{"name":"url_launcher_linux","dependencies":[]},{"name":"url_launcher_macos","dependencies":[]},{"name":"url_launcher_windows","dependencies":[]}],"date_created":"2021-03-01 16:27:58.177175","version":"1.27.0-4.0.pre"} \ No newline at end of file +{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"flutter_downloader","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_downloader-1.5.2/","dependencies":[]},{"name":"flutter_inappwebview","path":"/Users/lorenzopichilli/Desktop/flutter_inappwebview/","dependencies":[]},{"name":"integration_test","path":"/Users/lorenzopichilli/flutter/packages/integration_test/","dependencies":[]},{"name":"path_provider","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider-2.0.0-nullsafety/","dependencies":[]},{"name":"permission_handler","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/permission_handler-5.1.0+2/","dependencies":[]},{"name":"url_launcher","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-6.0.0-nullsafety.6/","dependencies":[]}],"android":[{"name":"flutter_downloader","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_downloader-1.5.2/","dependencies":[]},{"name":"flutter_inappwebview","path":"/Users/lorenzopichilli/Desktop/flutter_inappwebview/","dependencies":[]},{"name":"integration_test","path":"/Users/lorenzopichilli/flutter/packages/integration_test/","dependencies":[]},{"name":"path_provider","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider-2.0.0-nullsafety/","dependencies":[]},{"name":"permission_handler","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/permission_handler-5.1.0+2/","dependencies":[]},{"name":"url_launcher","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-6.0.0-nullsafety.6/","dependencies":[]}],"macos":[{"name":"path_provider_macos","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_macos-0.0.5-nullsafety/","dependencies":[]},{"name":"url_launcher_macos","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher_macos-0.1.0-nullsafety.2/","dependencies":[]}],"linux":[{"name":"path_provider_linux","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_linux-0.2.0-nullsafety/","dependencies":[]},{"name":"url_launcher_linux","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher_linux-0.1.0-nullsafety.3/","dependencies":[]}],"windows":[{"name":"path_provider_windows","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_windows-0.1.0-nullsafety.3/","dependencies":[]},{"name":"url_launcher_windows","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher_windows-0.1.0-nullsafety.2/","dependencies":[]}],"web":[]},"dependencyGraph":[{"name":"flutter_downloader","dependencies":[]},{"name":"flutter_inappwebview","dependencies":[]},{"name":"integration_test","dependencies":[]},{"name":"path_provider","dependencies":["path_provider_macos","path_provider_linux","path_provider_windows"]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_macos","dependencies":[]},{"name":"path_provider_windows","dependencies":[]},{"name":"permission_handler","dependencies":[]},{"name":"url_launcher","dependencies":["url_launcher_linux","url_launcher_macos","url_launcher_windows"]},{"name":"url_launcher_linux","dependencies":[]},{"name":"url_launcher_macos","dependencies":[]},{"name":"url_launcher_windows","dependencies":[]}],"date_created":"2021-03-01 20:18:02.273603","version":"1.27.0-4.0.pre"} \ No newline at end of file diff --git a/example/integration_test/webview_flutter_test.dart b/example/integration_test/webview_flutter_test.dart index 64229af8..ebda3bc1 100644 --- a/example/integration_test/webview_flutter_test.dart +++ b/example/integration_test/webview_flutter_test.dart @@ -327,6 +327,8 @@ void main() { await controller.loadUrl(urlRequest: URLRequest(url: Uri.parse('https://www.google.com/'))); url = await pageLoads.stream.first; expect(url, 'https://www.google.com/'); + + pageLoads.close(); }); testWidgets('loadUrl with headers', (WidgetTester tester) async { @@ -376,6 +378,9 @@ void main() { final String content = await controller .evaluateJavascript(source: 'document.documentElement.innerText'); expect(content.contains('flutter_test_header'), isTrue); + + pageStarts.close(); + pageLoads.close(); }); group("iOS loadFileURL", () { @@ -1282,6 +1287,8 @@ void main() { await pageLoads.stream.first; // Wait for the next page load. final String? currentUrl = (await controller.getUrl())?.toString(); expect(currentUrl, 'https://www.google.com/'); + + pageLoads.close(); }); testWidgets('allow requests on iOS only if iosWKNavigationType == IOSWKNavigationType.LINK_ACTIVATED', (WidgetTester tester) async { @@ -1334,6 +1341,8 @@ void main() { await pageLoads.stream.first; // Wait for the next page load. currentUrl = (await controller.getUrl())?.toString(); expect(currentUrl, 'https://github.com/pichillilorenzo/flutter_inappwebview'); + + pageLoads.close(); }, skip: !Platform.isIOS); testWidgets('can block requests', (WidgetTester tester) async { @@ -1382,6 +1391,8 @@ void main() { .timeout(const Duration(milliseconds: 500), onTimeout: () => null); final String? currentUrl = (await controller.getUrl())?.toString(); expect(currentUrl, isNot(contains('youtube.com'))); + + pageLoads.close(); }); testWidgets('supports asynchronous decisions', (WidgetTester tester) async { @@ -1428,6 +1439,8 @@ void main() { await pageLoads.stream.first; // Wait for second page to load. final String? currentUrl = (await controller.getUrl())?.toString(); expect(currentUrl, 'https://www.google.com/'); + + pageLoads.close(); }); }); @@ -1554,6 +1567,8 @@ void main() { await pageLoads.stream.first; final String? currentUrl = (await controller.getUrl())?.toString(); expect(currentUrl, 'about:blank'); + + pageLoads.close(); }); testWidgets( @@ -1596,6 +1611,8 @@ void main() { await controller.goBack(); await pageLoads.stream.first; expect((await controller.getUrl())?.toString(), contains('flutter.dev')); + + pageLoads.close(); }, skip: !Platform.isAndroid, ); @@ -3216,6 +3233,8 @@ setTimeout(function() { final String? currentUrl = (await controller.getUrl())?.toString(); expect(currentUrl, 'https://flutter.dev/'); + + pageLoads.close(); }); testWidgets('loadFile', (WidgetTester tester) async { @@ -3250,6 +3269,8 @@ setTimeout(function() { expect(url, isNotNull); expect(url!.scheme, 'file'); expect(url.path, endsWith("test_assets/in_app_webview_initial_file_test.html")); + + pageLoads.close(); }); testWidgets('reload', (WidgetTester tester) async { @@ -3280,6 +3301,8 @@ setTimeout(function() { await controller.reload(); url = await pageLoads.stream.first; expect(url, 'https://flutter.dev/'); + + pageLoads.close(); }); testWidgets('web history - go back and forward', (WidgetTester tester) async { @@ -3364,6 +3387,8 @@ setTimeout(function() { expect(webHistory.list!.length, 2); expect(webHistory.list![0].url.toString(), 'https://flutter.dev/'); expect(webHistory.list![1].url.toString(), 'https://github.com/flutter'); + + pageLoads.close(); }); testWidgets('getProgress', (WidgetTester tester) async { @@ -4183,6 +4208,8 @@ setTimeout(function() { expect(value, isNull); value = await controller.evaluateJavascript(source: "window.bar;"); expect(value, isNull); + + pageLoads.close(); }); testWidgets('saveWebArchive', (WidgetTester tester) async { @@ -4260,6 +4287,8 @@ setTimeout(function() { await controller.loadUrl(urlRequest: URLRequest(url: Uri.parse('http://example.com/'))); await pageLoads.stream.first; expect(await controller.isSecureContext(), false); + + pageLoads.close(); }); test('getDefaultUserAgent', () async { @@ -4443,6 +4472,8 @@ setTimeout(function() { webHistory = await controller.getCopyBackForwardList(); expect(webHistory!.list!.length, 1); + + pageLoads.close(); }, skip: !Platform.isAndroid); test('clearClientCertPreferences', () async { diff --git a/example/ios/Flutter/Flutter.podspec b/example/ios/Flutter/Flutter.podspec new file mode 100644 index 00000000..2c4421cf --- /dev/null +++ b/example/ios/Flutter/Flutter.podspec @@ -0,0 +1,18 @@ +# +# NOTE: This podspec is NOT to be published. It is only used as a local source! +# This is a generated file; do not edit or check into version control. +# + +Pod::Spec.new do |s| + s.name = 'Flutter' + s.version = '1.0.0' + s.summary = 'High-performance, high-fidelity mobile apps.' + s.homepage = 'https://flutter.io' + s.license = { :type => 'MIT' } + s.author = { 'Flutter Dev Team' => 'flutter-dev@googlegroups.com' } + s.source = { :git => 'https://github.com/flutter/engine', :tag => s.version.to_s } + s.ios.deployment_target = '8.0' + # Framework linking is handled by Flutter tooling, not CocoaPods. + # Add a placeholder to satisfy `s.dependency 'Flutter'` plugin podspecs. + s.vendored_frameworks = 'path/to/nothing' +end diff --git a/example/ios/Flutter/flutter_export_environment.sh b/example/ios/Flutter/flutter_export_environment.sh index d22068ce..b59a9d8e 100755 --- a/example/ios/Flutter/flutter_export_environment.sh +++ b/example/ios/Flutter/flutter_export_environment.sh @@ -2,12 +2,13 @@ # 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=integration_test/webview_flutter_test.dart" export "FLUTTER_BUILD_DIR=build" export "SYMROOT=${SOURCE_ROOT}/../build/ios" export "FLUTTER_BUILD_NAME=1.0.0" export "FLUTTER_BUILD_NUMBER=1" +export "DART_DEFINES=RkxVVFRFUl9XRUJfQVVUT19ERVRFQ1Q9dHJ1ZQ==" export "DART_OBFUSCATION=false" -export "TRACK_WIDGET_CREATION=false" +export "TRACK_WIDGET_CREATION=true" export "TREE_SHAKE_ICONS=false" -export "PACKAGE_CONFIG=.packages" +export "PACKAGE_CONFIG=/Users/lorenzopichilli/Desktop/flutter_inappwebview/example/.dart_tool/package_config.json" diff --git a/example/lib/headless_in_app_webview.screen.dart b/example/lib/headless_in_app_webview.screen.dart index 4109f9cc..41274d33 100755 --- a/example/lib/headless_in_app_webview.screen.dart +++ b/example/lib/headless_in_app_webview.screen.dart @@ -88,7 +88,7 @@ class _HeadlessInAppWebViewExampleScreenState extends State - \ No newline at end of file diff --git a/ios/Classes/InAppWebView/InAppWebView.swift b/ios/Classes/InAppWebView/InAppWebView.swift index e15ade8e..e4ee7085 100755 --- a/ios/Classes/InAppWebView/InAppWebView.swift +++ b/ios/Classes/InAppWebView/InAppWebView.swift @@ -1977,7 +1977,6 @@ public class InAppWebView: WKWebView, UIScrollViewDelegate, WKUIDelegate, WKNavi let y = Int(scrollView.contentOffset.y / scrollView.contentScaleFactor) onScrollChanged(x: x, y: y) } - setNeedsLayout() lastScrollX = scrollView.contentOffset.x lastScrollY = scrollView.contentOffset.y } diff --git a/pubspec.yaml b/pubspec.yaml index 33da45ca..5ff9509d 100755 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: flutter_inappwebview description: A Flutter plugin that allows you to add an inline webview, to use an headless webview, and to open an in-app browser window. -version: 5.0.5 +version: 5.0.5+1 homepage: https://github.com/pichillilorenzo/flutter_inappwebview environment: diff --git a/scripts/publish.sh b/scripts/publish.sh new file mode 100644 index 00000000..4a875510 --- /dev/null +++ b/scripts/publish.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +readonly SCRIPT_PATH="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )" +readonly PROJECT_DIR="$(dirname $SCRIPT_PATH)" + +cd PROJECT_DIR/lib +dartfmt -w . + +cd PROJECT_DIR +flutter analyze +flutter pub publish --dry-run +flutter pub publish \ No newline at end of file