feat: add notification system with hotkey events and permission handling (#3867)
* feat: add notification system with hotkey events and permission handling * Add macOS-specific handling for AppHidden notification Introduces conditional support for the AppHidden notification event, enabling macOS-specific behavior. Updates the enum and notification logic to include this platform-specific feature. Improves macOS user experience by accommodating system-level application hiding events. * Implement feature X to enhance user experience and fix bug Y in module Z * refactor(notification): update notification keys for consistency and clarity * chore(deps): update dependencies to latest versions
This commit is contained in:
17
src/utils/notification-permission.ts
Normal file
17
src/utils/notification-permission.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import {
|
||||
isPermissionGranted,
|
||||
requestPermission,
|
||||
} from "@tauri-apps/plugin-notification";
|
||||
|
||||
export async function setupNotificationPermission() {
|
||||
let permission = await isPermissionGranted();
|
||||
if (!permission) {
|
||||
const result = await requestPermission();
|
||||
permission = result === "granted";
|
||||
}
|
||||
if (permission) {
|
||||
console.log("通知权限已授予");
|
||||
} else {
|
||||
console.log("通知权限被拒绝");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user