Add background WhatsApp notifications

- Show service worker notifications and focus the app when clicked
- Bump the package version to 1.0.8
This commit is contained in:
JustZoe101 committed 2026-11-20 09:45:05 +01:00
1 parent 02f5b05265
commit 2b7460d976
5 files changed
+329 -8

No files matched your search

+8 -3
View File
@@ -11,6 +11,7 @@ const fs = require('node:fs');
const path = require('node:path');
const downloadToast = require('./download-toast');
const notifications = require('./notifications');
const version = require('./version');
const WHATSAPP_URL = 'https://web.whatsapp.com/';
@@ -164,17 +165,20 @@ function createWindow() {
// Re-apply after every full page load (e.g. after logging in).
win.webContents.on('dom-ready', () => {
version.injectVersionStyles(win.webContents).catch(() => {});
version.injectVersionBadge(win.webContents).catch(() => {});
// version.injectVersionStyles(win.webContents).catch(() => {});
// version.injectVersionBadge(win.webContents).catch(() => {});
downloadToast.injectStyles(win.webContents).catch(() => {});
});
win.webContents.on('did-navigate-in-page', () => {
version.injectVersionBadge(win.webContents).catch(() => {});
// version.injectVersionBadge(win.webContents).catch(() => {});
});
downloadToast.setWindow(win);
// Keep WhatsApp notifying while another app has focus.
notifications.install(win);
win.on('closed', () => {
downloadToast.closeAll();
});
@@ -235,6 +239,7 @@ app.whenReady().then(() => {
whatsappSession.on('will-download', handleDownload);
downloadToast.registerIpc();
notifications.registerIpc();
createWindow();