Skip to content

feat: integrate tauri-plugin-ohos-permissions - #62

Open
sb-fy-sb wants to merge 1 commit into
Eulogizethesun:ohdevfrom
sb-fy-sb:feat/ohos-permissions
Open

feat: integrate tauri-plugin-ohos-permissions#62
sb-fy-sb wants to merge 1 commit into
Eulogizethesun:ohdevfrom
sb-fy-sb:feat/ohos-permissions

Conversation

@sb-fy-sb

@sb-fy-sb sb-fy-sb commented Jul 6, 2026

Copy link
Copy Markdown

Register ohos-permissions plugin in tauri-cli and examples/api:

  • Add OHOS Plugin.ets template (abilityAccessCtrl for Camera/Microphone)
  • Register in BUILTIN_PLUGINS and known_plugins
  • Add dependency + plugin init in examples/api
  • Add ACL permissions in capabilities/run-app.json
  • Add 10 auto + 5 manual test cases in plugins.ts
  • Add manual test buttons in TestRunner.svelte
  • Include openspec design docs (proposal + design + 6 specs + tasks)
  • Fix env.sh: junction for DevEco Studio path with spaces

@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown

Package Changes Through 045fcc1

There 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 Versions

The following package releases are the planned based on the context of changes in this pull request.

package current next
@tauri-apps/api 2.10.1 2.11.0
tauri-utils 2.8.3 2.9.0
tauri-macos-sign 2.3.3 2.3.4
tauri-bundler 2.8.1 2.9.0
tauri-runtime 2.10.1 2.11.0
tauri-runtime-wry 2.10.1 2.11.0
tauri-codegen 2.5.5 2.5.6
tauri-macros 2.5.5 2.5.6
tauri-plugin 2.5.4 2.6.0
tauri-build 2.5.6 2.6.0
tauri 2.10.3 2.11.0
@tauri-apps/cli 2.10.1 2.11.0
tauri-cli 2.10.1 2.11.0

Add another change file through the GitHub UI by following this link.


Read about change files or the docs at github.com/jbolda/covector

Register ohos-permissions plugin in tauri-cli and examples/api:
- Add OHOS Plugin.ets template (abilityAccessCtrl for Camera/Microphone)
- Register in BUILTIN_PLUGINS and known_plugins
- Add dependency + plugin init in examples/api
- Add ACL permissions in capabilities/run-app.json
- Add 10 auto + 5 manual test cases in plugins.ts
- Add manual test buttons in TestRunner.svelte
- Include openspec design docs (proposal + design + 6 specs + tasks)
- Fix env.sh: junction for DevEco Studio path with spaces
@sb-fy-sb
sb-fy-sb force-pushed the feat/ohos-permissions branch from 7085404 to 045fcc1 Compare July 6, 2026 08:14

@MingyuChen1 MingyuChen1 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OHOS Code Review — tauri#62

🔴 🟡 🔵 ℹ️
0 2 1 1

🟡 F3 — Plugin.ets: handleRequest 未实现 requestPermissionOnSetting,违反 spec/design/tasks

handleRequest 在权限被拒绝(authResults[0] !== 0)或调用失败时,仅 console.warn/errorinvoke.resolve(''),没有调用 atManager.requestPermissionOnSetting(this.context, [...]),也没有 tasks.md 3.4 step ① 的“先 check 已授权则直接 resolve”短路。三步流程实际只实现了 step ② 的弹窗部分。

这与三处文档冲突:

  • spec ohos-permissions-camera/spec.mdohos-permissions-microphone/spec.md 的 “永久拒绝后引导设置” Scenario 用 SHALL 措辞要求调用 requestPermissionOnSetting
  • design.md Goals(L584) + R2(L673) 要求 denied 时调用 requestPermissionOnSetting
  • tasks.md 3.4 标记为 [x] 已完成,但 step ③ 实际未实现(误标)

建议:在 denial 分支补上 requestPermissionOnSetting 调用以引导用户到系统设置;若该 API 对三方应用确实不可用,应同步更新 spec/design 而非静默省略,并修正 tasks.md 3.4 的状态。

🟡 F4 — doc/manual_tests.md 未更新(新增可操作权限 API + 手动测试)

本 PR 新增了用户可操作的权限 API(check*/request*),并在 TestRunner.svelte / plugins.ts 添加了手动测试按钮(Check All / Request Camera / Request Microphone / Deny→Re-request)。按 tauri 仓规范(H5),新增可操作功能/API 应在 doc/manual_tests.md 归档对应手动用例并更新统计表,但该文件本 PR 未变更。

建议:在 doc/manual_tests.md 追加 OHOS Permissions 手动测试章节(权限 check→request→check 全流程、拒绝后引导设置),并更新末尾统计表。

🔵 F5 — openspec/ohos-permissions-plan.md 散落在 openspec/ 根

该计划文件位于 openspec/ohos-permissions-plan.md,未归档到 openspec/changes/<change-name>/ 下。按 H3 规范,openspec 文件应归档到 openspec/changes/。建议移入 openspec/changes/p1-ohos-permissions/ 或专门的 plans 目录。

ℹ️ F6 — design.md D6 文档过期

D6 称 “default.toml 中 allow 所有 4 个 command”,但实际 default.toml 包含 12 个 command 权限(camera/microphone 真实 + accessibility/full-disk/screen-recording/input-monitoring stub,各 check+request)。建议更新 D6 描述以反映当前命令集。


由 tauri-ohos-pr-babysit 自动巡检生成。F3 的 inline comment 见下方 Plugin.ets 标注。

if (authResults.length > 0 && authResults[0] === 0) {
invoke.resolve('');
} else {
console.warn('[OhosPermissionsPlugin] Permission ' + permissionKey + ' denied by user.');

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 [F3/spec] denial 分支仅 console.warn + invoke.resolve(''),未调用 atManager.requestPermissionOnSetting(this.context, [ohosPermission]) 引导用户到系统设置。

这与 spec(camera/microphone 的 “永久拒绝后引导设置” Scenario,SHALL 措辞)、design.md(Goals + R2)、tasks.md 3.4(标记 [x] 但 step ③ 未实现)三处冲突。

建议在此分支补上 requestPermissionOnSetting 调用;若该 API 对三方应用不可用,应同步更新 spec/design 并修正 tasks.md 3.4 状态。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants