fix(mobile): 修复消息分享图片卡住与导出失败 - #2950
Conversation
Signed-off-by: David <david@DaviddeMacBook-Air.local>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fe10914916
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
| Filename | Overview |
|---|---|
| apps/mobile/app/sessions/[sessionId].tsx | 会话分享流程已切换到 ConversationShareSvg,选择、临时文件及系统分享控制逻辑保持不变。 |
| apps/mobile/src/session/ConversationShareSvg.tsx | 新增 SVG 渲染及资源就绪门闩,但系统主题在导出期间变化时,运行中的导出仍可能等待被遗弃的旧门闩并超时。 |
| apps/mobile/src/session/conversationShareAssetGate.ts | 新增独立、幂等的双资源一次性就绪门闩;其生命周期必须与对应图片实例保持一致。 |
| apps/mobile/src/session/conversationShareSvgLayout.ts | 新增确定性消息布局、Markdown 纯文本化、敏感信息脱敏、保守换行及输出像素限制。 |
| apps/mobile/src/tests/conversationShareSvg.test.ts | 覆盖布局、换行、脱敏、Markdown 降级、输出限制和独立门闩行为,但未覆盖组件导出期间的主题切换。 |
| apps/mobile/src/tests/conversationShareWebViewHtml.test.ts | 更新源码契约测试以验证 SVG 渲染器接线及获批品牌页脚尺寸。 |
| docs/design-rules/DESIGN.md | 将新的 Mobile SVG 分享图实现纳入已批准的品牌页脚使用范围。 |
Reviews (7): Last reviewed commit: "fix(mobile): preserve share text semanti..." | Re-trigger Greptile
Signed-off-by: David <david@DaviddeMacBook-Air.local>
|
@DavidShenXD 👋 这个 PR 还有 4 条 review conversation 没 resolve(apps/mobile/src/session/conversationShareSvgLayout.ts / apps/mobile/src/session/ConversationShareSvg.tsx),auto-review 因此暂时跳过、没法继续审查 / 合并。 如果你已经按评论改完或回应了,请到对应 thread 上点 Resolve conversation;全部 resolve 后,下一轮 auto-review 会自动重新审查这个 PR。 |
Signed-off-by: David <david@DaviddeMacBook-Air.local>
反馈已处理已处理:
变更:
验证:
备注:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5b7adcab4d
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
@DavidShenXD 👋 这个 PR 还有 1 条 review conversation 没 resolve(apps/mobile/src/session/conversationShareSvgLayout.ts),auto-review 因此暂时跳过、没法继续审查 / 合并。 如果你已经按评论改完或回应了,请到对应 thread 上点 Resolve conversation;全部 resolve 后,下一轮 auto-review 会自动重新审查这个 PR。 |
Signed-off-by: David <david@DaviddeMacBook-Air.local>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d921785237
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
反馈已处理已处理:
变更:
验证:
备注:
|
Signed-off-by: David <david@DaviddeMacBook-Air.local>
反馈已处理已处理:
变更:
验证:
备注:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c16c1c637b
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Signed-off-by: David <david@DaviddeMacBook-Air.local>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3f270c53ee
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
@DavidShenXD 👋 这个 PR 还有 4 条 review conversation 没 resolve(apps/mobile/src/session/conversationShareSvgLayout.ts),auto-review 因此暂时跳过、没法继续审查 / 合并。 如果你已经按评论改完或回应了,请到对应 thread 上点 Resolve conversation;全部 resolve 后,下一轮 auto-review 会自动重新审查这个 PR。 |
|
Signed-off-by: David <david@DaviddeMacBook-Air.local>
反馈已处理已处理:
变更:
验证:
备注:
|
MagicLizi
left a comment
There was a problem hiding this comment.
自动审查结果
审查通过除以下 P1 问题外无阻断:
P1: 缺少导出状态机的测试覆盖
apps/mobile/src/session/ConversationShareSvg.tsx:566-612 中的 exportPng() 流程(timeout 路径、waitUntilReady() → toDataURL 回调、sourceTooLarge 提前拒绝、"svg ref unavailable" 分支)是本次修复的核心路径,但新增测试只覆盖了纯布局/文字换行/gate 函数,未直接覆盖实际导出/超时流程。建议补充对 export state machine 的自动化测试。
P2(不阻断)
- footer
SvgImage元素缺少onError处理(bundled asset decode 失败时markReady不触发,export 会等到 20s timeout 才失败) ConversationShareWebView等旧组件可能已成死代码,建议后续确认并清理conversationShareWebViewHtml.ts文件命名对新 SVG renderer 有误导性
MagicLizi
left a comment
There was a problem hiding this comment.
代码审查通过,无 P0/P1 问题。
PR 用 react-native-svg 布局替代了之前的 WebView/foreignObject 方案,加入 12M 像素上限和 20s 超时,解决了分享图片卡住与导出失败的问题。敏感信息脱敏、资源加载门控、超大对话短路处理均覆盖完善。
|
SVG 版分享图让导出链路从三条退路收归成一条确定路径——死胡同少了,排查也就简单了。测试覆盖很扎实,宽字符换行那组尤其实用 🎯 |
这次改了什么
摘要
将 Mobile 的消息分享图片导出从隐藏 WKWebView / WebView 的多级降级链路收敛为单一的 react-native-svg 导出路径,解决 iOS 上长期停留“正在准备”和 SVG foreignObject 解码失败的问题。新路径直接用现有原生 SVG 元素绘制消息、附件、间隔标记与品牌页脚,再通过 toDataURL 生成 PNG,不依赖 WebKit 光栅化。
变更类型
feat新功能fix缺陷修复refactor/perf重构或性能优化docs/test/chore文档、测试或工程维护范围
UI 变化
docs/design-rules/DESIGN.md§2 Layer System / 多主题 token(全部颜色来自当前主题语义 token);§5 圆角系统(消息气泡 12px、品牌角色图 6px);Mobile approved 2026-08-08 分享页脚规格(22×22px 角色图、18px wordmark、6px 间距)。Light / Dark 均由同一实现和对应 wordmark 资产覆盖。怎么验证的
自动验证
手工验证
cindy/pensive-mendeleev;使用该 worktree 的 Metro bundle,日志出现iOS Bundled ... apps/mobile/index.js。svg-decode-failed。未执行的验证
风险
风险分类
影响与回滚
提交前检查
git commit -s,见 DCO)