diff --git a/CHANGELOG.md b/CHANGELOG.md index 0ec67b84..87a3cb08 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -## 6.0.0 +## 6.0.0-beta.1 - Deprecated old classes/properties/methods to make them eventually compatible with other Platforms and WebView engines. - Added Web support diff --git a/example/integration_test/in_app_webview/initial_url_request.dart b/example/integration_test/in_app_webview/initial_url_request.dart new file mode 100644 index 00000000..1c9d8bb2 --- /dev/null +++ b/example/integration_test/in_app_webview/initial_url_request.dart @@ -0,0 +1,28 @@ +import 'dart:async'; + +import 'package:flutter/widgets.dart'; +import 'package:flutter_inappwebview/flutter_inappwebview.dart'; +import 'package:flutter_test/flutter_test.dart'; + +void initialUrlRequest() { + testWidgets('initialUrlRequest', (WidgetTester tester) async { + final Completer controllerCompleter = Completer(); + await tester.pumpWidget( + Directionality( + textDirection: TextDirection.ltr, + child: InAppWebView( + key: GlobalKey(), + initialUrlRequest: + URLRequest(url: Uri.parse('https://github.com/flutter')), + onWebViewCreated: (controller) { + controllerCompleter.complete(controller); + }, + ), + ), + ); + final InAppWebViewController controller = + await controllerCompleter.future; + final String? currentUrl = (await controller.getUrl())?.toString(); + expect(currentUrl, 'https://github.com/flutter'); + }); +} \ No newline at end of file diff --git a/example/integration_test/in_app_webview/main.dart b/example/integration_test/in_app_webview/main.dart new file mode 100644 index 00000000..8392cd0b --- /dev/null +++ b/example/integration_test/in_app_webview/main.dart @@ -0,0 +1,11 @@ +import 'package:flutter_test/flutter_test.dart'; + +import 'initial_url_request.dart'; +import 'set_get_settings.dart'; + +void main() { + group('InAppWebView', () { + initialUrlRequest(); + setGetSettings(); + }); +} \ No newline at end of file diff --git a/example/integration_test/in_app_webview/set_get_settings.dart b/example/integration_test/in_app_webview/set_get_settings.dart new file mode 100644 index 00000000..ff714ec9 --- /dev/null +++ b/example/integration_test/in_app_webview/set_get_settings.dart @@ -0,0 +1,46 @@ +import 'dart:async'; + +import 'package:flutter/widgets.dart'; +import 'package:flutter_inappwebview/flutter_inappwebview.dart'; +import 'package:flutter_test/flutter_test.dart'; + +void setGetSettings() { + testWidgets('set/get settings', (WidgetTester tester) async { + final Completer controllerCompleter = Completer(); + final Completer pageLoaded = Completer(); + + await tester.pumpWidget( + Directionality( + textDirection: TextDirection.ltr, + child: InAppWebView( + key: GlobalKey(), + initialUrlRequest: + URLRequest(url: Uri.parse('https://github.com/flutter')), + initialSettings: InAppWebViewSettings( + javaScriptEnabled: false + ), + onWebViewCreated: (controller) { + controllerCompleter.complete(controller); + }, + onLoadStop: (controller, url) { + pageLoaded.complete(); + }, + ), + ), + ); + final InAppWebViewController controller = + await controllerCompleter.future; + await pageLoaded.future; + + InAppWebViewSettings? settings = await controller.getSettings(); + expect(settings, isNotNull); + expect(settings!.javaScriptEnabled, false); + + await controller.setSettings(settings: InAppWebViewSettings( + javaScriptEnabled: true)); + + settings = await controller.getSettings(); + expect(settings, isNotNull); + expect(settings!.javaScriptEnabled, true); + }); +} \ 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 9b62063f..7c6cb6dc 100644 --- a/example/integration_test/webview_flutter_test.dart +++ b/example/integration_test/webview_flutter_test.dart @@ -13,6 +13,8 @@ import 'package:flutter_test/flutter_test.dart'; import 'package:integration_test/integration_test.dart'; import 'package:path_provider/path_provider.dart'; +import 'in_app_webview/main.dart' as in_app_webview_test; + import '.env.dart'; /// Returns a matcher that matches the isNullOrEmpty property. @@ -87,71 +89,13 @@ class MyChromeSafariBrowser extends ChromeSafariBrowser { void main() { IntegrationTestWidgetsFlutterBinding.ensureInitialized(); - if (Platform.isAndroid) { - AndroidInAppWebViewController.setWebContentsDebuggingEnabled(true); + InAppWebViewController.setWebContentsDebuggingEnabled(true); } - group('InAppWebView', () { - testWidgets('initialUrlRequest', (WidgetTester tester) async { - final Completer controllerCompleter = Completer(); - await tester.pumpWidget( - Directionality( - textDirection: TextDirection.ltr, - child: InAppWebView( - key: GlobalKey(), - initialUrlRequest: - URLRequest(url: Uri.parse('https://github.com/flutter')), - onWebViewCreated: (controller) { - controllerCompleter.complete(controller); - }, - ), - ), - ); - final InAppWebViewController controller = - await controllerCompleter.future; - final String? currentUrl = (await controller.getUrl())?.toString(); - expect(currentUrl, 'https://github.com/flutter'); - }); + in_app_webview_test.main(); - testWidgets('set/get options', (WidgetTester tester) async { - final Completer controllerCompleter = Completer(); - final Completer pageLoaded = Completer(); - - await tester.pumpWidget( - Directionality( - textDirection: TextDirection.ltr, - child: InAppWebView( - key: GlobalKey(), - initialUrlRequest: - URLRequest(url: Uri.parse('https://github.com/flutter')), - initialOptions: InAppWebViewGroupOptions( - crossPlatform: InAppWebViewOptions(javaScriptEnabled: false)), - onWebViewCreated: (controller) { - controllerCompleter.complete(controller); - }, - onLoadStop: (controller, url) { - pageLoaded.complete(); - }, - ), - ), - ); - final InAppWebViewController controller = - await controllerCompleter.future; - await pageLoaded.future; - - InAppWebViewGroupOptions? options = await controller.getOptions(); - expect(options, isNotNull); - expect(options!.crossPlatform.javaScriptEnabled, false); - - await controller.setOptions( - options: InAppWebViewGroupOptions( - crossPlatform: InAppWebViewOptions(javaScriptEnabled: true))); - - options = await controller.getOptions(); - expect(options, isNotNull); - expect(options!.crossPlatform.javaScriptEnabled, true); - }); + group('OLD InAppWebView', () { group('javascript code evaluation', () { testWidgets('evaluateJavascript', (WidgetTester tester) async { diff --git a/example/ios/Flutter/Flutter.podspec b/example/ios/Flutter/Flutter.podspec deleted file mode 100644 index 663d5b29..00000000 --- a/example/ios/Flutter/Flutter.podspec +++ /dev/null @@ -1,18 +0,0 @@ -# -# 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 = '9.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 9e98dd5e..dad54015 100755 --- a/example/ios/Flutter/flutter_export_environment.sh +++ b/example/ios/Flutter/flutter_export_environment.sh @@ -3,12 +3,11 @@ export "FLUTTER_ROOT=/Users/lorenzopichilli/fvm/versions/2.10.4" export "FLUTTER_APPLICATION_PATH=/Users/lorenzopichilli/Desktop/flutter_inappwebview/example" export "COCOAPODS_PARALLEL_CODE_SIGN=true" -export "FLUTTER_TARGET=/Users/lorenzopichilli/Desktop/flutter_inappwebview/example/lib/main.dart" +export "FLUTTER_TARGET=lib/main.dart" export "FLUTTER_BUILD_DIR=build" export "FLUTTER_BUILD_NAME=1.0.0" export "FLUTTER_BUILD_NUMBER=1" -export "DART_DEFINES=Zmx1dHRlci5pbnNwZWN0b3Iuc3RydWN0dXJlZEVycm9ycz10cnVl,RkxVVFRFUl9XRUJfQVVUT19ERVRFQ1Q9dHJ1ZQ==" export "DART_OBFUSCATION=false" -export "TRACK_WIDGET_CREATION=true" +export "TRACK_WIDGET_CREATION=false" export "TREE_SHAKE_ICONS=false" -export "PACKAGE_CONFIG=/Users/lorenzopichilli/Desktop/flutter_inappwebview/example/.dart_tool/package_config.json" +export "PACKAGE_CONFIG=.packages" diff --git a/pubspec.yaml b/pubspec.yaml index 47cc4ac1..e4dc4208 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: 6.0.0 +version: 6.0.0-beta.1 homepage: https://github.com/pichillilorenzo/flutter_inappwebview environment: