clean up notification code

This commit is contained in:
liamcottle 2024-08-06 01:06:25 +12:00
parent 870fc72f09
commit 4a92d44991
3 changed files with 31 additions and 16 deletions

View file

@ -0,0 +1,27 @@
class NotificationUtils {
static showIncomingCallNotification() {
Notification.requestPermission().then((result) => {
if(result === "granted"){
new window.Notification("Incoming Call", {
body: "Someone is calling you.",
tag: "new_audio_call", // only ever show one incoming call notification at a time
});
}
});
}
static showNewMessageNotification() {
Notification.requestPermission().then((result) => {
if(result === "granted"){
new window.Notification("New Message", {
body: "Someone sent you a message.",
tag: "new_message", // only ever show one new message notification at a time
});
}
});
}
}
export default NotificationUtils;