)]}'
{
  "commit": "e41a7629654a018655e80358826ccc94bf81efc9",
  "tree": "6939a82ad76c076732d3ffd77e60fcf1f6ee6494",
  "parents": [
    "95339e2bcbc12a0317d9d9c600d487f0dc9010c4"
  ],
  "author": {
    "name": "hellohuanlin",
    "email": "41930132+hellohuanlin@users.noreply.github.com",
    "time": "Thu Oct 10 19:24:43 2024 -0700"
  },
  "committer": {
    "name": "GitHub",
    "email": "noreply@github.com",
    "time": "Fri Oct 11 02:24:43 2024 +0000"
  },
  "message": "[ios][platform_view] Fix Platform view gesture recognizer with iPad pencil getting stuck (#55724)\n\n## Summary \r\n\r\nI came across our the \"gesture recognizer delegate\" implementation and it is quite odd (see below). After fixing it, the problem is resolved. However, it\u0027s hard to reason about how it\u0027s related to iPad pencil, since it\u0027s internal logic that we don\u0027t know (see my research below). \r\n\r\n## Gesture recognizer delegate\r\n\r\n### Existing odd implementation\r\n\r\n- shouldBeRequiredToFailByGestureRecognizer: \r\n\r\n`otherGestureRecognizer !\u003d self` is always YES because the delegate set to self, hence `gestureRecognizer` must be self, hence `otherGestureRecognizer` must not be self. \r\n\r\n- shouldRequireFailureOfGestureRecognizer: \r\n\r\n`otherGestureRecognizer \u003d\u003d self` is always NO, for the same reason described above. \r\n\r\n### new implementation: \r\n\r\nAfter digging into various PRs, the idea seems to be that we want to have a precedence of \"Forwarding recognizer \u003e  Delaying recognizer \u003e Other recognizers in platform view\". \r\n\r\n- shouldBeRequiredToFailByGestureRecognizer:\r\n\r\n`return otherGestureRecognizer !\u003d _forwardingRecognizer` means Delaying recognizer needs to be higher precedence than all non-Forwarding recognizer. (aka \"Delaying recognizer \u003e Other recognizers in platform view\")\r\n\r\n- shouldRequireFailureOfGestureRecognizer:\r\n\r\n`return otherGestureRecognizer \u003d\u003d _forwardingRecognizer` means Delaying recognizer needs to have lower precedence than forwarding recognizer. (aka \"Forwarding recognizer \u003e Delaying recognizer\"). \r\n\r\n## Some research\r\n\r\nThis is a tricky one since pencil and finger triggers exactly the same callbacks. It turns out that when pencil is involved after finger interaction, the platform view\u0027s \"forwarding\" gesture recognizer is stuck at failed state. This seems to be an iOS bug, because according to [the API doc](https://developer.apple.com/documentation/uikit/uigesturerecognizerstate/uigesturerecognizerstatefailed?language\u003dobjc), it should be reset back to \"possible\" state:\r\n\r\n\u003e No action message is sent and the gesture recognizer is reset to [UIGestureRecognizerStatePossible](https://developer.apple.com/documentation/uikit/uigesturerecognizerstate/uigesturerecognizerstatepossible?language\u003dobjc).\r\n\r\nHowever, when iPad pencil is involved, the state is not reset. I tried to KVO the state property, and wasn\u0027t able to capture the change. This means the state change very likely happened internally within the recognizer via the backing ivar of the state property.\r\n\r\n*List which issues are fixed by this PR. You must list at least one issue.*\r\n\r\nFixes https://github.com/flutter/flutter/issues/136244\r\n\r\n*If you had to change anything in the [flutter/tests] repo, include a link to the migration guide as per the [breaking change policy].*\r\n\r\n[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "904a3eace256445b49c0a7b5dfe58a42ce8fc3e8",
      "old_mode": 33188,
      "old_path": "shell/platform/darwin/ios/framework/Source/FlutterPlatformViewsTest.mm",
      "new_id": "0013657a6ab3301b2f84eb713831da8f6ba62aaf",
      "new_mode": 33188,
      "new_path": "shell/platform/darwin/ios/framework/Source/FlutterPlatformViewsTest.mm"
    },
    {
      "type": "modify",
      "old_id": "5e76654bed1793ee28f8cb0c811a6db37aba42e2",
      "old_mode": 33188,
      "old_path": "shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.mm",
      "new_id": "90c4d42e1dadf2c9b5183fe8a9fef38f1aa808a3",
      "new_mode": 33188,
      "new_path": "shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.mm"
    }
  ]
}
