We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I follow this article to add permission for my plugin
https://tauri.app/develop/plugins/develop-mobile/#permissions
@TauriPlugin( permissions = [ Permission(strings = [Manifest.permission.ACCESS_FINE_LOCATION], alias = "accessFileLocation") ] ) class FunProxyPlugin(private val activity: Activity) : Plugin(activity){....}
import { invoke, PermissionState } from '@tauri-apps/api/core'; type PermissionType = 'accessFileLocation' | 'otherPermission'; // 可以扩展其他权限类型 interface Permissions { [key: string]: PermissionState; } const handlePermissionRequest = async (type: PermissionType) => { const permission = await invoke<Permissions>('plugin:funproxy|checkPermissions'); const state = permission[type]; if (state === 'prompt-with-rationale') { // 显示解释信息,告诉用户为什么需要这个权限 // 例如弹出对话框或提示用户权限的重要性 } if (state.startsWith('prompt')) { await invoke<Permissions>('plugin:funproxy|requestPermissions', { permissions: [type] }); return checkPermission(type); // 请求后重新检查 } }; export const checkPermission = async (type: PermissionType) => { try { await handlePermissionRequest(type); } catch (error) { window.$message?.error(error as string); } }; export const initPermission = async () => { // 这里可以添加更多权限类型 await checkPermission('accessFileLocation'); };
But I got this error
No response
tauri info
❯ cargo tauri info [✔] Environment - OS: Mac OS 15.1.0 arm64 (X64) ✔ Xcode Command Line Tools: installed ✔ rustc: 1.82.0 (f6e511eec 2024-10-15) ✔ cargo: 1.82.0 (8f40fc59f 2024-08-21) ✔ rustup: 1.27.1 (54dd3d00f 2024-04-24) ✔ Rust toolchain: stable-aarch64-apple-darwin (environment override by RUSTUP_TOOLCHAIN) - node: 20.18.0 - pnpm: 9.12.3 - npm: 10.8.2 - bun: 1.1.24 [-] Packages - tauri-cli 🦀: 2.0.2 [-] Plugins [-] App
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Describe the bug
I follow this article to add permission for my plugin
https://tauri.app/develop/plugins/develop-mobile/#permissions
But I got this error
Reproduction
No response
Expected behavior
No response
Full
tauri info
outputStack trace
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: