updated InAppWebView.preventGestureDelay native implementation for ios
This commit is contained in:
parent
34e6bea153
commit
a7030772be
|
@ -1,3 +1,7 @@
|
|||
## 6.0.0-beta.26
|
||||
|
||||
- Merged "feat(ios): optional tradeoff to fix ios input delay" [#1665](https://github.com/pichillilorenzo/flutter_inappwebview/pull/1665) (thanks to [andreasgangso](https://github.com/andreasgangso))
|
||||
|
||||
## 6.0.0-beta.25
|
||||
|
||||
- Updated `androidx.webkit:webkit` dependency to `1.8.0`
|
||||
|
|
|
@ -40,7 +40,7 @@ void openAndClose() {
|
|||
activityButton: ActivityButton(
|
||||
templateImage: UIImage(systemName: "sun.max"),
|
||||
extensionIdentifier:
|
||||
"com.pichillilorenzo.flutter-inappwebview-example7.test")));
|
||||
"com.pichillilorenzo.flutter-inappwebview-example1.test")));
|
||||
await chromeSafariBrowser.opened.future;
|
||||
expect(chromeSafariBrowser.isOpened(), true);
|
||||
expect(() async {
|
||||
|
|
|
@ -208,9 +208,9 @@
|
|||
9740EEB61CF901F6004384FC /* Run Script */,
|
||||
97C146EA1CF9000F007C117D /* Sources */,
|
||||
97C146EB1CF9000F007C117D /* Frameworks */,
|
||||
6174FE1725CEB74E00A5020C /* Embed Foundation Extensions */,
|
||||
97C146EC1CF9000F007C117D /* Resources */,
|
||||
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
|
||||
6174FE1725CEB74E00A5020C /* Embed Foundation Extensions */,
|
||||
DFFD8453B8E169BF6BE74B49 /* [CP] Embed Pods Frameworks */,
|
||||
);
|
||||
buildRules = (
|
||||
|
@ -231,7 +231,7 @@
|
|||
attributes = {
|
||||
BuildIndependentTargetsInParallel = YES;
|
||||
LastSwiftUpdateCheck = 1400;
|
||||
LastUpgradeCheck = 1300;
|
||||
LastUpgradeCheck = 1430;
|
||||
ORGANIZATIONNAME = "The Chromium Authors";
|
||||
TargetAttributes = {
|
||||
6143FF34290959650014A1FC = {
|
||||
|
@ -241,7 +241,6 @@
|
|||
};
|
||||
97C146ED1CF9000F007C117D = {
|
||||
CreatedOnToolsVersion = 7.3.1;
|
||||
DevelopmentTeam = PFP8UV45Y6;
|
||||
LastSwiftMigration = 1020;
|
||||
ProvisioningStyle = Automatic;
|
||||
SystemCapabilities = {
|
||||
|
@ -461,7 +460,7 @@
|
|||
MARKETING_VERSION = 1.0;
|
||||
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
|
||||
MTL_FAST_MATH = YES;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "com.pichillilorenzo.flutter-inappwebview-example7.test";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "com.pichillilorenzo.flutter-inappwebview-example1.test";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SKIP_INSTALL = YES;
|
||||
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
|
||||
|
@ -498,7 +497,7 @@
|
|||
);
|
||||
MARKETING_VERSION = 1.0;
|
||||
MTL_FAST_MATH = YES;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "com.pichillilorenzo.flutter-inappwebview-example7.test";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "com.pichillilorenzo.flutter-inappwebview-example1.test";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SKIP_INSTALL = YES;
|
||||
SWIFT_EMIT_LOC_STRINGS = YES;
|
||||
|
@ -647,7 +646,7 @@
|
|||
"$(inherited)",
|
||||
"$(PROJECT_DIR)/Flutter",
|
||||
);
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "com.pichillilorenzo.flutter-inappwebview-example7";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "com.pichillilorenzo.flutter-inappwebview-example1";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
||||
|
@ -682,7 +681,7 @@
|
|||
"$(inherited)",
|
||||
"$(PROJECT_DIR)/Flutter",
|
||||
);
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "com.pichillilorenzo.flutter-inappwebview-example7";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "com.pichillilorenzo.flutter-inappwebview-example1";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "1300"
|
||||
LastUpgradeVersion = "1430"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
|
|
|
@ -10,7 +10,7 @@ import Foundation
|
|||
|
||||
public class FlutterWebViewFactory: NSObject, FlutterPlatformViewFactory {
|
||||
static let VIEW_TYPE_ID = "com.pichillilorenzo/flutter_inappwebview"
|
||||
static let NON_BLOCKING_VIEW_TYPE_ID = "com.pichillilorenzo/flutter_inappwebview_nonblocking"
|
||||
|
||||
private var plugin: SwiftFlutterPlugin
|
||||
|
||||
init(plugin: SwiftFlutterPlugin) {
|
||||
|
@ -29,6 +29,7 @@ public class FlutterWebViewFactory: NSObject, FlutterPlatformViewFactory {
|
|||
|
||||
let keepAliveId = arguments?["keepAliveId"] as? String
|
||||
let headlessWebViewId = arguments?["headlessWebViewId"] as? String
|
||||
let preventGestureDelay = arguments?["preventGestureDelay"] as? Bool ?? false
|
||||
|
||||
if let headlessWebViewId = headlessWebViewId,
|
||||
let headlessWebView = plugin.headlessInAppWebViewManager?.webViews[headlessWebViewId],
|
||||
|
@ -62,6 +63,8 @@ public class FlutterWebViewFactory: NSObject, FlutterPlatformViewFactory {
|
|||
plugin.inAppWebViewManager?.keepAliveWebViews[keepAliveId] = flutterWebView!
|
||||
}
|
||||
|
||||
flutterWebView?.webView()?.preventGestureDelay = preventGestureDelay
|
||||
|
||||
if shouldMakeInitialLoad {
|
||||
flutterWebView?.makeInitialLoad(params: arguments!)
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@ public class InAppWebView: WKWebView, UIScrollViewDelegate, WKUIDelegate,
|
|||
var webMessageListeners: [WebMessageListener] = []
|
||||
var currentOriginalUrl: URL?
|
||||
var inFullscreen = false
|
||||
var preventGestureDelay = false
|
||||
|
||||
static var sslCertificatesMap: [String: SslCertificate] = [:] // [URL host name : SslCertificate]
|
||||
static var credentialsProposed: [URLCredential] = []
|
||||
|
@ -240,6 +241,15 @@ public class InAppWebView: WKWebView, UIScrollViewDelegate, WKUIDelegate,
|
|||
}
|
||||
}
|
||||
|
||||
// https://github.com/pichillilorenzo/flutter_inappwebview/pull/1665
|
||||
if preventGestureDelay, let gestures = superview?.superview?.gestureRecognizers {
|
||||
for gesture in gestures {
|
||||
if NSStringFromClass(type(of: gesture)) == "DelayingGestureRecognizer" {
|
||||
gesture.isEnabled = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return super.hitTest(point, with: event)
|
||||
}
|
||||
|
||||
|
|
|
@ -44,7 +44,6 @@ public class SwiftFlutterPlugin: NSObject, FlutterPlugin {
|
|||
|
||||
self.registrar = registrar
|
||||
registrar.register(FlutterWebViewFactory(plugin: self) as FlutterPlatformViewFactory, withId: FlutterWebViewFactory.VIEW_TYPE_ID)
|
||||
registrar.register(FlutterWebViewFactory(plugin: self) as FlutterPlatformViewFactory, withId: FlutterWebViewFactory.NON_BLOCKING_VIEW_TYPE_ID, gestureRecognizersBlockingPolicy:FlutterPlatformViewGestureRecognizersBlockingPolicyWaitUntilTouchesEnded)
|
||||
|
||||
platformUtil = PlatformUtil(plugin: self)
|
||||
inAppBrowserManager = InAppBrowserManager(plugin: self)
|
||||
|
|
|
@ -65,6 +65,11 @@ class InAppWebView extends StatefulWidget implements WebView {
|
|||
///- iOS
|
||||
final InAppWebViewKeepAlive? keepAlive;
|
||||
|
||||
///Used to prevent gesture delay on iOS caused by Flutter's gestures handling
|
||||
///between native/platform views.
|
||||
///
|
||||
///**Supported Platforms/Implementations**:
|
||||
///- iOS
|
||||
final bool? preventGestureDelay;
|
||||
|
||||
///{@macro flutter_inappwebview.InAppWebView}
|
||||
|
@ -793,11 +798,8 @@ class _InAppWebViewState extends State<InAppWebView> {
|
|||
},
|
||||
);
|
||||
} else if (Util.isIOS /* || Util.isMacOS*/) {
|
||||
final viewType = widget.preventGestureDelay == true
|
||||
? 'com.pichillilorenzo/flutter_inappwebview_nonblocking'
|
||||
: 'com.pichillilorenzo/flutter_inappwebview';
|
||||
return UiKitView(
|
||||
viewType: viewType,
|
||||
viewType: 'com.pichillilorenzo/flutter_inappwebview',
|
||||
onPlatformViewCreated: _onPlatformViewCreated,
|
||||
gestureRecognizers: widget.gestureRecognizers,
|
||||
creationParams: <String, dynamic>{
|
||||
|
@ -813,7 +815,8 @@ class _InAppWebViewState extends State<InAppWebView> {
|
|||
'initialUserScripts':
|
||||
widget.initialUserScripts?.map((e) => e.toMap()).toList() ?? [],
|
||||
'pullToRefreshSettings': pullToRefreshSettings,
|
||||
'keepAliveId': widget.keepAlive?.id
|
||||
'keepAliveId': widget.keepAlive?.id,
|
||||
'preventGestureDelay': widget.preventGestureDelay
|
||||
},
|
||||
creationParamsCodec: const StandardMessageCodec(),
|
||||
);
|
||||
|
|
|
@ -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.25
|
||||
version: 6.0.0-beta.26
|
||||
homepage: https://inappwebview.dev/
|
||||
repository: https://github.com/pichillilorenzo/flutter_inappwebview
|
||||
issue_tracker: https://github.com/pichillilorenzo/flutter_inappwebview/issues
|
||||
|
|
Loading…
Reference in New Issue