tauri-apps / tauri-apps/plugins-workspace
[bug] Notification API shows wrong permission and does not ask for permissions
- Dominant language
- Rust
- Stars
- 1.8k
- Forks
- 602
- Avg merge
- 4d 14h
- Merged PRs (30d)
- 9
Description
### Describe the bug
The isPermissionGranted() method in javascript returns `true`, while the permissions for the notifications are disabled. See screenshot.
The requestPermission() also returns `granted`. Because of this I don't get a popup to change the notification permissions?
The notifications work if I manually switch the toggle. But it would be nice if the application could request the permissions.
I am using a MacBook Pro (15-inch, 2019), with macOS Monterey 12.4

### Reproduction
1. Disable the permissions for the application
2. Run the following code
```javascript
import { isPermissionGranted, requestPermission } from '@tauri-apps/api/notification';
async function testPermissions() {
const permissionGranted = await isPermissionGranted();
console.log(`Permission granted: ${permissionGranted}`);
const permission = await requestPermission();
console.log(`Permission: ${permission}`);
}
testPermissions();
```
### Expected behavior
I would expect that when I turn off the permissions, the `isPermissionGranted()` method returns `false`;
I would expect that if the permissions are turned off, the `requestPermission()` method gives a popup to change the permissions.
### Platform and versions
Environment
› OS: Mac OS 12.4.0 X64
› Node.js: 16.18.0
› npm: 8.12.1
› pnpm: Not installed!
› yarn: Not installed!
› rustup: 1.24.3
› rustc: 1.60.0
› cargo: 1.60.0
› Rust toolchain: stable-x86_64-apple-darwin
Packages
› @tauri-apps/cli [NPM]: 1.2.2
› @tauri-apps/api [NPM]: 1.2.0
› tauri [RUST]: 1.2.2,
› tauri-build [RUST]: 1.2.1,
› tao [RUST]: 0.15.7,
› wry [RUST]: 0.23.3,
App
› framework: Vue.js (Vue CLI)
› bundler: Webpack
App directory structure
├─ dist
├─ node_modules
├─ public
├─ src-tauri
├─ .git
└─ src
### Stack trace
_No response_
### Additional context
_No response_
Contributor guide
Research direction
Start with the JavaScript isPermissionGranted() and requestPermission() entry points in the notification API, then trace how macOS permission state is obtained and requested. Reproduce the disabled-permission case on macOS 12.4; done means the status reflects the disabled state and requesting permission has the expected behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, rust, tauri
- Domain
- api, desktop
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100