tauri-apps / tauri

Build smaller, faster, and more secure desktop applications with a web frontend.
https://tauri.app
Apache License 2.0
79.7k stars 2.37k forks source link

[bug] Notification issue on macOS #5488

Open MeK-KeM opened 1 year ago

MeK-KeM commented 1 year ago

Describe the bug

Hi everyone! I am using vanilla js as a frontend stack. A web notification is not working properly. It is working in background. https://prnt.sc/YB16mAstKkrC

Notifications are not popping up on macOS. https://prnt.sc/SPplmFQjRJ3r

Notification access enabled for the demo app. https://prnt.sc/LGBUvmnALdvP

On mac m1, with rust version,

rustup 1.25.1 (bb60b1e89 2022-07-12)
cargo 1.64.0 (387270bc7 2022-09-16)
release: 1.64.0
commit-hash: 387270bc7f446d17869c7f208207c73231d6a252
commit-date: 2022-09-16
host: aarch64-apple-darwin
libgit2: 1.4.2 (sys:0.14.2 vendored)
libcurl: 7.84.0 (sys:0.4.55+curl-7.83.1 system ssl:(SecureTransport) LibreSSL/3.3.6)
os: Mac OS 13.0.0 [64-bit]

Please, help me figure out this issue.

Reproduction

  1. Create demo “NotifyMe” tauri project.
  2. Open ../src/main.js.
  3. Add this code into the “DOMContentLoaded” callback function.
new Notification('NotifyMe', {
    title: 'From NotifyMe',
    body: 'Hello again!' 
  })
  1. Open terminal and run “npm run tauri build — —target universal-apple-darwin”.
  2. Open a “NotifyMe” application.

Expected behavior

A notification message is popping up after opening the “NotifyMe” app.

Platform and versions

NotifyMe@0.0.0 tauri tauri info

Environment › OS: Mac OS 13.0.0 X64 › Node.js: 18.6.0 › npm: 8.19.2 › pnpm: Not installed! › yarn: 1.22.19 › rustup: 1.25.1 › rustc: 1.64.0 › cargo: 1.64.0 › Rust toolchain: stable-aarch64-apple-darwin

Packages › @tauri-apps/cli [NPM]: 1.1.1 › @tauri-apps/api [NPM]: Not installed! › tauri [RUST]: 1.1.1, › tauri-build [RUST]: 1.1.1, › tao [RUST]: 0.14.0, › wry [RUST]: 0.21.1,

App › build-type: bundle › CSP: unset › distDir: ../src › devPath: ../src

App directory structure ├─ ui ├─ node_modules ├─ src-tauri ├─ .vscode └─ src

Stack trace

No response

Additional context

No response

Gparlatto commented 1 year ago

Hello everybody, I'm using NextJs with Typescript and I've experienced the same unexpected behaviour where the notifications are hidden, they did not pop up as normally due for rest of apps

This only happens after runs the built app using banner mode. using tauri dev it's working properly.

Notification access enabled for the built app as well as dev mode.

Any ideas what can it be?

Platform and Environment

On mac with Intel.

Environment › OS: Mac OS 12.6.0 X64 › Node.js: 16.15.1 › npm: 8.11.0 › pnpm: Not installed! › yarn: 1.22.19 › rustup: 1.25.1 › rustc: 1.64.0 › cargo: 1.64.0 › Rust toolchain: stable-x86_64-apple-darwin

Packages › @tauri-apps/cli [NPM]: 1.2.0 › @tauri-apps/api [NPM]: 1.2.0 › tauri [RUST]: 1.2.0, › tauri-build [RUST]: 1.2.0, › tao [RUST]: 0.15.6, › wry [RUST]: 0.22.3,

App › build-type: bundle › CSP: unset › distDir: ../dist › devPath: http://localhost:1420/ › framework: React (Next.js) › bundler: Webpack

App directory structure ├─ dist ├─ node_modules ├─ .next ├─ public ├─ src-tauri ├─ .git ├─ .vscode └─ src