diff --git a/CHANGELOG.md b/CHANGELOG.md index ffefa3a5..eb6d6973 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 5.1.0+3 + +- Fixed "Unsupported operation: Platform._operatingSystem" when compiling for Web again [#507](https://github.com/pichillilorenzo/flutter_inappwebview/issues/507) + ## 5.1.0+2 - Fixed missing MATCH_PARENT layout params to the WebView on Android when it is wrapped by PullToRefreshLayout diff --git a/example/.flutter-plugins-dependencies b/example/.flutter-plugins-dependencies index 1933c739..d5d52e2c 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-06 16:03:42.653087","version":"2.1.0-10.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-08 10:08:44.020151","version":"2.1.0-10.0.pre"} \ No newline at end of file diff --git a/lib/src/cookie_manager.dart b/lib/src/cookie_manager.dart index 0b46ce77..7839a501 100755 --- a/lib/src/cookie_manager.dart +++ b/lib/src/cookie_manager.dart @@ -1,6 +1,7 @@ import 'dart:async'; import 'dart:io'; +import 'package:flutter/foundation.dart'; import 'package:flutter/services.dart'; import 'in_app_webview/in_app_webview_controller.dart'; @@ -70,7 +71,7 @@ class CookieManager { assert(domain.isNotEmpty); assert(path.isNotEmpty); - if (Platform.isIOS) { + if (defaultTargetPlatform == TargetPlatform.iOS) { var platformUtil = PlatformUtil(); var version = double.tryParse(await platformUtil.getSystemVersion()); if (version != null && version < 11.0) { @@ -166,7 +167,7 @@ class CookieManager { InAppWebViewController? iosBelow11WebViewController}) async { assert(url.toString().isNotEmpty); - if (Platform.isIOS) { + if (defaultTargetPlatform == TargetPlatform.iOS) { var platformUtil = PlatformUtil(); var version = double.tryParse(await platformUtil.getSystemVersion()); if (version != null && version < 11.0) { @@ -265,7 +266,7 @@ class CookieManager { assert(url.toString().isNotEmpty); assert(name.isNotEmpty); - if (Platform.isIOS) { + if (defaultTargetPlatform == TargetPlatform.iOS) { var platformUtil = PlatformUtil(); var version = double.tryParse(await platformUtil.getSystemVersion()); if (version != null && version < 11.0) { @@ -321,7 +322,7 @@ class CookieManager { assert(url.toString().isNotEmpty); assert(name.isNotEmpty); - if (Platform.isIOS) { + if (defaultTargetPlatform == TargetPlatform.iOS) { var platformUtil = PlatformUtil(); var version = double.tryParse(await platformUtil.getSystemVersion()); if (version != null && version < 11.0) { @@ -365,7 +366,7 @@ class CookieManager { assert(url.toString().isNotEmpty); - if (Platform.isIOS) { + if (defaultTargetPlatform == TargetPlatform.iOS) { var platformUtil = PlatformUtil(); var version = double.tryParse(await platformUtil.getSystemVersion()); if (version != null && version < 11.0) { diff --git a/lib/src/in_app_webview/in_app_webview_controller.dart b/lib/src/in_app_webview/in_app_webview_controller.dart index bd116b8f..655426cd 100644 --- a/lib/src/in_app_webview/in_app_webview_controller.dart +++ b/lib/src/in_app_webview/in_app_webview_controller.dart @@ -1908,7 +1908,7 @@ class InAppWebViewController { /// ///**Official iOS API**: https://developer.apple.com/documentation/webkit/wkusercontentcontroller/1537448-adduserscript Future addUserScript({required UserScript userScript}) async { - assert(_webview?.windowId == null || !Platform.isIOS); + assert(_webview?.windowId == null || defaultTargetPlatform != TargetPlatform.iOS); Map args = {}; args.putIfAbsent('userScript', () => userScript.toMap()); @@ -1924,7 +1924,7 @@ class InAppWebViewController { ///There isn't any way to add/remove user scripts specific to iOS window WebViews. ///This is a limitation of the native iOS WebKit APIs. Future addUserScripts({required List userScripts}) async { - assert(_webview?.windowId == null || !Platform.isIOS); + assert(_webview?.windowId == null || defaultTargetPlatform != TargetPlatform.iOS); for (var i = 0; i < userScripts.length; i++) { await addUserScript(userScript: userScripts[i]); @@ -1939,7 +1939,7 @@ class InAppWebViewController { ///There isn't any way to add/remove user scripts specific to iOS window WebViews. ///This is a limitation of the native iOS WebKit APIs. Future removeUserScript({required UserScript userScript}) async { - assert(_webview?.windowId == null || !Platform.isIOS); + assert(_webview?.windowId == null || defaultTargetPlatform != TargetPlatform.iOS); var index = _userScripts.indexOf(userScript); if (index == -1) { @@ -1962,7 +1962,7 @@ class InAppWebViewController { ///There isn't any way to add/remove user scripts specific to iOS window WebViews. ///This is a limitation of the native iOS WebKit APIs. Future removeUserScriptsByGroupName({required String groupName}) async { - assert(_webview?.windowId == null || !Platform.isIOS); + assert(_webview?.windowId == null || defaultTargetPlatform != TargetPlatform.iOS); Map args = {}; args.putIfAbsent('groupName', () => groupName); @@ -1977,7 +1977,7 @@ class InAppWebViewController { ///This is a limitation of the native iOS WebKit APIs. Future removeUserScripts( {required List userScripts}) async { - assert(_webview?.windowId == null || !Platform.isIOS); + assert(_webview?.windowId == null || defaultTargetPlatform != TargetPlatform.iOS); for (var i = 0; i < userScripts.length; i++) { await removeUserScript(userScript: userScripts[i]); @@ -1992,7 +1992,7 @@ class InAppWebViewController { /// ///**Official iOS API**: https://developer.apple.com/documentation/webkit/wkusercontentcontroller/1536540-removealluserscripts Future removeAllUserScripts() async { - assert(_webview?.windowId == null || !Platform.isIOS); + assert(_webview?.windowId == null || defaultTargetPlatform != TargetPlatform.iOS); _userScripts.clear(); Map args = {}; @@ -2059,9 +2059,9 @@ class InAppWebViewController { Future saveWebArchive( {required String filePath, bool autoname = false}) async { if (!autoname) { - if (Platform.isAndroid) { + if (defaultTargetPlatform == TargetPlatform.android) { assert(filePath.endsWith("." + WebArchiveFormat.MHT.toValue())); - } else if (Platform.isIOS) { + } else if (defaultTargetPlatform == TargetPlatform.iOS) { assert(filePath.endsWith("." + WebArchiveFormat.WEBARCHIVE.toValue())); } } diff --git a/pubspec.yaml b/pubspec.yaml index 8b10c907..b2d9db56 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.1.0+2 +version: 5.1.0+3 homepage: https://github.com/pichillilorenzo/flutter_inappwebview environment: