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 513 of file FlutterPlatformViews.mm.

Method Documentation

◆ accessibilityContainer

- (id) accessibilityContainer

Provided by category FlutterTouchInterceptingView(Tests).

◆ blockGesture

- (void) blockGesture

Definition at line 510 of file FlutterPlatformViews.mm.

576  {
577  switch (_blockingPolicy) {
579  // We block all other gesture recognizers immediately in this policy.
580  self.delayingRecognizer.state = UIGestureRecognizerStateEnded;
581 
582  // On iOS 18.2, WKWebView's internal recognizer likely caches the old state of its blocking
583  // recognizers (i.e. delaying recognizer), resulting in non-tappable links. See
584  // https://github.com/flutter/flutter/issues/158961. Removing and adding back the delaying
585  // recognizer solves the problem, possibly because UIKit notifies all the recognizers related
586  // to (blocking or blocked by) this recognizer. It is not possible to inject this workaround
587  // from the web view plugin level. Right now we only observe this issue for
588  // FlutterPlatformViewGestureRecognizersBlockingPolicyEager, but we should try it if a similar
589  // issue arises for the other policy.
590  if (@available(iOS 18.2, *)) {
591  // This workaround is designed for WKWebView only. The 1P web view plugin provides a
592  // WKWebView itself as the platform view. However, some 3P plugins provide wrappers of
593  // WKWebView instead. So we perform DFS to search the view hierarchy (with a depth limit).
594  // Passing a limit of 0 means only searching for platform view itself; Pass 1 to include its
595  // children as well, and so on. We should be conservative and start with a small number. The
596  // AdMob banner has a WKWebView at depth 7.
597  if ([self containsWebView:self.embeddedView remainingSubviewDepth:1]) {
598  [self removeGestureRecognizer:self.delayingRecognizer];
599  [self addGestureRecognizer:self.delayingRecognizer];
600  }
601  }
602 
603  break;
605  if (self.delayingRecognizer.touchedEndedWithoutBlocking) {
606  // If touchesEnded of the `DelayingGesureRecognizer` has been already invoked,
607  // we want to set the state of the `DelayingGesureRecognizer` to
608  // `UIGestureRecognizerStateEnded` as soon as possible.
609  self.delayingRecognizer.state = UIGestureRecognizerStateEnded;
610  } else {
611  // If touchesEnded of the `DelayingGesureRecognizer` has not been invoked,
612  // We will set a flag to notify the `DelayingGesureRecognizer` to set the state to
613  // `UIGestureRecognizerStateEnded` when touchesEnded is called.
614  self.delayingRecognizer.shouldEndInNextTouchesEnded = YES;
615  }
616  break;
617  default:
618  break;
619  }
620 }
@ FlutterPlatformViewGestureRecognizersBlockingPolicyEager
@ FlutterPlatformViewGestureRecognizersBlockingPolicyWaitUntilTouchesEnded

◆ embeddedView

- (UIView*) embeddedView

◆ initWithEmbeddedView:platformViewsController:gestureRecognizersBlockingPolicy:

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

Definition at line 510 of file FlutterPlatformViews.mm.

514  :(UIView*)embeddedView
515  platformViewsController:(FlutterPlatformViewsController*)platformViewsController
516  gestureRecognizersBlockingPolicy:
518  self = [super initWithFrame:embeddedView.frame];
519  if (self) {
520  self.multipleTouchEnabled = YES;
521  _embeddedView = embeddedView;
522  embeddedView.autoresizingMask =
523  (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight);
524 
525  [self addSubview:embeddedView];
526 
527  ForwardingGestureRecognizer* forwardingRecognizer =
528  [[ForwardingGestureRecognizer alloc] initWithTarget:self
529  platformViewsController:platformViewsController];
530 
531  _delayingRecognizer =
532  [[FlutterDelayingGestureRecognizer alloc] initWithTarget:self
533  action:nil
534  forwardingRecognizer:forwardingRecognizer];
535  _blockingPolicy = blockingPolicy;
536 
537  [self addGestureRecognizer:_delayingRecognizer];
538  [self addGestureRecognizer:forwardingRecognizer];
539  }
540  return self;
541 }
FlutterPlatformViewGestureRecognizersBlockingPolicy

◆ releaseGesture

- (void) releaseGesture

Definition at line 510 of file FlutterPlatformViews.mm.

557  {
558  self.delayingRecognizer.state = UIGestureRecognizerStateFailed;
559 }

Property Documentation

◆ flutterAccessibilityContainer

- (id) flutterAccessibilityContainer
readwritenonatomicretain

Definition at line 150 of file FlutterPlatformViews_Internal.h.


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