From 5a522dbd6fda9446c555839da23f8006fc8aa444 Mon Sep 17 00:00:00 2001 From: liamcottle Date: Sun, 7 Jul 2024 21:10:26 +1200 Subject: [PATCH] show native notification when a new message is received --- public/index.html | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/public/index.html b/public/index.html index 1038d87..09be43b 100644 --- a/public/index.html +++ b/public/index.html @@ -1404,6 +1404,15 @@ } + // show notification for new messages when using electron + Notification.requestPermission().then((result) => { + if(result === "granted"){ + new window.Notification("New Message", { + body: "Someone sent you a message.", + }); + } + }); + // auto scroll to bottom if we want to if(this.autoScrollOnNewMessage){ this.scrollMessagesToBottom();