1ca0b836e1
Mirrors the rail's unread-chat count onto the Windows taskbar icon (overlay) and the macOS/Linux dock badge. updateRailUnread() draws a small red count badge on a canvas and hands it to the shell via bizConnectNative.setUnread(count, dataUrl); main sets it with win.setOverlayIcon + app.setBadgeCount. Clears at 0, shows 99+ past 99. No-op in a browser/mobile. (home.html build batch17) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
17 lines
1003 B
JavaScript
17 lines
1003 B
JavaScript
// Minimal, safe bridge into the web UI. Runs with contextIsolation, so it only exposes a
|
|
// frozen marker the web app can feature-detect against (e.g. to hide the PWA install prompt
|
|
// or prefer native push). No Node APIs are exposed to page JS.
|
|
const { contextBridge, ipcRenderer } = require('electron');
|
|
|
|
contextBridge.exposeInMainWorld('__NATIVE__', 'desktop');
|
|
contextBridge.exposeInMainWorld('bizConnectNative', Object.freeze({
|
|
platform: 'desktop',
|
|
version: process.env.npm_package_version || '0.1.0',
|
|
// Bring the app window to the foreground (e.g. when a notification is clicked) — the web
|
|
// Notification's window.focus() can't raise an Electron window; the main process must.
|
|
focusApp: () => ipcRenderer.send('focus-window'),
|
|
// Show the unread-chat count as a badge on the taskbar icon. count=number of chats with
|
|
// unread; dataUrl=a small PNG badge the renderer drew (null to clear).
|
|
setUnread: (count, dataUrl) => ipcRenderer.send('set-unread', { count, dataUrl }),
|
|
}));
|