Flutter iOS Embedder
FlutterTouchInterceptingView Class Reference

#import <FlutterPlatformViews_Internal.h>

Inheritance diagram for FlutterTouchInterceptingView:

Instance Methods

(instancetype) - initWithEmbeddedView:platformViewsController:gestureRecognizersBlockingPolicy:
 
(void) - releaseGesture
 
(void) - blockGesture
 
(UIView *) - embeddedView
 
(id) - accessibilityContainer
 

Properties

id flutterAccessibilityContainer
 

Detailed Description

Definition at line 524 of file FlutterPlatformViews.mm.

Method Documentation

◆ accessibilityContainer

- (id) accessibilityContainer

Provided by category FlutterTouchInterceptingView(Tests).

◆ blockGesture

- (void) blockGesture

Definition at line 521 of file FlutterPlatformViews.mm.

617  {
618  switch (_blockingPolicy) {
620  // We block all other gesture recognizers immediately in this policy.
621  self.delayingRecognizer.state = UIGestureRecognizerStateEnded;
622 
623  // On iOS 18.2, WKWebView's internal recognizer likely caches the old state of its blocking
624  // recognizers (i.e. delaying recognizer), resulting in non-tappable links. See
625  // https://github.com/flutter/flutter/issues/158961. Removing and adding back the delaying
626  // recognizer solves the problem, possibly because UIKit notifies all the recognizers related
627  // to (blocking or blocked by) this recognizer. It is not possible to inject this workaround
628  // from the web view plugin level. Right now we only observe this issue for
629  // FlutterPlatformViewGestureRecognizersBlockingPolicyEager, but we should try it if a similar
630  // issue arises for the other policy.
631  if (@available(iOS 26.0, *)) {
632  // This performs a nested DFS, with the outer one searching for any web view, and the inner
633  // one searching for a TouchEventsGestureRecognizer inside the web view. Once found, disable
634  // and immediately reenable it to reset its state.
635  // TODO(hellohuanlin): remove this flag after it is battle tested.
636  NSNumber* isWorkaroundDisabled =
637  [[NSBundle mainBundle] objectForInfoDictionaryKey:@"FLTDisableWebViewGestureReset"];
638  if (!isWorkaroundDisabled.boolValue) {
639  [self searchAndFixWebView:self.embeddedView];
640  }
641  } else if (@available(iOS 18.2, *)) {
642  // The 1P web view plugin provides a WKWebView itself as the platform view. However, some 3P
643  // plugins provide wrappers of WKWebView instead, and AdMob banner has a WKWebView at
644  // depth 7. So we perform DFS to search the view hierarchy.
645  if ([self containsWebView:self.embeddedView]) {
646  [self removeGestureRecognizer:self.delayingRecognizer];
647  [self addGestureRecognizer:self.delayingRecognizer];
648  }
649  }
650 
651  break;
653  if (self.delayingRecognizer.touchedEndedWithoutBlocking) {
654  // If touchesEnded of the `DelayingGesureRecognizer` has been already invoked,
655  // we want to set the state of the `DelayingGesureRecognizer` to
656  // `UIGestureRecognizerStateEnded` as soon as possible.
657  self.delayingRecognizer.state = UIGestureRecognizerStateEnded;
658  } else {
659  // If touchesEnded of the `DelayingGesureRecognizer` has not been invoked,
660  // We will set a flag to notify the `DelayingGesureRecognizer` to set the state to
661  // `UIGestureRecognizerStateEnded` when touchesEnded is called.
662  self.delayingRecognizer.shouldEndInNextTouchesEnded = YES;
663  }
664  break;
665  default:
666  break;
667  }
668 }
@ FlutterPlatformViewGestureRecognizersBlockingPolicyEager
@ FlutterPlatformViewGestureRecognizersBlockingPolicyWaitUntilTouchesEnded

◆ embeddedView

- (UIView*) embeddedView

◆ initWithEmbeddedView:platformViewsController:gestureRecognizersBlockingPolicy:

- (instancetype) initWithEmbeddedView: (UIView*)  embeddedView
platformViewsController: (FlutterPlatformViewsController*)  platformViewsController
gestureRecognizersBlockingPolicy: (FlutterPlatformViewGestureRecognizersBlockingPolicy blockingPolicy 

Definition at line 521 of file FlutterPlatformViews.mm.

525  :(UIView*)embeddedView
526  platformViewsController:(FlutterPlatformViewsController*)platformViewsController
527  gestureRecognizersBlockingPolicy:
529  self = [super initWithFrame:embeddedView.frame];
530  if (self) {
531  self.multipleTouchEnabled = YES;
532  _embeddedView = embeddedView;
533  embeddedView.autoresizingMask =
534  (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight);
535 
536  [self addSubview:embeddedView];
537 
538  ForwardingGestureRecognizer* forwardingRecognizer =
539  [[ForwardingGestureRecognizer alloc] initWithTarget:self
540  platformViewsController:platformViewsController];
541 
542  _delayingRecognizer =
543  [[FlutterDelayingGestureRecognizer alloc] initWithTarget:self
544  action:nil
545  forwardingRecognizer:forwardingRecognizer];
546  _blockingPolicy = blockingPolicy;
547 
548  [self addGestureRecognizer:_delayingRecognizer];
549  [self addGestureRecognizer:forwardingRecognizer];
550  }
551  return self;
552 }
FlutterPlatformViewGestureRecognizersBlockingPolicy

◆ releaseGesture

- (void) releaseGesture

Definition at line 521 of file FlutterPlatformViews.mm.

568  {
569  self.delayingRecognizer.state = UIGestureRecognizerStateFailed;
570 }

Property Documentation

◆ flutterAccessibilityContainer

- (id) flutterAccessibilityContainer
readwritenonatomicretain

Definition at line 158 of file FlutterPlatformViews_Internal.h.


The documentation for this class was generated from the following files: