Added getPackageName static method on ChromeSafariBrowser for Android, updated iOS and macOS WebViewChannelDelegate channel self reference
This commit is contained in:
parent
6a486b2fa9
commit
2ea3bee498
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
- Added `requestPostMessageChannel`, `postMessage`, `isEngagementSignalsApiAvailable` methods on `ChromeSafariBrowser` for Android
|
- Added `requestPostMessageChannel`, `postMessage`, `isEngagementSignalsApiAvailable` methods on `ChromeSafariBrowser` for Android
|
||||||
- Added `onMessageChannelReady`, `onPostMessage`, `onVerticalScrollEvent`, `onGreatestScrollPercentageIncreased`, `onSessionEnded` events on `ChromeSafariBrowser` for Android
|
- Added `onMessageChannelReady`, `onPostMessage`, `onVerticalScrollEvent`, `onGreatestScrollPercentageIncreased`, `onSessionEnded` events on `ChromeSafariBrowser` for Android
|
||||||
|
- Added `getPackageName` static method on `ChromeSafariBrowser` for Android
|
||||||
|
|
||||||
## 6.0.0-beta.26
|
## 6.0.0-beta.26
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@ import android.content.Intent;
|
|||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.browser.customtabs.CustomTabsClient;
|
||||||
import androidx.browser.customtabs.CustomTabsIntent;
|
import androidx.browser.customtabs.CustomTabsIntent;
|
||||||
|
|
||||||
import com.pichillilorenzo.flutter_inappwebview.InAppWebViewFlutterPlugin;
|
import com.pichillilorenzo.flutter_inappwebview.InAppWebViewFlutterPlugin;
|
||||||
@ -70,6 +71,15 @@ public class ChromeSafariBrowserManager extends ChannelDelegateImpl {
|
|||||||
case "getMaxToolbarItems":
|
case "getMaxToolbarItems":
|
||||||
result.success(CustomTabsIntent.getMaxToolbarItems());
|
result.success(CustomTabsIntent.getMaxToolbarItems());
|
||||||
break;
|
break;
|
||||||
|
case "getPackageName":
|
||||||
|
if (plugin != null && plugin.activity != null) {
|
||||||
|
ArrayList<String> packages = (ArrayList<String>) call.argument("packages");
|
||||||
|
Boolean ignoreDefault = (Boolean) call.argument("ignoreDefault");
|
||||||
|
result.success(CustomTabsClient.getPackageName(plugin.activity, packages, ignoreDefault));
|
||||||
|
} else {
|
||||||
|
result.success(null);
|
||||||
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
result.notImplemented();
|
result.notImplemented();
|
||||||
}
|
}
|
||||||
|
@ -166,11 +166,6 @@ void customTabs() {
|
|||||||
expect(chromeSafariBrowser.isOpened(), false);
|
expect(chromeSafariBrowser.isOpened(), false);
|
||||||
});
|
});
|
||||||
|
|
||||||
skippableTest('getMaxToolbarItems', () async {
|
|
||||||
expect(await ChromeSafariBrowser.getMaxToolbarItems(),
|
|
||||||
greaterThanOrEqualTo(0));
|
|
||||||
});
|
|
||||||
|
|
||||||
skippableTest('request and send post messages', () async {
|
skippableTest('request and send post messages', () async {
|
||||||
var chromeSafariBrowser = MyChromeSafariBrowser();
|
var chromeSafariBrowser = MyChromeSafariBrowser();
|
||||||
expect(chromeSafariBrowser.isOpened(), false);
|
expect(chromeSafariBrowser.isOpened(), false);
|
||||||
@ -217,5 +212,14 @@ void customTabs() {
|
|||||||
await expectLater(chromeSafariBrowser.closed.future, completes);
|
await expectLater(chromeSafariBrowser.closed.future, completes);
|
||||||
expect(chromeSafariBrowser.isOpened(), false);
|
expect(chromeSafariBrowser.isOpened(), false);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
skippableTest('getMaxToolbarItems', () async {
|
||||||
|
expect(await ChromeSafariBrowser.getMaxToolbarItems(),
|
||||||
|
greaterThanOrEqualTo(0));
|
||||||
|
});
|
||||||
|
|
||||||
|
skippableTest('getPackageName', () async {
|
||||||
|
expect(await ChromeSafariBrowser.getPackageName(), isNotNull);
|
||||||
|
});
|
||||||
}, skip: shouldSkip);
|
}, skip: shouldSkip);
|
||||||
}
|
}
|
||||||
|
@ -19,21 +19,6 @@ class MyChromeSafariBrowser extends ChromeSafariBrowser {
|
|||||||
void onClosed() {
|
void onClosed() {
|
||||||
print("ChromeSafari browser closed");
|
print("ChromeSafari browser closed");
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
|
||||||
void onVerticalScrollEvent(bool isDirectionUp) {
|
|
||||||
print("onVerticalScrollEvent $isDirectionUp");
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void onGreatestScrollPercentageIncreased(int scrollPercentage) {
|
|
||||||
print("onGreatestScrollPercentageIncreased $scrollPercentage");
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void onSessionEnded(bool didUserInteract) {
|
|
||||||
print("onSessionEnded $didUserInteract");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class ChromeSafariBrowserExampleScreen extends StatefulWidget {
|
class ChromeSafariBrowserExampleScreen extends StatefulWidget {
|
||||||
@ -118,8 +103,7 @@ class _ChromeSafariBrowserExampleScreenState
|
|||||||
dismissButtonStyle: DismissButtonStyle.CLOSE,
|
dismissButtonStyle: DismissButtonStyle.CLOSE,
|
||||||
presentationStyle:
|
presentationStyle:
|
||||||
ModalPresentationStyle.OVER_FULL_SCREEN));
|
ModalPresentationStyle.OVER_FULL_SCREEN));
|
||||||
await Future.delayed(Duration(seconds: 5));
|
print(await ChromeSafariBrowser.getPackageName());
|
||||||
widget.browser.close();
|
|
||||||
},
|
},
|
||||||
child: Text("Open Chrome Safari Browser")),
|
child: Text("Open Chrome Safari Browser")),
|
||||||
));
|
));
|
||||||
|
@ -882,11 +882,11 @@ public class WebViewChannelDelegate : ChannelDelegate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public func onPermissionRequest(request: PermissionRequest, callback: PermissionRequestCallback) {
|
public func onPermissionRequest(request: PermissionRequest, callback: PermissionRequestCallback) {
|
||||||
guard let channel = channel else {
|
if channel == nil {
|
||||||
callback.defaultBehaviour(nil)
|
callback.defaultBehaviour(nil)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
channel.invokeMethod("onPermissionRequest", arguments: request.toMap(), callback: callback)
|
channel?.invokeMethod("onPermissionRequest", arguments: request.toMap(), callback: callback)
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ShouldOverrideUrlLoadingCallback : BaseCallbackResult<WKNavigationActionPolicy> {
|
public class ShouldOverrideUrlLoadingCallback : BaseCallbackResult<WKNavigationActionPolicy> {
|
||||||
@ -906,11 +906,11 @@ public class WebViewChannelDelegate : ChannelDelegate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public func shouldOverrideUrlLoading(navigationAction: WKNavigationAction, callback: ShouldOverrideUrlLoadingCallback) {
|
public func shouldOverrideUrlLoading(navigationAction: WKNavigationAction, callback: ShouldOverrideUrlLoadingCallback) {
|
||||||
guard let channel = channel else {
|
if channel == nil {
|
||||||
callback.defaultBehaviour(nil)
|
callback.defaultBehaviour(nil)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
channel.invokeMethod("shouldOverrideUrlLoading", arguments: navigationAction.toMap(), callback: callback)
|
channel?.invokeMethod("shouldOverrideUrlLoading", arguments: navigationAction.toMap(), callback: callback)
|
||||||
}
|
}
|
||||||
|
|
||||||
public func onLoadStart(url: String?) {
|
public func onLoadStart(url: String?) {
|
||||||
@ -961,7 +961,7 @@ public class WebViewChannelDelegate : ChannelDelegate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public func onReceivedHttpAuthRequest(challenge: HttpAuthenticationChallenge, callback: ReceivedHttpAuthRequestCallback) {
|
public func onReceivedHttpAuthRequest(challenge: HttpAuthenticationChallenge, callback: ReceivedHttpAuthRequestCallback) {
|
||||||
guard let channel = channel else {
|
if channel == nil {
|
||||||
callback.defaultBehaviour(nil)
|
callback.defaultBehaviour(nil)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -969,8 +969,12 @@ public class WebViewChannelDelegate : ChannelDelegate {
|
|||||||
// https://github.com/pichillilorenzo/flutter_inappwebview/issues/1678
|
// https://github.com/pichillilorenzo/flutter_inappwebview/issues/1678
|
||||||
DispatchQueue.global(qos: .background).async {
|
DispatchQueue.global(qos: .background).async {
|
||||||
let arguments = challenge.toMap()
|
let arguments = challenge.toMap()
|
||||||
DispatchQueue.main.async {
|
DispatchQueue.main.async { [weak self] in
|
||||||
channel.invokeMethod("onReceivedHttpAuthRequest", arguments: arguments, callback: callback)
|
if self?.channel == nil {
|
||||||
|
callback.defaultBehaviour(nil)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
self?.channel?.invokeMethod("onReceivedHttpAuthRequest", arguments: arguments, callback: callback)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -989,7 +993,7 @@ public class WebViewChannelDelegate : ChannelDelegate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public func onReceivedServerTrustAuthRequest(challenge: ServerTrustChallenge, callback: ReceivedServerTrustAuthRequestCallback) {
|
public func onReceivedServerTrustAuthRequest(challenge: ServerTrustChallenge, callback: ReceivedServerTrustAuthRequestCallback) {
|
||||||
guard let channel = channel else {
|
if channel == nil {
|
||||||
callback.defaultBehaviour(nil)
|
callback.defaultBehaviour(nil)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -997,8 +1001,12 @@ public class WebViewChannelDelegate : ChannelDelegate {
|
|||||||
// https://github.com/pichillilorenzo/flutter_inappwebview/issues/1678
|
// https://github.com/pichillilorenzo/flutter_inappwebview/issues/1678
|
||||||
DispatchQueue.global(qos: .background).async {
|
DispatchQueue.global(qos: .background).async {
|
||||||
let arguments = challenge.toMap()
|
let arguments = challenge.toMap()
|
||||||
DispatchQueue.main.async {
|
DispatchQueue.main.async { [weak self] in
|
||||||
channel.invokeMethod("onReceivedServerTrustAuthRequest", arguments: arguments, callback: callback)
|
if self?.channel == nil {
|
||||||
|
callback.defaultBehaviour(nil)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
self?.channel?.invokeMethod("onReceivedServerTrustAuthRequest", arguments: arguments, callback: callback)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1017,7 +1025,7 @@ public class WebViewChannelDelegate : ChannelDelegate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public func onReceivedClientCertRequest(challenge: ClientCertChallenge, callback: ReceivedClientCertRequestCallback) {
|
public func onReceivedClientCertRequest(challenge: ClientCertChallenge, callback: ReceivedClientCertRequestCallback) {
|
||||||
guard let channel = channel else {
|
if channel == nil {
|
||||||
callback.defaultBehaviour(nil)
|
callback.defaultBehaviour(nil)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -1025,8 +1033,12 @@ public class WebViewChannelDelegate : ChannelDelegate {
|
|||||||
// https://github.com/pichillilorenzo/flutter_inappwebview/issues/1678
|
// https://github.com/pichillilorenzo/flutter_inappwebview/issues/1678
|
||||||
DispatchQueue.global(qos: .background).async {
|
DispatchQueue.global(qos: .background).async {
|
||||||
let arguments = challenge.toMap()
|
let arguments = challenge.toMap()
|
||||||
DispatchQueue.main.async {
|
DispatchQueue.main.async { [weak self] in
|
||||||
channel.invokeMethod("onReceivedClientCertRequest", arguments: arguments, callback: callback)
|
if self?.channel == nil {
|
||||||
|
callback.defaultBehaviour(nil)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
self?.channel?.invokeMethod("onReceivedClientCertRequest", arguments: arguments, callback: callback)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1056,12 +1068,12 @@ public class WebViewChannelDelegate : ChannelDelegate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public func onLoadResourceWithCustomScheme(request: WebResourceRequest, callback: LoadResourceWithCustomSchemeCallback) {
|
public func onLoadResourceWithCustomScheme(request: WebResourceRequest, callback: LoadResourceWithCustomSchemeCallback) {
|
||||||
guard let channel = channel else {
|
if channel == nil {
|
||||||
callback.defaultBehaviour(nil)
|
callback.defaultBehaviour(nil)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
let arguments: [String: Any?] = ["request": request.toMap()]
|
let arguments: [String: Any?] = ["request": request.toMap()]
|
||||||
channel.invokeMethod("onLoadResourceWithCustomScheme", arguments: arguments, callback: callback)
|
channel?.invokeMethod("onLoadResourceWithCustomScheme", arguments: arguments, callback: callback)
|
||||||
}
|
}
|
||||||
|
|
||||||
public class CallJsHandlerCallback : BaseCallbackResult<Any> {
|
public class CallJsHandlerCallback : BaseCallbackResult<Any> {
|
||||||
@ -1074,7 +1086,7 @@ public class WebViewChannelDelegate : ChannelDelegate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public func onCallJsHandler(handlerName: String, args: String, callback: CallJsHandlerCallback) {
|
public func onCallJsHandler(handlerName: String, args: String, callback: CallJsHandlerCallback) {
|
||||||
guard let channel = channel else {
|
if channel == nil {
|
||||||
callback.defaultBehaviour(nil)
|
callback.defaultBehaviour(nil)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -1082,7 +1094,7 @@ public class WebViewChannelDelegate : ChannelDelegate {
|
|||||||
"handlerName": handlerName,
|
"handlerName": handlerName,
|
||||||
"args": args
|
"args": args
|
||||||
]
|
]
|
||||||
channel.invokeMethod("onCallJsHandler", arguments: arguments, callback: callback)
|
channel?.invokeMethod("onCallJsHandler", arguments: arguments, callback: callback)
|
||||||
}
|
}
|
||||||
|
|
||||||
public class NavigationResponseCallback : BaseCallbackResult<WKNavigationResponsePolicy> {
|
public class NavigationResponseCallback : BaseCallbackResult<WKNavigationResponsePolicy> {
|
||||||
@ -1102,11 +1114,11 @@ public class WebViewChannelDelegate : ChannelDelegate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public func onNavigationResponse(navigationResponse: WKNavigationResponse, callback: NavigationResponseCallback) {
|
public func onNavigationResponse(navigationResponse: WKNavigationResponse, callback: NavigationResponseCallback) {
|
||||||
guard let channel = channel else {
|
if channel == nil {
|
||||||
callback.defaultBehaviour(nil)
|
callback.defaultBehaviour(nil)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
channel.invokeMethod("onNavigationResponse", arguments: navigationResponse.toMap(), callback: callback)
|
channel?.invokeMethod("onNavigationResponse", arguments: navigationResponse.toMap(), callback: callback)
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ShouldAllowDeprecatedTLSCallback : BaseCallbackResult<Bool> {
|
public class ShouldAllowDeprecatedTLSCallback : BaseCallbackResult<Bool> {
|
||||||
@ -1126,7 +1138,7 @@ public class WebViewChannelDelegate : ChannelDelegate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public func shouldAllowDeprecatedTLS(challenge: URLAuthenticationChallenge, callback: ShouldAllowDeprecatedTLSCallback) {
|
public func shouldAllowDeprecatedTLS(challenge: URLAuthenticationChallenge, callback: ShouldAllowDeprecatedTLSCallback) {
|
||||||
guard let channel = channel else {
|
if channel == nil {
|
||||||
callback.defaultBehaviour(nil)
|
callback.defaultBehaviour(nil)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -1134,8 +1146,12 @@ public class WebViewChannelDelegate : ChannelDelegate {
|
|||||||
// https://github.com/pichillilorenzo/flutter_inappwebview/issues/1678
|
// https://github.com/pichillilorenzo/flutter_inappwebview/issues/1678
|
||||||
DispatchQueue.global(qos: .background).async {
|
DispatchQueue.global(qos: .background).async {
|
||||||
let arguments = challenge.toMap()
|
let arguments = challenge.toMap()
|
||||||
DispatchQueue.main.async {
|
DispatchQueue.main.async { [weak self] in
|
||||||
channel.invokeMethod("shouldAllowDeprecatedTLS", arguments: arguments, callback: callback)
|
if self?.channel == nil {
|
||||||
|
callback.defaultBehaviour(nil)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
self?.channel?.invokeMethod("shouldAllowDeprecatedTLS", arguments: arguments, callback: callback)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1178,7 +1194,7 @@ public class WebViewChannelDelegate : ChannelDelegate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public func onPrintRequest(url: URL?, printJobId: String?, callback: PrintRequestCallback) {
|
public func onPrintRequest(url: URL?, printJobId: String?, callback: PrintRequestCallback) {
|
||||||
guard let channel = channel else {
|
if channel == nil {
|
||||||
callback.defaultBehaviour(nil)
|
callback.defaultBehaviour(nil)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -1186,7 +1202,7 @@ public class WebViewChannelDelegate : ChannelDelegate {
|
|||||||
"url": url?.absoluteString,
|
"url": url?.absoluteString,
|
||||||
"printJobId": printJobId,
|
"printJobId": printJobId,
|
||||||
]
|
]
|
||||||
channel.invokeMethod("onPrintRequest", arguments: arguments, callback: callback)
|
channel?.invokeMethod("onPrintRequest", arguments: arguments, callback: callback)
|
||||||
}
|
}
|
||||||
|
|
||||||
public override func dispose() {
|
public override func dispose() {
|
||||||
|
@ -488,6 +488,29 @@ class ChromeSafariBrowser extends ChannelController {
|
|||||||
0;
|
0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///Returns the preferred package to use for Custom Tabs.
|
||||||
|
///The preferred package name is the default VIEW intent handler as long as it supports Custom Tabs.
|
||||||
|
///To modify this preferred behavior, set [ignoreDefault] to `true` and give a
|
||||||
|
///non empty list of package names in packages.
|
||||||
|
///This method queries the `PackageManager` to determine which packages support the Custom Tabs API.
|
||||||
|
///On apps that target Android 11 and above, this requires adding the following
|
||||||
|
///package visibility elements to your manifest.
|
||||||
|
///
|
||||||
|
///[packages] – Ordered list of packages to test for Custom Tabs support, in decreasing order of priority.
|
||||||
|
///
|
||||||
|
///[ignoreDefault] – If set, the default VIEW handler won't get priority over other browsers.
|
||||||
|
///
|
||||||
|
///Returns the preferred package name for handling Custom Tabs, or null.
|
||||||
|
///
|
||||||
|
///**Supported Platforms/Implementations**:
|
||||||
|
///- Android ([Official API - CustomTabsClient.getPackageName](https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsClient#getPackageName(android.content.Context,java.util.List%3Cjava.lang.String%3E,boolean))))
|
||||||
|
static Future<String?> getPackageName({List<String>? packages, bool ignoreDefault = false}) async {
|
||||||
|
Map<String, dynamic> args = <String, dynamic>{};
|
||||||
|
args.putIfAbsent("packages", () => packages);
|
||||||
|
args.putIfAbsent("ignoreDefault", () => ignoreDefault);
|
||||||
|
return await _sharedChannel.invokeMethod<String?>("getPackageName", args);
|
||||||
|
}
|
||||||
|
|
||||||
///Clear associated website data accrued from browsing activity within your app.
|
///Clear associated website data accrued from browsing activity within your app.
|
||||||
///This includes all local storage, cached resources, and cookies.
|
///This includes all local storage, cached resources, and cookies.
|
||||||
///
|
///
|
||||||
|
@ -845,11 +845,11 @@ public class WebViewChannelDelegate : ChannelDelegate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public func onPermissionRequest(request: PermissionRequest, callback: PermissionRequestCallback) {
|
public func onPermissionRequest(request: PermissionRequest, callback: PermissionRequestCallback) {
|
||||||
guard let channel = channel else {
|
if channel == nil {
|
||||||
callback.defaultBehaviour(nil)
|
callback.defaultBehaviour(nil)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
channel.invokeMethod("onPermissionRequest", arguments: request.toMap(), callback: callback)
|
channel?.invokeMethod("onPermissionRequest", arguments: request.toMap(), callback: callback)
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ShouldOverrideUrlLoadingCallback : BaseCallbackResult<WKNavigationActionPolicy> {
|
public class ShouldOverrideUrlLoadingCallback : BaseCallbackResult<WKNavigationActionPolicy> {
|
||||||
@ -869,11 +869,11 @@ public class WebViewChannelDelegate : ChannelDelegate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public func shouldOverrideUrlLoading(navigationAction: WKNavigationAction, callback: ShouldOverrideUrlLoadingCallback) {
|
public func shouldOverrideUrlLoading(navigationAction: WKNavigationAction, callback: ShouldOverrideUrlLoadingCallback) {
|
||||||
guard let channel = channel else {
|
if channel == nil {
|
||||||
callback.defaultBehaviour(nil)
|
callback.defaultBehaviour(nil)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
channel.invokeMethod("shouldOverrideUrlLoading", arguments: navigationAction.toMap(), callback: callback)
|
channel?.invokeMethod("shouldOverrideUrlLoading", arguments: navigationAction.toMap(), callback: callback)
|
||||||
}
|
}
|
||||||
|
|
||||||
public func onLoadStart(url: String?) {
|
public func onLoadStart(url: String?) {
|
||||||
@ -924,7 +924,7 @@ public class WebViewChannelDelegate : ChannelDelegate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public func onReceivedHttpAuthRequest(challenge: HttpAuthenticationChallenge, callback: ReceivedHttpAuthRequestCallback) {
|
public func onReceivedHttpAuthRequest(challenge: HttpAuthenticationChallenge, callback: ReceivedHttpAuthRequestCallback) {
|
||||||
guard let channel = channel else {
|
if channel == nil {
|
||||||
callback.defaultBehaviour(nil)
|
callback.defaultBehaviour(nil)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -932,8 +932,12 @@ public class WebViewChannelDelegate : ChannelDelegate {
|
|||||||
// https://github.com/pichillilorenzo/flutter_inappwebview/issues/1678
|
// https://github.com/pichillilorenzo/flutter_inappwebview/issues/1678
|
||||||
DispatchQueue.global(qos: .background).async {
|
DispatchQueue.global(qos: .background).async {
|
||||||
let arguments = challenge.toMap()
|
let arguments = challenge.toMap()
|
||||||
DispatchQueue.main.async {
|
DispatchQueue.main.async { [weak self] in
|
||||||
channel.invokeMethod("onReceivedHttpAuthRequest", arguments: arguments, callback: callback)
|
if self?.channel == nil {
|
||||||
|
callback.defaultBehaviour(nil)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
self?.channel?.invokeMethod("onReceivedHttpAuthRequest", arguments: arguments, callback: callback)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -952,7 +956,7 @@ public class WebViewChannelDelegate : ChannelDelegate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public func onReceivedServerTrustAuthRequest(challenge: ServerTrustChallenge, callback: ReceivedServerTrustAuthRequestCallback) {
|
public func onReceivedServerTrustAuthRequest(challenge: ServerTrustChallenge, callback: ReceivedServerTrustAuthRequestCallback) {
|
||||||
guard let channel = channel else {
|
if channel == nil {
|
||||||
callback.defaultBehaviour(nil)
|
callback.defaultBehaviour(nil)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -960,8 +964,12 @@ public class WebViewChannelDelegate : ChannelDelegate {
|
|||||||
// https://github.com/pichillilorenzo/flutter_inappwebview/issues/1678
|
// https://github.com/pichillilorenzo/flutter_inappwebview/issues/1678
|
||||||
DispatchQueue.global(qos: .background).async {
|
DispatchQueue.global(qos: .background).async {
|
||||||
let arguments = challenge.toMap()
|
let arguments = challenge.toMap()
|
||||||
DispatchQueue.main.async {
|
DispatchQueue.main.async { [weak self] in
|
||||||
channel.invokeMethod("onReceivedServerTrustAuthRequest", arguments: arguments, callback: callback)
|
if self?.channel == nil {
|
||||||
|
callback.defaultBehaviour(nil)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
self?.channel?.invokeMethod("onReceivedServerTrustAuthRequest", arguments: arguments, callback: callback)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -980,7 +988,7 @@ public class WebViewChannelDelegate : ChannelDelegate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public func onReceivedClientCertRequest(challenge: ClientCertChallenge, callback: ReceivedClientCertRequestCallback) {
|
public func onReceivedClientCertRequest(challenge: ClientCertChallenge, callback: ReceivedClientCertRequestCallback) {
|
||||||
guard let channel = channel else {
|
if channel == nil {
|
||||||
callback.defaultBehaviour(nil)
|
callback.defaultBehaviour(nil)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -988,8 +996,12 @@ public class WebViewChannelDelegate : ChannelDelegate {
|
|||||||
// https://github.com/pichillilorenzo/flutter_inappwebview/issues/1678
|
// https://github.com/pichillilorenzo/flutter_inappwebview/issues/1678
|
||||||
DispatchQueue.global(qos: .background).async {
|
DispatchQueue.global(qos: .background).async {
|
||||||
let arguments = challenge.toMap()
|
let arguments = challenge.toMap()
|
||||||
DispatchQueue.main.async {
|
DispatchQueue.main.async { [weak self] in
|
||||||
channel.invokeMethod("onReceivedClientCertRequest", arguments: arguments, callback: callback)
|
if self?.channel == nil {
|
||||||
|
callback.defaultBehaviour(nil)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
self?.channel?.invokeMethod("onReceivedClientCertRequest", arguments: arguments, callback: callback)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1019,12 +1031,12 @@ public class WebViewChannelDelegate : ChannelDelegate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public func onLoadResourceWithCustomScheme(request: WebResourceRequest, callback: LoadResourceWithCustomSchemeCallback) {
|
public func onLoadResourceWithCustomScheme(request: WebResourceRequest, callback: LoadResourceWithCustomSchemeCallback) {
|
||||||
guard let channel = channel else {
|
if channel == nil {
|
||||||
callback.defaultBehaviour(nil)
|
callback.defaultBehaviour(nil)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
let arguments: [String: Any?] = ["request": request.toMap()]
|
let arguments: [String: Any?] = ["request": request.toMap()]
|
||||||
channel.invokeMethod("onLoadResourceWithCustomScheme", arguments: arguments, callback: callback)
|
channel?.invokeMethod("onLoadResourceWithCustomScheme", arguments: arguments, callback: callback)
|
||||||
}
|
}
|
||||||
|
|
||||||
public class CallJsHandlerCallback : BaseCallbackResult<Any> {
|
public class CallJsHandlerCallback : BaseCallbackResult<Any> {
|
||||||
@ -1037,7 +1049,7 @@ public class WebViewChannelDelegate : ChannelDelegate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public func onCallJsHandler(handlerName: String, args: String, callback: CallJsHandlerCallback) {
|
public func onCallJsHandler(handlerName: String, args: String, callback: CallJsHandlerCallback) {
|
||||||
guard let channel = channel else {
|
if channel == nil {
|
||||||
callback.defaultBehaviour(nil)
|
callback.defaultBehaviour(nil)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -1045,7 +1057,7 @@ public class WebViewChannelDelegate : ChannelDelegate {
|
|||||||
"handlerName": handlerName,
|
"handlerName": handlerName,
|
||||||
"args": args
|
"args": args
|
||||||
]
|
]
|
||||||
channel.invokeMethod("onCallJsHandler", arguments: arguments, callback: callback)
|
channel?.invokeMethod("onCallJsHandler", arguments: arguments, callback: callback)
|
||||||
}
|
}
|
||||||
|
|
||||||
public class NavigationResponseCallback : BaseCallbackResult<WKNavigationResponsePolicy> {
|
public class NavigationResponseCallback : BaseCallbackResult<WKNavigationResponsePolicy> {
|
||||||
@ -1065,11 +1077,11 @@ public class WebViewChannelDelegate : ChannelDelegate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public func onNavigationResponse(navigationResponse: WKNavigationResponse, callback: NavigationResponseCallback) {
|
public func onNavigationResponse(navigationResponse: WKNavigationResponse, callback: NavigationResponseCallback) {
|
||||||
guard let channel = channel else {
|
if channel == nil {
|
||||||
callback.defaultBehaviour(nil)
|
callback.defaultBehaviour(nil)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
channel.invokeMethod("onNavigationResponse", arguments: navigationResponse.toMap(), callback: callback)
|
channel?.invokeMethod("onNavigationResponse", arguments: navigationResponse.toMap(), callback: callback)
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ShouldAllowDeprecatedTLSCallback : BaseCallbackResult<Bool> {
|
public class ShouldAllowDeprecatedTLSCallback : BaseCallbackResult<Bool> {
|
||||||
@ -1089,7 +1101,7 @@ public class WebViewChannelDelegate : ChannelDelegate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public func shouldAllowDeprecatedTLS(challenge: URLAuthenticationChallenge, callback: ShouldAllowDeprecatedTLSCallback) {
|
public func shouldAllowDeprecatedTLS(challenge: URLAuthenticationChallenge, callback: ShouldAllowDeprecatedTLSCallback) {
|
||||||
guard let channel = channel else {
|
if channel == nil {
|
||||||
callback.defaultBehaviour(nil)
|
callback.defaultBehaviour(nil)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -1097,8 +1109,12 @@ public class WebViewChannelDelegate : ChannelDelegate {
|
|||||||
// https://github.com/pichillilorenzo/flutter_inappwebview/issues/1678
|
// https://github.com/pichillilorenzo/flutter_inappwebview/issues/1678
|
||||||
DispatchQueue.global(qos: .background).async {
|
DispatchQueue.global(qos: .background).async {
|
||||||
let arguments = challenge.toMap()
|
let arguments = challenge.toMap()
|
||||||
DispatchQueue.main.async {
|
DispatchQueue.main.async { [weak self] in
|
||||||
channel.invokeMethod("shouldAllowDeprecatedTLS", arguments: arguments, callback: callback)
|
if self?.channel == nil {
|
||||||
|
callback.defaultBehaviour(nil)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
self?.channel?.invokeMethod("shouldAllowDeprecatedTLS", arguments: arguments, callback: callback)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1141,7 +1157,7 @@ public class WebViewChannelDelegate : ChannelDelegate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public func onPrintRequest(url: URL?, printJobId: String?, callback: PrintRequestCallback) {
|
public func onPrintRequest(url: URL?, printJobId: String?, callback: PrintRequestCallback) {
|
||||||
guard let channel = channel else {
|
if channel == nil {
|
||||||
callback.defaultBehaviour(nil)
|
callback.defaultBehaviour(nil)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -1149,7 +1165,7 @@ public class WebViewChannelDelegate : ChannelDelegate {
|
|||||||
"url": url?.absoluteString,
|
"url": url?.absoluteString,
|
||||||
"printJobId": printJobId,
|
"printJobId": printJobId,
|
||||||
]
|
]
|
||||||
channel.invokeMethod("onPrintRequest", arguments: arguments, callback: callback)
|
channel?.invokeMethod("onPrintRequest", arguments: arguments, callback: callback)
|
||||||
}
|
}
|
||||||
|
|
||||||
public override func dispose() {
|
public override func dispose() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user