From 18c3e04fd24051a73fcc8ba3fa43ab37e7ea69e6 Mon Sep 17 00:00:00 2001 From: Lorenzo Pichilli Date: Thu, 28 Apr 2022 21:16:58 +0200 Subject: [PATCH] fix #1164 --- CHANGELOG.md | 4 ++++ example/ios/Flutter/flutter_export_environment.sh | 4 ++-- lib/src/chrome_safari_browser/chrome_safari_browser.dart | 6 +++++- pubspec.yaml | 2 +- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3f1bfd37..0bdbcac5 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 5.4.3+4 + +- Updated docs for `ChromeSafariBrowser.open` and throw error on iOS if the `url` parameter use a different scheme then `http` or `https` + ## 5.4.3+3 - Fixed "Android error: package org.jetbrains.annotations does not exist import org.jetbrains.annotations.NotNull;" [#1166](https://github.com/pichillilorenzo/flutter_inappwebview/issues/1166) diff --git a/example/ios/Flutter/flutter_export_environment.sh b/example/ios/Flutter/flutter_export_environment.sh index 03bce7c9..9e98dd5e 100755 --- a/example/ios/Flutter/flutter_export_environment.sh +++ b/example/ios/Flutter/flutter_export_environment.sh @@ -3,11 +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=integration_test/webview_flutter_test.dart" +export "FLUTTER_TARGET=/Users/lorenzopichilli/Desktop/flutter_inappwebview/example/lib/main.dart" export "FLUTTER_BUILD_DIR=build" export "FLUTTER_BUILD_NAME=1.0.0" export "FLUTTER_BUILD_NUMBER=1" -export "DART_DEFINES=RkxVVFRFUl9XRUJfQVVUT19ERVRFQ1Q9dHJ1ZQ==" +export "DART_DEFINES=Zmx1dHRlci5pbnNwZWN0b3Iuc3RydWN0dXJlZEVycm9ycz10cnVl,RkxVVFRFUl9XRUJfQVVUT19ERVRFQ1Q9dHJ1ZQ==" export "DART_OBFUSCATION=false" export "TRACK_WIDGET_CREATION=true" export "TREE_SHAKE_ICONS=false" diff --git a/lib/src/chrome_safari_browser/chrome_safari_browser.dart b/lib/src/chrome_safari_browser/chrome_safari_browser.dart index 5a42eb3b..c806c664 100755 --- a/lib/src/chrome_safari_browser/chrome_safari_browser.dart +++ b/lib/src/chrome_safari_browser/chrome_safari_browser.dart @@ -2,6 +2,7 @@ import 'dart:async'; import 'dart:collection'; import 'dart:typed_data'; +import 'package:flutter/foundation.dart'; import 'package:flutter/services.dart'; import 'package:flutter_inappwebview/src/util.dart'; @@ -85,13 +86,16 @@ class ChromeSafariBrowser { ///Opens the [ChromeSafariBrowser] instance with an [url]. /// - ///[url]: The [url] to load. + ///[url]: The [url] to load. On iOS, the [url] must use the `http` or `https` scheme. /// ///[options]: Options for the [ChromeSafariBrowser]. Future open( {required Uri url, ChromeSafariBrowserClassOptions? options}) async { assert(url.toString().isNotEmpty); this.throwIsAlreadyOpened(message: 'Cannot open $url!'); + if (!kIsWeb && defaultTargetPlatform == TargetPlatform.iOS) { + assert(['http', 'https'].contains(url.scheme), 'The specified URL has an unsupported scheme. Only HTTP and HTTPS URLs are supported on iOS.'); + } List> menuItemList = []; _menuItems.forEach((key, value) { diff --git a/pubspec.yaml b/pubspec.yaml index 7786aeac..2d8cc5f5 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.4.3+3 +version: 5.4.3+4 homepage: https://github.com/pichillilorenzo/flutter_inappwebview environment: