Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

fix(mobile): 修复 Android 滚动接管后的消息文字误选

DavidShen4de82d8f4aa3
diff --git a/dependency-patches/README.md b/dependency-patches/README.md
index 3cc9547468..2686ca8202 100644
--- a/dependency-patches/README.md
+++ b/dependency-patches/README.md
@@ -15,6 +15,7 @@
| `[email protected]` | `Stack.Toolbar.Menu` 子菜单透传 `subtitle`,让 iOS 顶栏菜单的一级行在标题下显示当前值(如「任务信息」下显示已选项)。配合下方 `react-native-screens` 补丁生效。 |
| `harmonyos-sans-sc-webfont-splitted` | 移除依赖按语言全局覆盖 `font-family` 的规则,由 Cindy 自己决定界面字体。 |
| `[email protected]` | 回移 Yoga 对 `display: none` 与 `display: contents` 测量过程的布局状态修复,避免 Fabric 布局阶段因错误的 owner 关系触发断言崩溃(上游 `6fa330693fba313a2fe1121545c1efd558b60983`、`2546ce4d8219050fcd1bf432c7c830c9fd70c9af`)。移动端 iOS 通过 `expo-build-properties` 的 `buildReactNativeFromSource` 编译该补丁,不能改回预编译 RN Core。 |
+| `[email protected]` | 修复 Android 手势桥接管滚动时文字子视图收不到 `ACTION_CANCEL`、抬手后仍触发长按误选的问题([#6219](https://github.com/makecindy/cindy/issues/6219))。`ScrollViewHook` 经 `dispatchTouchEvent` 保留系统对子视图的取消分发,保留文字选择及滚动。修改原生依赖会改变 runtime fingerprint,须重新构建并随冷更发布;升级 RNGH 时核查上游是否已有等价修复。 |
| `[email protected]` | iOS 顶栏菜单支持「保持展开」的复选:原实现每次顶栏更新都先清空再重建全部 bar button,展开中的菜单必然被关掉。补丁改为只在按钮列表真正变化时才赋值,顶栏里的普通按钮与菜单按钮在配置(菜单除外)不变时都复用原对象;菜单结构不变时原地写入勾选/副标题/禁用(整份替换会让打开的子菜单退回根层),并通过系统 `updateVisibleMenu` 把这些值同步到正在显示的菜单副本;复选项点击时立即翻转勾选;子菜单支持 `subtitle`。改变 iOS 原生指纹,需随冷更发版。 |
| `[email protected]` | 修复 iOS 长文本渲染闪烁、布局性能、文本选择与选择手柄滚动等问题,并支持自定义选择菜单操作。 |
| `[email protected]` | 将 Cindy 的文本引用操作并入 iOS 系统选择菜单,同时保留复制、翻译等系统操作。 |
diff --git a/dependency-patches/[email protected] b/dependency-patches/[email protected]
new file mode 100644
index 0000000000..eca6322f17
--- /dev/null
+++ b/dependency-patches/[email protected]
@@ -0,0 +1,28 @@
+diff --git a/android/src/main/java/com/swmansion/gesturehandler/core/NativeViewGestureHandler.kt b/android/src/main/java/com/swmansion/gesturehandler/core/NativeViewGestureHandler.kt
+index 83292244551410154a4efa0e243cc906dd13a30f..8159793328699b58a3100758f992fcd0305e56b2 100644
+--- a/android/src/main/java/com/swmansion/gesturehandler/core/NativeViewGestureHandler.kt
++++ b/android/src/main/java/com/swmansion/gesturehandler/core/NativeViewGestureHandler.kt
+@@ -335,7 +335,23 @@ class NativeViewGestureHandler : GestureHandler() {
+ }
+
+ private class ScrollViewHook : NativeViewGestureHandlerHook {
++ private var dispatchingInterceptedStream = false
++
+ override fun shouldCancelRootViewGestureHandlerIfNecessary() = true
++
++ override fun sendTouchEvent(view: View?, event: MotionEvent): Boolean? {
++ val terminal = event.actionMasked == MotionEvent.ACTION_UP || event.actionMasked == MotionEvent.ACTION_CANCEL
++ // Before activation, UP/CANCEL still belong to the normal root dispatch.
++ // Redispatching them here interrupts selectable text's native action mode.
++ if (!dispatchingInterceptedStream && terminal) return view?.onTouchEvent(event)
++
++ // Interception bypasses root dispatch. Let the ScrollView cancel its child
++ // touch target, or text can run a pending long-press after UP (Cindy #6219).
++ dispatchingInterceptedStream = true
++ val handled = view?.dispatchTouchEvent(event)
++ if (terminal) dispatchingInterceptedStream = false
++ return handled
++ }
+ }
+
+ private class ReactViewGroupHook : NativeViewGestureHandlerHook {
diff --git a/package.json b/package.json
index 7a6a265501..0a88b78ed9 100644
--- a/package.json
+++ b/package.json
@@ -68,7 +68,8 @@
"[email protected]": "dependency-patches/[email protected]",
"@expo/[email protected]": "dependency-patches/@[email protected]",
"[email protected]": "dependency-patches/[email protected]",
- "[email protected]": "dependency-patches/[email protected]"
+ "[email protected]": "dependency-patches/[email protected]",
+ "[email protected]": "dependency-patches/[email protected]"
},
"allowUnusedPatches": true
},
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index b0810cf61b..1496623988 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -34,6 +34,9 @@ patchedDependencies:
harmonyos-sans-sc-webfont-splitted:
hash: 272e3ded46880ee2f9eaff39327b8465de6df4072271de03caf73950e6e57822
path: dependency-patches/harmonyos-sans-sc-webfont-splitted.patch
+ hash: 15837ee0682cd5d6df449cdfc1348d9742ae83c56f9e3cb6d163bff67dfcc818
+ path: dependency-patches/[email protected]
hash: a43177abd7b38a283598e880a738eab3f69580e3c5dfea51dc2572570fafc7b1
path: dependency-patches/[email protected]
@@ -749,7 +752,7 @@ importers:
version: 0.2.2(patch_hash=53be555646735a171c1624f074ef30e5ca897a7b8893724bc2d0d51682f769d8)([email protected])([email protected](@babel/[email protected])(@react-native/[email protected](@babel/[email protected]))(@types/[email protected])([email protected]))([email protected])
expo-router:
specifier: ^57.0.17
- version: 57.0.17(patch_hash=47c33e2e770bd4fe9549dc8651c3c1326603ef78213b0539ba421823ac1804cc)(1c799d85090b7a9d80343b83403fa615)
+ version: 57.0.17(patch_hash=47c33e2e770bd4fe9549dc8651c3c1326603ef78213b0539ba421823ac1804cc)(bda5a67c5d62adabeb58a0e0d4227159)
expo-secure-store:
specifier: ^57.0.2
version: 57.0.2([email protected])
@@ -794,7 +797,7 @@ importers:
version: 0.86.3(@babel/[email protected])(@react-native/[email protected](@babel/[email protected]))(@types/[email protected])([email protected])
react-native-gesture-handler:
specifier: 2.32.0
+ version: 2.32.0(patch_hash=15837ee0682cd5d6df449cdfc1348d9742ae83c56f9e3cb6d163bff67dfcc818)([email protected](@babel/[email protected])(@react-native/[email protected](@babel/[email protected]))(@types/[email protected])([email protected]))([email protected])
react-native-reanimated:
specifier: 4.5.1
@@ -13136,7 +13139,7 @@ snapshots:
ws: 8.21.1
zod: 4.3.6
optionalDependencies:
- expo-router: 57.0.17(patch_hash=47c33e2e770bd4fe9549dc8651c3c1326603ef78213b0539ba421823ac1804cc)(1c799d85090b7a9d80343b83403fa615)
+ expo-router: 57.0.17(patch_hash=47c33e2e770bd4fe9549dc8651c3c1326603ef78213b0539ba421823ac1804cc)(bda5a67c5d62adabeb58a0e0d4227159)
react-native: 0.86.3(@babel/[email protected])(@react-native/[email protected](@babel/[email protected]))(@types/[email protected])([email protected])
transitivePeerDependencies:
- '@expo/dom-webview'
@@ -13421,7 +13424,7 @@ snapshots:
react: 19.2.3
optionalDependencies:
- expo-router: 57.0.17(patch_hash=47c33e2e770bd4fe9549dc8651c3c1326603ef78213b0539ba421823ac1804cc)(1c799d85090b7a9d80343b83403fa615)
+ expo-router: 57.0.17(patch_hash=47c33e2e770bd4fe9549dc8651c3c1326603ef78213b0539ba421823ac1804cc)(bda5a67c5d62adabeb58a0e0d4227159)
react-dom: 19.2.3([email protected])
transitivePeerDependencies:
- supports-color
@@ -18028,7 +18031,7 @@ snapshots:
react: 19.2.3
react-native: 0.86.3(@babel/[email protected])(@react-native/[email protected](@babel/[email protected]))(@types/[email protected])([email protected])
- [email protected](patch_hash=47c33e2e770bd4fe9549dc8651c3c1326603ef78213b0539ba421823ac1804cc)(1c799d85090b7a9d80343b83403fa615):
+ [email protected](patch_hash=47c33e2e770bd4fe9549dc8651c3c1326603ef78213b0539ba421823ac1804cc)(bda5a67c5d62adabeb58a0e0d4227159):
dependencies:
@@ -18055,7 +18058,7 @@ snapshots:
react-fast-compare: 3.2.2
react-is: 19.2.7
react-native: 0.86.3(@babel/[email protected])(@react-native/[email protected](@babel/[email protected]))(@types/[email protected])([email protected])
react-native-safe-area-context: 5.7.0([email protected](@babel/[email protected])(@react-native/[email protected](@babel/[email protected]))(@types/[email protected])([email protected]))([email protected])
react-native-screens: 4.26.2(patch_hash=a43177abd7b38a283598e880a738eab3f69580e3c5dfea51dc2572570fafc7b1)([email protected](@babel/[email protected])(@react-native/[email protected](@babel/[email protected]))(@types/[email protected])([email protected]))([email protected])
server-only: 0.0.1
@@ -18065,7 +18068,7 @@ snapshots:
optionalDependencies:
react-dom: 19.2.3([email protected])
- react-native-gesture-handler: 2.32.0([email protected](@babel/[email protected])(@react-native/[email protected](@babel/[email protected]))(@types/[email protected])([email protected]))([email protected])
+ react-native-gesture-handler: 2.32.0(patch_hash=15837ee0682cd5d6df449cdfc1348d9742ae83c56f9e3cb6d163bff67dfcc818)([email protected](@babel/[email protected])(@react-native/[email protected](@babel/[email protected]))(@types/[email protected])([email protected]))([email protected])
transitivePeerDependencies:
@@ -21213,16 +21216,16 @@ snapshots:
transitivePeerDependencies:
- supports-color
dependencies:
color: 4.2.3
react: 19.2.3
react-native: 0.86.3(@babel/[email protected])(@react-native/[email protected](@babel/[email protected]))(@types/[email protected])([email protected])
- react-native-gesture-handler: 2.32.0([email protected](@babel/[email protected])(@react-native/[email protected](@babel/[email protected]))(@types/[email protected])([email protected]))([email protected])
+ react-native-gesture-handler: 2.32.0(patch_hash=15837ee0682cd5d6df449cdfc1348d9742ae83c56f9e3cb6d163bff67dfcc818)([email protected](@babel/[email protected])(@react-native/[email protected](@babel/[email protected]))(@types/[email protected])([email protected]))([email protected])
use-latest-callback: 0.2.6([email protected])
+ [email protected](patch_hash=15837ee0682cd5d6df449cdfc1348d9742ae83c56f9e3cb6d163bff67dfcc818)([email protected](@babel/[email protected])(@react-native/[email protected](@babel/[email protected]))(@types/[email protected])([email protected]))([email protected]):
dependencies:
'@egjs/hammerjs': 2.0.17
'@types/react-test-renderer': 19.1.0