feat(android): add Android build support with Tauri 2 mobile\n\n- con… - #4
Merged
Conversation
…ditional deps: window-state + trash only on non-Android\n- main(): register window-state only on desktop; keep desktop behavior\n- move_to_trash(): Android fallback to direct remove\n- npm scripts: add tauri:android:init/dev/build\n- CI: add independent .github/workflows/android.yml\n- docs: andriod.md (方案、Kotlin、CI 说明)
htmambo
added a commit
to htmambo/flymd
that referenced
this pull request
Jun 3, 2026
基于 codex 对 PR-1(commit a16cec8)的正式 review,完成 1 P0 + 6 P1 修复。 剩余 P1 flyhunterl#8(HASH_THRESHOLD_BYTES 实际未使用)留 PR-3 性能优化。 【P0 — WYSIWYG 外部重载丢 YAML Front Matter】 - reloadCurrentFileFromDisk wysiwyg 分支先 splitYamlFrontMatter(content) 并 刷新 currentFrontMatter,避免 2750 onChange 用旧 front matter 拼回 静默丢失外部对 YAML 头部的修改 【P1 flyhunterl#1 — saveAs race(真 bug)】 - 两处 saveAs(常规 + 导出)的监听迁移逻辑都把 unregisterFor 错写成了 target(新路径),实际应注销 oldPath(老路径) - 修: 写前 oldPath = currentFilePath, 写后 unregisterFor(oldPath) registerFor(target) + finishSelfWriteCurrent(target) 【P1 flyhunterl#2 — tab-closed 联动查不到已关闭 tab】 - TabManager.closeTab 在 emit 之前先抓 filePath, 塞进事件 detail - TabEvent 类型扩展: { type: 'tab-closed', tabId, filePath? } - integration.ts 监听端优先用 event.filePath, 兜底回退旧逻辑 【P1 flyhunterl#3 — 自循环抑制窗口启动偏晚】 - openFileWatcher.ts 新增 beginSelfWrite(path) + finishSelfWrite(path) 拆分 (begin 只设 suppressUntil 不 stat, finish 刷 snapshot) - main.ts 三处:saveFile + saveAs 常规 + saveAs 导出 改为 write 之前 begin, write 之后 finish (finishSelfWriteCurrent 接受可选 path 参数, saveAs 切路径场景需要) 【P1 flyhunterl#4 — 异步 watchPathsAbs 句柄 race】 - Entry 加 cancelled: boolean 字段 - startWatch 入口重置 cancelled=false; await resolve 后检查, 若期间被 unregister/dispose 取消则立即调 unwatch(),不写入 entry.unwatch 防止孤儿监听 - unregister / unregisterByPath / dispose 路径都设 entry.cancelled = true 事件回调入口也检查 cancelled 提前 return 【P1 flyhunterl#6 — conflict-reload 后 tab.dirty 没同步】 - reloadCurrentFileFromDisk 完成后派发 'flymd-file-reloaded' 事件 - tabs/integration.ts 监听 + tabManager.markCurrentTabSaved()(内部从 hooks.getEditorContent() 读新内容 + dirty=false) 【P1 flyhunterl#7 — setEnabled 完整语义(为 PR-2 偏好面板准备)】 - 之前只改布尔, 关闭不释放句柄, 重开不重启 watch - 修: 关闭时遍历所有 entry 设 cancelled=true + 调 unwatch + 清空字段 重开时对所有 entry 重新 startWatch 【验收】 - tsc 0 错误; npm run build 24.64s 干净 - 全部原 A1-A8 用例 + 新 A9(saveAs 旧路径不监听)/ A10(WYSIWYG front matter) / A11(关闭 tab 不监听)/ A12(setEnabled 关闭/重开)需用户桌面回归 【已知遗留】 - P1 flyhunterl#8 HASH_THRESHOLD_BYTES 实际未使用,留 PR-3(非阻断) - P2 项(string normalize 一致性 / as any 清理 / 模态焦点)留后续 PR Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
htmambo
added a commit
to htmambo/flymd
that referenced
this pull request
Jun 26, 2026
详细说明:
- focusModeHost:setCompactTitlebar / getCompactTitlebar / setCompactTitlebarFlag
之前都把 compactTitlebar 写死为 true,导致 isCompactTitlebarEnabled() 永远
true、用户偏好无法持久化,initWindowDrag 的"门槛"看似通过但实际语义错误
- main.ts:启动序列先 await getCompactTitlebar(store) 同步从 store 加载,再用
加载值调用 setCompactTitlebar(compact, store, false);启动期异常不打断主流程
- window.css:移除 body.platform-mac .tabbar-row 的 no-drag 覆盖,让 macOS
tabbar-row 走原生 -webkit-app-region: drag,修复"拖拽标题栏无反应"
(webkit 在 no-drag 父元素区不把 mousedown 冒泡给外层监听;子元素
.tabbar-tabs / .tabbar-tab / .tabbar-new-btn / .window-controls 已有
no-drag 覆盖,点击与拖拽排序不受影响)
- 新增 src/modes/focusModeHost.test.ts,14 用例覆盖修复点
(默认 true、store 加载、持久化、Windows 短路、store.set 异常容错、
非 boolean store 值回退、body class 切换等)
技术细节:
- 仅修 B 类问题(标题栏拖拽失效),A 类(最大化顶部留白)留待后续
(decorations: false + macOS WKWebView native zoom 行为,需切到
titleBarStyle:Overlay 才能彻底解决,改动面大,留作独立任务)
- platformInit.ts 的 mousedown 兜底(startDragging)保留,作为 webkit 已知
app-region: drag 支持不一致的防御层
文件变更:
- 修改:src/modes/focusModeHost.ts(3 处写死 true → 真实读写入参/store)
- 修改:src/main.ts(启动序列同步加载 + 异常容错)
- 修改:src/styles/window.css(移除 macOS no-drag 覆盖)
- 新增:src/modes/focusModeHost.test.ts(14 tests jsdom)
测试状态:
- [x] 单元测试通过 (新增 14 用例,全量 602/602 通过,仅 web/server 2 个
failed suites 与本修复无关 — openai/dotenv 未装,pre-existing)
- [x] 代码审查完成 (coding-bridge review,采纳中风险 flyhunterl#4 flyhunterl#5,误判项
高风险 flyhunterl#1 flyhunterl#2 flyhunterl#3 经实测/源码确认安全,详见归档文档)
> OMC trailers:
> Constraint: 仅修改 focusModeHost / main.ts / window.css + 新增对应测试
> Rejected: 切到 titleBarStyle:Overlay 一次性解决 A+B | 改动面过大,A 已留独立任务;Capture 阶段 mousedown 加固 | 现有测试套不适配,回归风险大于收益,webkit drag 自身已能处理
> Directive: 用户明确报告"macOS 拖拽标题栏没反应";coding-bridge review 反馈
> Confidence: 高 | 14 单测覆盖修复点;原始 bug 根因(写死 true)代码事实可证;webkit drag 父 + no-drag 子 是 W3C 文档明确支持的模式
> Scope-risk: macOS tabbar-row drag 行为变更(原 no-drag → drag);窗口按钮 / 标签拖拽 / 标签点击回归需要 macOS 实机验证
> Not-tested: 真实 macOS 桌面环境的拖拽体感;window-state 插件的 maximize 行为;tabbar-tabs 的 webkit no-drag 嵌套实际渲染
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…ditional deps: window-state + trash only on non-Android\n- main(): register window-state only on desktop; keep desktop behavior\n- move_to_trash(): Android fallback to direct remove\n- npm scripts: add tauri:android:init/dev/build\n- CI: add independent .github/workflows/android.yml\n- docs: andriod.md (方案、Kotlin、CI 说明)