chore: monorepo
This commit is contained in:
16
packages/utils/src/notification.ts
Normal file
16
packages/utils/src/notification.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import {
|
||||
isPermissionGranted,
|
||||
requestPermission,
|
||||
sendNotification,
|
||||
} from "@tauri-apps/plugin-notification";
|
||||
|
||||
export async function sendNativeNotification(content: string, title?: string) {
|
||||
let permissionGranted = await isPermissionGranted();
|
||||
if (!permissionGranted) {
|
||||
const permission = await requestPermission();
|
||||
permissionGranted = permission === "granted";
|
||||
}
|
||||
if (permissionGranted) {
|
||||
sendNotification({ title: title || "Lume", body: content });
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user