We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Here is my code .
const notifier = require('node-notifier'); const path = require('path'); const { shell, ipcMain } = require('electron'); const socket = require('socket.io-client')('http://192.168.50.25:5050/'); const { insertRecordsIntoNotification, createNotificationTable } = require('../repos/notificationRepo.js');
async function showNotification(message, isResponse) { try { console.log("showNotification triggered");
if (!message) { throw new Error('No message provided.'); } const messageJson = JSON.parse(message); const iconPath = path.resolve(__dirname, '../assets/images/logo.png'); const contentImage = path.resolve(__dirname, '../assets/images/background-image.png') if (!messageJson.Title || !messageJson.Message || !messageJson.Records || !Array.isArray(messageJson.Records)) { throw new Error('Invalid message format.'); } console.log(messageJson.Message); if (!isResponse) { createNotificationTable(); await insertRecordsIntoNotification(messageJson.Message); } const buttons = messageJson.Records.map(record => record.label); notifier.notify({ title: messageJson.Title, message: messageJson.Message, icon: iconPath, contentImage: contentImage, wait: true, actions: buttons, appID:"Smart Agent" }); messageJson.Records.forEach(element => { const label = element.label.toLowerCase(); switch (element.type.toLowerCase()) { case 'button': { if (messageJson.NotificationType === 'RemoteShare') { notifier.on(label, () => { try { console.log(`${label}ed the remote desktop sharing request and Emitting ${label} response... ${element.action}`); const obj = { response: label, room: element.action, clntName: messageJson.clntName }; ipcMain.emit('start-share', obj); } catch (error) { console.error('Error:', error.message); } }); } else if(messageJson.NotificationType === 'RemoteShareResponse'){ console.log(`disconnected the remote desktop sharing request`); } else{ notifier.on(label, () => { shell.openExternal(element.action); }); } break; } case 'link': { shell.openExternal(element.action); break; } default: break; } }); } catch (error) { console.error('Error:', error.message); }
}
module.exports = { showNotification };
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Here is my code .
const notifier = require('node-notifier');
const path = require('path');
const { shell, ipcMain } = require('electron');
const socket = require('socket.io-client')('http://192.168.50.25:5050/');
const { insertRecordsIntoNotification, createNotificationTable } = require('../repos/notificationRepo.js');
async function showNotification(message, isResponse) {
try {
console.log("showNotification triggered");
}
module.exports = { showNotification };
The text was updated successfully, but these errors were encountered: