diff --git a/CHANGELOG.md b/CHANGELOG.md index 4e66b57f..05918eb9 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 6.0.0-beta.11 + +- Fixed "[webRTC / macOS] onPermissionRequest not called on HeadlessInAppWebView" [#1405](https://github.com/pichillilorenzo/flutter_inappwebview/issues/1405) + ## 6.0.0-beta.10 - Created `WebUri` class to replace `Uri` dart core type. Related to: diff --git a/example/integration_test/chrome_safari_browser/custom_tabs.dart b/example/integration_test/chrome_safari_browser/custom_tabs.dart index de548e0d..635faac6 100644 --- a/example/integration_test/chrome_safari_browser/custom_tabs.dart +++ b/example/integration_test/chrome_safari_browser/custom_tabs.dart @@ -132,7 +132,7 @@ void customTabs() { name: "button1", defPackage: "com.pichillilorenzo.flutter_inappwebviewexample"), - onClick: (Uri? url) { + onClick: (WebUri? url) { print("Button 1 with $url"); }), ChromeSafariBrowserSecondaryToolbarClickableID( @@ -140,7 +140,7 @@ void customTabs() { name: "button2", defPackage: "com.pichillilorenzo.flutter_inappwebviewexample"), - onClick: (Uri? url) { + onClick: (WebUri? url) { print("Button 2 with $url"); }), ])); @@ -163,7 +163,7 @@ void customTabs() { name: "button3", defPackage: "com.pichillilorenzo.flutter_inappwebviewexample"), - onClick: (Uri? url) { + onClick: (WebUri? url) { print("Button 3 with $url"); }), ])); diff --git a/lib/src/in_app_localhost_server.dart b/lib/src/in_app_localhost_server.dart index 4c1b8613..96b4fdab 100755 --- a/lib/src/in_app_localhost_server.dart +++ b/lib/src/in_app_localhost_server.dart @@ -6,7 +6,8 @@ import 'package:flutter/services.dart' show rootBundle; import 'mime_type_resolver.dart'; -///This class allows you to create a simple server on `http://localhost:[port]/` in order to be able to load your assets file on a server. +///This class allows you to create a simple server on `http://localhost:[port]/` +///in order to be able to load your assets file on a local server. ///The default `port` value is `8080`. /// ///**Supported Platforms/Implementations**: 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 71cd0727..00ba72be 100644 --- a/lib/src/in_app_webview/in_app_webview_controller.dart +++ b/lib/src/in_app_webview/in_app_webview_controller.dart @@ -1592,7 +1592,7 @@ class InAppWebViewController { ///This URL must be a file-based URL (using the `file://` scheme). ///Specify the same value as the URL parameter to prevent WebView from reading any other content. ///Specify a directory to give WebView permission to read additional files in the specified directory. - ///**NOTE**: available only on iOS. + ///**NOTE**: available only on iOS and MacOS. /// ///**NOTE for Android**: when loading an URL Request using "POST" method, headers are ignored. /// @@ -1661,7 +1661,7 @@ class InAppWebViewController { ///This [baseUrl] must be a file-based URL (using the `file://` scheme). ///Specify the same value as the [baseUrl] parameter to prevent WebView from reading any other content. ///Specify a directory to give WebView permission to read additional files in the specified directory. - ///**NOTE**: available only on iOS. + ///**NOTE**: available only on iOS and MacOS. /// ///**Supported Platforms/Implementations**: ///- Android native WebView ([Official API - WebView.loadDataWithBaseURL](https://developer.android.com/reference/android/webkit/WebView#loadDataWithBaseURL(java.lang.String,%20java.lang.String,%20java.lang.String,%20java.lang.String,%20java.lang.String))) diff --git a/lib/src/in_app_webview/webview.dart b/lib/src/in_app_webview/webview.dart index d03bdb13..c969859e 100644 --- a/lib/src/in_app_webview/webview.dart +++ b/lib/src/in_app_webview/webview.dart @@ -127,13 +127,13 @@ abstract class WebView { InAppWebViewController controller, ConsoleMessage consoleMessage)? onConsoleMessage; - ///Give the host application a chance to take control when a URL is about to be loaded in the current WebView. This event is not called on the initial load of the WebView. + ///Give the host application a chance to take control when a URL is about to be loaded in the current WebView. /// ///Note that on Android there isn't any way to load an URL for a frame that is not the main frame, so if the request is not for the main frame, the navigation is allowed by default. ///However, if you want to cancel requests for subframes, you can use the [InAppWebViewSettings.regexToCancelSubFramesLoading] setting ///to write a Regular Expression that, if the url request of a subframe matches, then the request of that subframe is canceled. /// - ///Also, on Android, this method is not called for POST requests. + ///Also, on Android, this event is not called for POST requests. /// ///[navigationAction] represents an object that contains information about an action that causes navigation to occur. /// @@ -448,7 +448,7 @@ abstract class WebView { ///Event fired when the host application updates its visited links database. ///This event is also fired when the navigation state of the [WebView] changes through the usage of ///javascript **[History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API)** functions (`pushState()`, `replaceState()`) and `onpopstate` event - ///or, also, when the javascript `window.location` changes without reloading the webview (for example appending or modifying an hash to the url). + ///or, also, when the javascript `window.location` changes without reloading the webview (for example appending or modifying a hash to the url). /// ///[url] represents the url being visited. /// @@ -670,7 +670,7 @@ abstract class WebView { ///If the return value is `null`, the WebView will continue to load the resource as usual. ///Otherwise, the return response and data will be used. /// - ///This callback is invoked for a variety of URL schemes (e.g., `http(s):`, `data:`, `file:`, etc.), + ///This event is invoked for a variety of URL schemes (e.g., `http(s):`, `data:`, `file:`, etc.), ///not only those schemes which send requests over the network. ///This is not called for `javascript:` URLs, `blob:` URLs, or for assets accessed via `file:///android_asset/` or `file:///android_res/` URLs. /// diff --git a/lib/src/types/activity_button.dart b/lib/src/types/activity_button.dart index 353d78fe..4b04ee50 100644 --- a/lib/src/types/activity_button.dart +++ b/lib/src/types/activity_button.dart @@ -8,6 +8,8 @@ part 'activity_button.g.dart'; ///When tapped, it will invoke a Share or Action Extension bundled with your app. ///The default VoiceOver description of this button is the `CFBundleDisplayName` set in the extension's `Info.plist`. /// +///Check [Official Apple App Extensions](https://developer.apple.com/app-extensions/) for more details. +/// ///**Supported Platforms/Implementations**: ///- iOS @ExchangeableObject() @@ -15,7 +17,7 @@ class ActivityButton_ { ///The name of the image asset or file. UIImage_ templateImage; - ///The name of the system symbol image. + ///The name of the App or Share Extension to be called. String extensionIdentifier; @ExchangeableObjectConstructor() diff --git a/lib/src/types/activity_button.g.dart b/lib/src/types/activity_button.g.dart index 3e9b690f..4a868340 100644 --- a/lib/src/types/activity_button.g.dart +++ b/lib/src/types/activity_button.g.dart @@ -10,13 +10,15 @@ part of 'activity_button.dart'; ///When tapped, it will invoke a Share or Action Extension bundled with your app. ///The default VoiceOver description of this button is the `CFBundleDisplayName` set in the extension's `Info.plist`. /// +///Check [Official Apple App Extensions](https://developer.apple.com/app-extensions/) for more details. +/// ///**Supported Platforms/Implementations**: ///- iOS class ActivityButton { ///The name of the image asset or file. UIImage templateImage; - ///The name of the system symbol image. + ///The name of the App or Share Extension to be called. String extensionIdentifier; ActivityButton( {required this.templateImage, required this.extensionIdentifier}); diff --git a/lib/src/types/android_resource.dart b/lib/src/types/android_resource.dart index cdbdbe55..da46ccad 100644 --- a/lib/src/types/android_resource.dart +++ b/lib/src/types/android_resource.dart @@ -2,7 +2,7 @@ import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_i part 'android_resource.g.dart'; -///Class that represents an android resource. +///Class that represents an Android resource file. @ExchangeableObject() class AndroidResource_ { ///Android resource name. diff --git a/lib/src/types/android_resource.g.dart b/lib/src/types/android_resource.g.dart index 9d85907a..9aa8ea07 100644 --- a/lib/src/types/android_resource.g.dart +++ b/lib/src/types/android_resource.g.dart @@ -6,7 +6,7 @@ part of 'android_resource.dart'; // ExchangeableObjectGenerator // ************************************************************************** -///Class that represents an android resource. +///Class that represents an Android resource file. class AndroidResource { ///Android resource name. /// diff --git a/lib/src/types/ui_image.dart b/lib/src/types/ui_image.dart index 3da91ee3..28f3aae1 100644 --- a/lib/src/types/ui_image.dart +++ b/lib/src/types/ui_image.dart @@ -6,6 +6,8 @@ part 'ui_image.g.dart'; ///Class that represents an object that manages iOS image data in your app. /// +///Check [UIKit.UIImage](https://developer.apple.com/documentation/uikit/uiimage) for more details. +/// ///**Supported Platforms/Implementations**: ///- iOS @ExchangeableObject() diff --git a/lib/src/types/ui_image.g.dart b/lib/src/types/ui_image.g.dart index fe772ae5..4b8309de 100644 --- a/lib/src/types/ui_image.g.dart +++ b/lib/src/types/ui_image.g.dart @@ -8,6 +8,8 @@ part of 'ui_image.dart'; ///Class that represents an object that manages iOS image data in your app. /// +///Check [UIKit.UIImage](https://developer.apple.com/documentation/uikit/uiimage) for more details. +/// ///**Supported Platforms/Implementations**: ///- iOS class UIImage { diff --git a/macos/Classes/HeadlessInAppWebView/HeadlessInAppWebView.swift b/macos/Classes/HeadlessInAppWebView/HeadlessInAppWebView.swift index e57ac3f8..be9e42f1 100644 --- a/macos/Classes/HeadlessInAppWebView/HeadlessInAppWebView.swift +++ b/macos/Classes/HeadlessInAppWebView/HeadlessInAppWebView.swift @@ -36,6 +36,14 @@ public class HeadlessInAppWebView : Disposable { view.frame = CGRect(x: 0.0, y: 0.0, width: NSApplication.shared.mainWindow?.contentView?.bounds.width ?? 0.0, height: NSApplication.shared.mainWindow?.contentView?.bounds.height ?? 0.0) } + /// Note: The WKWebView behaves very unreliable when rendering offscreen + /// on a device. This is especially true with JavaScript, which simply + /// won't be executed sometimes. + /// So, add the headless WKWebView to the view hierarchy. + /// This way is also possible to take screenshots. + let wrapperView = NSView() // wrapper view with frame zero + wrapperView.addSubview(view, positioned: .below, relativeTo: nil) + NSApplication.shared.mainWindow?.contentView?.addSubview(wrapperView, positioned: .below, relativeTo: nil) } } @@ -72,6 +80,9 @@ public class HeadlessInAppWebView : Disposable { channelDelegate?.dispose() channelDelegate = nil HeadlessInAppWebViewManager.webViews[id] = nil + if let view = flutterWebView?.view() { + view.superview?.removeFromSuperview() + } flutterWebView = nil } diff --git a/pubspec.yaml b/pubspec.yaml index 7736d4dc..31bcbd45 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-beta.10 +version: 6.0.0-beta.11 homepage: https://inappwebview.dev/ repository: https://github.com/pichillilorenzo/flutter_inappwebview issue_tracker: https://github.com/pichillilorenzo/flutter_inappwebview/issues