feat(ohos): deep-link integration and isDecorated badge fix - #64
Conversation
Package Changes Through 38b07e2There are 11 changes which include tauri with minor, @tauri-apps/api with minor, tauri-build with minor, tauri-macos-sign with patch, tauri-bundler with minor, @tauri-apps/cli with minor, tauri-cli with minor, tauri-runtime with minor, tauri-runtime-wry with minor, tauri-utils with minor, tauri-plugin with minor Planned Package VersionsThe following package releases are the planned based on the context of changes in this pull request.
Add another change file through the GitHub UI by following this link. Read about change files or the docs at github.com/jbolda/covector |
MingyuChen1
left a comment
There was a problem hiding this comment.
OHOS Code Review — tauri#64 (deep-link + isDecorated badge fix)
| 🔴 | 🟡 | 🔵 | ℹ️ |
|---|---|---|---|
| 0 | 2 | 3 | 2 |
🟡 F1 — crates/tauri/src/app.rs 纯 CRLF 行尾重写污染 diff(+2711/-2711)
整个 app.rs 被改为相反行尾(CRLF↔LF),无任何实质代码改动(所有 +/- 行均带 CR)。这会让 reviewer 无法用 diff 定位真实改动,且后续合并极易冲突。
建议:从 PR 移除 app.rs 的行尾改动,或配 .gitattributes 统一行尾后单独提交一次 normalize。
🟡 F2 — plugins.ts 手动测试 scheme 与注册 scheme 不一致(测试缺陷)
examples/api/src/lib/tests/plugins.ts 的 deep-link manual 用例指引执行 hdc shell aa start -d myapp://path,但 tauri.conf.json 注册的 scheme 是 taurideeplink。myapp 未在 module.json5 skills 声明,系统不会路由到 app → onOpenUrl 永不触发,测试无法验证。同 PR 内 TestRunner.svelte 与 doc/manual_tests.md 都正确用了 taurideeplink://,唯独 plugins.ts 用错。
建议:plugins.ts 中 myapp://path 全部改为 taurideeplink://path。
🔵 F3 — openspec/deep-link-plan.md 散落在 openspec/ 根(H8)
三个 Phase 设计文档已正确归档到 openspec/changes/p1-p3-deep-link/,但顶层 openspec/deep-link-plan.md 游离在 openspec/ 根。已是第 3 次出现此模式(#62、#63、#64)。建议移入 openspec/changes/ 或新建 openspec/plans/。(注:仓内已有 mouse-events-plan.md 等历史先例,可统一处理。)
🔵 F4 — json5 依赖与 update_ohos_module_json 未按 OHOS target 隔离
crates/tauri-plugin/Cargo.toml 的 json5 放在 [dependencies](非 OHOS target 段),update_ohos_module_json 也无 #[cfg(target_env = "ohos")]。桌面构建启用 build feature 时会编译 json5(虽然函数靠 TAURI_OHOS_PROJECT_PATH env 自门控为 no-op)。建议给函数加 cfg 门控,或把 json5 移到 OHOS target 依赖。
🔵 F5 — update_ohos_module_json 在 skills 字段缺失时静默跳过
若 abilities[0] 无 skills 数组,deep-link skills 不注入且返回 Ok(()) 不报错。当前模板总有 home skill 不会触发,但自定义模板删 skills 会静默失败。建议缺失时初始化空数组或 bail! 显式报错。
ℹ️ F6 — plugin::initialize 可见性 fn→pub(crate) fn 无实际效果
该函数仅同模块内调用,pub(crate) 与 fn 等价,疑为重构残留,可回退减噪声。
ℹ️ F7 — test-windows-is-decorated.json 用 windows: ["*"]
对全部窗口放行 core:window:allow-is-decorated(只读查询,风险低),因 autotest popup 窗口 label 不固定。描述已说明,可接受。
正面确认
- H5✓
doc/manual_tests.md新增「十九、Deep-Link 手动用例」3 条 T0 + 统计更新(119) - H6✓ 三 Phase 设计文档归档
openspec/changes/p1-p3-deep-link/,结构完整 - H7✓ 代码注释全英文;规则 B✓ deep-link 注册分
cfg(not(ohos))/cfg(ohos)两块,无双重注册 - isDecorated badge 修复质量好:优先
__TAURI_INTERNALS__.invoke、降级__TAURI__.core.invoke、test-前缀窗口跳过 badge 避免 OHOS Float window close 噪声 - 本 PR 提供
update_ohos_module_json(plugins-workspace#16 deep-link build.rs 依赖)
F2 inline comment 见下方 plugins.ts 标注。
|
Thanks for the detailed review @MingyuChen1. Pushed fix-up in
The app.rs change is a clean re-application of the already-tested appfreeze fix (identical behavior), so no runtime re-test needed; CI will verify compilation. |
aba0010 to
27fabad
Compare
MingyuChen1
left a comment
There was a problem hiding this comment.
OHOS Code Review — tauri#64 (re-review 2026-07-09)
| 🔴 | 🟡 | 🔵 | ℹ️ |
|---|---|---|---|
| 0 | 0 | 1 | 0 |
✅ F1(上轮 🟡)已解决
crates/tauri/src/app.rs 的 CRLF 整文件重写已移除(从 +2711/-2711 降到正常 diff),diff 不再被行尾噪声污染。
✅ F2(上轮 🟡)已解决
plugins.ts 手动测试的 scheme 已从 myapp:// 全部改为 taurideeplink://(与 tauri.conf.json 注册 scheme、TestRunner.svelte、doc/manual_tests.md 一致),手动测试指引现在可正常触发 onOpenUrl。
🔵 F3(上轮)仍开 — openspec plan 在根(H8)
openspec/deep-link-plan.md 仍在 openspec/ 根(未移到 openspec/changes/)。属非阻塞归档规范项(H8),仓内有历史先例,可在后续统一处理。
上轮两个 🟡 均已解决,仅余 H8 归档位置(🔵 非阻塞)。可合入。
|
@MingyuChen1 Regarding F3 (H8 — openspec plan location): the plan file is already under On the current head (
and does not add So all review items are now resolved:
No remaining actionable items. Thanks for the review! |
|
Archived the deep-link openspec changes (implementation complete + verified on device):
So the PR's openspec content is now in its archived end-state (changes moved out of |
MingyuChen1
left a comment
There was a problem hiding this comment.
OHOS Code Review — tauri#64 (re-review 2026-07-09)
| 🔴 | 🟡 | 🔵 | ℹ️ |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
✅ F3(上轮 🔵 H8)已解决
openspec/deep-link-plan.md 已移到 openspec/changes/deep-link-plan.md,不再散落在 openspec/ 根。H8 归档规范满足。
全部 finding 已清除
- F1(🟡 app.rs CRLF 噪声):上轮已解决(diff 从 6783 降到 1670 行)
- F2(🟡 plugins.ts scheme 错误):上轮已解决(myapp→taurideeplink)
- F3(🔵 openspec plan 位置):本轮已解决
无新增问题,可合入。
deep-link 三件套(tauri#64 + oa#38 + plugins-workspace#16)均已无阻塞,合并顺序:oa#38 + tauri#64 先于/同批 plugins-workspace#16(pw#16 依赖前两者的新 API)。
MingyuChen1
left a comment
There was a problem hiding this comment.
OHOS Code Review — tauri#64 (re-review 2026-07-13)
| 🔴 | 🟡 | 🔵 | ℹ️ |
|---|---|---|---|
| 0 | 0 | 0 | 1 |
✅ 历轮 findings 维持已解决
- F1(app.rs CRLF 噪声):app.rs 仅 31 行,无 CRLF 整文件重写。
- F2(plugins.ts scheme):myapp:// 计数 0,已统一为 taurideeplink://。
- F3(openspec plan 位置):openspec/changes/deep-link-plan.md,根目录无散落。
✅ 本轮 push 进一步改进(mobile.rs)
update_ohos_module_json 在 07-13 push 中强化:
- 用 CARGO_CFG_TARGET_ENV == "ohos" 自门控(build.rs 中 cfg! 对 host 编译无效,改用 env var,cross-compilation safe)——回应了更早轮次的 cfg 隔离建议。
- skills 字段缺失时初始化空数组再注入,避免自定义模板静默跳过——回应了 skills 缺失静默跳过 建议。
- 幂等:注入前先移除已有 deep-link skill(按 ohos.want.action.viewData 签名),重复构建不累积。Home entry skill 保留。
ℹ️ I1 — JSON5 往返丢失注释/尾逗号(已知限制,已文档化)
update_ohos_module_json 用 serde_json::to_string_pretty 序列化,module.json5 模板中的 JSON5 特性(注释、尾逗号、无引号 key)会在往返中丢失。doc 注释已列为 Limitation。若模板依赖注释,合入后首次构建会剥除——建议确认 entry_{device_type}/src/main/module.json5 模板无关键注释,或在 build 后校验。
无阻塞,可合入。deep-link 三件套(tauri#64 + oa#38 + pw#16)均无阻塞,合并顺序:oa#38 + tauri#64 先于/同批 pw#16。
- tauri-plugin: add update_ohos_module_json and deep-link api demo integration - deep-link: api demo config, ACL permissions, manual test cases and buttons (onOpenUrl, getCurrent, external launch), manual test docs - fix appfreeze: move plugin initialize outside lock, use try_lock for on_event - fix(ohos-build): entry module path and plugin config env vars for cargo build - fix isDecorated badge in test popup windows: use Tauri v2 invoke path, grant core:window:allow-is-decorated to popup windows, skip badge for autotest-created windows
Summary
tauri-pluginupdate_ohos_module_json+ deep-link api demo (config, ACL permissions, manual test cases/buttons for onOpenUrl / getCurrent / external launch), openspec p1/p2/p3 specs.initializeoutside the lock and usetry_lockforon_event.cargo build.window.__TAURI_INTERNALS__.invokewith__TAURI__.core.invokefallback) instead of the v1 top-levelwindow.__TAURI__.invoke(which was undefined and left the badge stuck on "checking..."); add acore:window:allow-is-decoratedcapability (windows:["*"]) so popup windows created with non-test-labels can queryis_decorated; skip the live badge for autotest-created windows (label prefixtest-) since OHOS programmatic close is not yet implemented and a lingering closed popup would otherwise poll an unregistered webview ("failed to acquire webview reference").Test
Built and deployed to an OHOS desktop device, ran the autotest suite (examples/api):
RunEvent::Resumed fires on startup,plugin-clipboard-manager.writeText+readText.isDecorated: false; autotest popup windows no longer show the error text; the previous__TAURI__.invoke is not a functionconsole spam (1764 errors) is eliminated.