diff --git a/example/integration_test/in_app_webview/reload.dart b/example/integration_test/in_app_webview/reload.dart index 7029e878..1248ec31 100644 --- a/example/integration_test/in_app_webview/reload.dart +++ b/example/integration_test/in_app_webview/reload.dart @@ -40,7 +40,9 @@ void reload() { controllerCompleter.complete(controller); }, onLoadStop: (controller, url) { - pageLoaded.complete(); + if (!pageLoaded.isCompleted) { + pageLoaded.complete(); + } }, ), ), diff --git a/example/integration_test/webview_flutter_test.dart b/example/integration_test/webview_flutter_test.dart index 1b0e5a52..00016670 100644 --- a/example/integration_test/webview_flutter_test.dart +++ b/example/integration_test/webview_flutter_test.dart @@ -19,13 +19,13 @@ void main() { } WebView.debugLoggingSettings.usePrint = true; - WebView.debugLoggingSettings.maxLogMessageLength = -1; + WebView.debugLoggingSettings.maxLogMessageLength = 7000; InAppBrowser.debugLoggingSettings.usePrint = true; - InAppBrowser.debugLoggingSettings.maxLogMessageLength = -1; + InAppBrowser.debugLoggingSettings.maxLogMessageLength = 7000; ChromeSafariBrowser.debugLoggingSettings.usePrint = true; - ChromeSafariBrowser.debugLoggingSettings.maxLogMessageLength = -1; + ChromeSafariBrowser.debugLoggingSettings.maxLogMessageLength = 7000; WebAuthenticationSession.debugLoggingSettings.usePrint = true; - WebAuthenticationSession.debugLoggingSettings.maxLogMessageLength = -1; + WebAuthenticationSession.debugLoggingSettings.maxLogMessageLength = 7000; in_app_webview_tests.main(); service_worker_controller_tests.main(); diff --git a/example/ios/Flutter/flutter_export_environment.sh b/example/ios/Flutter/flutter_export_environment.sh index fae63896..03bce7c9 100755 --- a/example/ios/Flutter/flutter_export_environment.sh +++ b/example/ios/Flutter/flutter_export_environment.sh @@ -3,11 +3,12 @@ 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=lib/main.dart" +export "FLUTTER_TARGET=integration_test/webview_flutter_test.dart" export "FLUTTER_BUILD_DIR=build" export "FLUTTER_BUILD_NAME=1.0.0" export "FLUTTER_BUILD_NUMBER=1" +export "DART_DEFINES=RkxVVFRFUl9XRUJfQVVUT19ERVRFQ1Q9dHJ1ZQ==" export "DART_OBFUSCATION=false" export "TRACK_WIDGET_CREATION=true" export "TREE_SHAKE_ICONS=false" -export "PACKAGE_CONFIG=.dart_tool/package_config.json" +export "PACKAGE_CONFIG=/Users/lorenzopichilli/Desktop/flutter_inappwebview/example/.dart_tool/package_config.json" diff --git a/ios/Classes/InAppWebView/FlutterWebViewController.swift b/ios/Classes/InAppWebView/FlutterWebViewController.swift index a8e94268..4fd4b76b 100755 --- a/ios/Classes/InAppWebView/FlutterWebViewController.swift +++ b/ios/Classes/InAppWebView/FlutterWebViewController.swift @@ -95,7 +95,7 @@ public class FlutterWebViewController: NSObject, FlutterPlatformView, Disposable let windowId = params["windowId"] as? Int64 let initialUrlRequest = params["initialUrlRequest"] as? [String: Any?] let initialFile = params["initialFile"] as? String - let initialData = params["initialData"] as? [String: String] + let initialData = params["initialData"] as? [String: String?] if windowId == nil { if #available(iOS 11.0, *) { @@ -131,7 +131,7 @@ public class FlutterWebViewController: NSObject, FlutterPlatformView, Disposable } } - func load(initialUrlRequest: [String:Any?]?, initialFile: String?, initialData: [String: String]?) { + func load(initialUrlRequest: [String:Any?]?, initialFile: String?, initialData: [String: String?]?) { guard let webView = webView() else { return } @@ -144,11 +144,9 @@ public class FlutterWebViewController: NSObject, FlutterPlatformView, Disposable dump(error) } } - else if let initialData = initialData { - let data = initialData["data"]! - let mimeType = initialData["mimeType"]! - let encoding = initialData["encoding"]! - let baseUrl = URL(string: initialData["baseUrl"] ?? "about:blank")! + else if let initialData = initialData, let data = initialData["data"]!, + let mimeType = initialData["mimeType"]!, let encoding = initialData["encoding"]!, + let baseUrl = URL(string: initialData["baseUrl"]! ?? "about:blank") { var allowingReadAccessToURL: URL? = nil if let allowingReadAccessTo = webView.settings?.allowingReadAccessTo, baseUrl.scheme == "file" { allowingReadAccessToURL = URL(string: allowingReadAccessTo) @@ -156,7 +154,11 @@ public class FlutterWebViewController: NSObject, FlutterPlatformView, Disposable allowingReadAccessToURL = nil } } - webView.loadData(data: data, mimeType: mimeType, encoding: encoding, baseUrl: baseUrl, allowingReadAccessTo: allowingReadAccessToURL) + webView.loadData(data: data, + mimeType: mimeType, + encoding: encoding, + baseUrl: baseUrl, + allowingReadAccessTo: allowingReadAccessToURL) } else if let initialUrlRequest = initialUrlRequest { let urlRequest = URLRequest.init(fromPluginMap: initialUrlRequest) diff --git a/ios/Classes/InAppWebView/WebViewChannelDelegate.swift b/ios/Classes/InAppWebView/WebViewChannelDelegate.swift index 551e2b58..c0efe12f 100644 --- a/ios/Classes/InAppWebView/WebViewChannelDelegate.swift +++ b/ios/Classes/InAppWebView/WebViewChannelDelegate.swift @@ -760,7 +760,7 @@ public class WebViewChannelDelegate : ChannelDelegate { "defaultValue": defaultValue, "isMainFrame": isMainFrame ] - channel?.invokeMethod("onJsConfirm", arguments: arguments, callback: callback) + channel?.invokeMethod("onJsPrompt", arguments: arguments, callback: callback) } public class CreateWindowCallback : BaseCallbackResult { diff --git a/ios/Classes/Types/PermissionResponse.swift b/ios/Classes/Types/PermissionResponse.swift index 0032aed6..7971f95e 100644 --- a/ios/Classes/Types/PermissionResponse.swift +++ b/ios/Classes/Types/PermissionResponse.swift @@ -8,10 +8,10 @@ import Foundation public class PermissionResponse : NSObject { - var resources: [String] + var resources: [Any] var action: Int? - public init(resources: [String], action: Int? = nil) { + public init(resources: [Any], action: Int? = nil) { self.resources = resources self.action = action } @@ -20,7 +20,7 @@ public class PermissionResponse : NSObject { guard let map = map else { return nil } - let resources = map["resources"] as! [String] + let resources = map["resources"] as! [Any] let action = map["action"] as? Int return PermissionResponse(resources: resources, action: action) }