mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-21 15:09:10 +00:00
refract: update notification style
Notifications title is app (windows) notifications now have title and message
This commit is contained in:
+9
-5
@@ -42,9 +42,9 @@ const nodePath =
|
|||||||
const trayIcon = path.join(__dirname, './assets/background.png');
|
const trayIcon = path.join(__dirname, './assets/background.png');
|
||||||
const appIcon = path.join(__dirname, './assets/logo.png');
|
const appIcon = path.join(__dirname, './assets/logo.png');
|
||||||
|
|
||||||
function showNotification(text) {
|
function showNotification(title, text) {
|
||||||
new Notification({
|
new Notification({
|
||||||
title: 'ontime',
|
title: title,
|
||||||
body: text,
|
body: text,
|
||||||
silent: true,
|
silent: true,
|
||||||
}).show();
|
}).show();
|
||||||
@@ -113,6 +113,11 @@ function createWindow() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
app.whenReady().then(() => {
|
app.whenReady().then(() => {
|
||||||
|
// Set app title in windows
|
||||||
|
if (process.platform === 'win32') {
|
||||||
|
app.setAppUserModelId(app.name);
|
||||||
|
}
|
||||||
|
|
||||||
createWindow();
|
createWindow();
|
||||||
|
|
||||||
// register global shortcuts
|
// register global shortcuts
|
||||||
@@ -151,7 +156,6 @@ app.whenReady().then(() => {
|
|||||||
win.focus();
|
win.focus();
|
||||||
|
|
||||||
splash.destroy();
|
splash.destroy();
|
||||||
showNotification(loaded.toString());
|
|
||||||
|
|
||||||
// tray stuff
|
// tray stuff
|
||||||
// TODO: get IP Address
|
// TODO: get IP Address
|
||||||
@@ -163,7 +167,7 @@ app.whenReady().then(() => {
|
|||||||
win.on('close', function (event) {
|
win.on('close', function (event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
if (!isQuitting) {
|
if (!isQuitting) {
|
||||||
showNotification('App running in background');
|
showNotification('Window Closed', 'App running in background');
|
||||||
win.hide();
|
win.hide();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -209,7 +213,7 @@ app.once('before-quit', () => {
|
|||||||
// Get messages from react
|
// Get messages from react
|
||||||
// Test message
|
// Test message
|
||||||
ipcMain.on('test-message', (event, arg) => {
|
ipcMain.on('test-message', (event, arg) => {
|
||||||
showNotification('testing 1-2', arg);
|
showNotification('Test Message', 'test from react', arg);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Terminate
|
// Terminate
|
||||||
|
|||||||
Reference in New Issue
Block a user