Merge branch 'feat/disable-ios-delay' of https://github.com/andreasgangso/flutter_inappwebview into andreasgangso-feat/disable-ios-delay

This commit is contained in:
Lorenzo Pichilli 2023-11-09 15:46:04 +01:00
commit 34e6bea153
3 changed files with 9 additions and 1 deletions

View File

@ -10,6 +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) {

View File

@ -44,6 +44,7 @@ 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)

View File

@ -65,6 +65,8 @@ class InAppWebView extends StatefulWidget implements WebView {
///- iOS
final InAppWebViewKeepAlive? keepAlive;
final bool? preventGestureDelay;
///{@macro flutter_inappwebview.InAppWebView}
const InAppWebView({
Key? key,
@ -178,6 +180,7 @@ class InAppWebView extends StatefulWidget implements WebView {
this.onContentSizeChanged,
this.gestureRecognizers,
this.headlessWebView,
this.preventGestureDelay,
}) : super(key: key);
@override
@ -790,8 +793,11 @@ 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: 'com.pichillilorenzo/flutter_inappwebview',
viewType: viewType,
onPlatformViewCreated: _onPlatformViewCreated,
gestureRecognizers: widget.gestureRecognizers,
creationParams: <String, dynamic>{