Add basic acknolwedgmenet to notifications.
This commit is contained in:
@@ -1,34 +1,34 @@
|
||||
const { ipcMain } = require("electron");
|
||||
const { app } = require("electron");
|
||||
//const { app } = require("electron");
|
||||
const log = require("electron-log");
|
||||
const Nucleus = require("nucleus-nodejs");
|
||||
//const Nucleus = require("nucleus-nodejs");
|
||||
const { default: ipcTypes } = require("../src/ipc.types");
|
||||
|
||||
Nucleus.init("5f91b569b95bac34eefdb63a", {
|
||||
disableInDev: true,
|
||||
debug: false,
|
||||
version: app.getVersion(),
|
||||
});
|
||||
// Nucleus.init("5f91b569b95bac34eefdb63a", {
|
||||
// disableInDev: true,
|
||||
// debug: false,
|
||||
// version: app.getVersion(),
|
||||
// });
|
||||
|
||||
Nucleus.setProps({
|
||||
version: app.getVersion(),
|
||||
});
|
||||
// Nucleus.setProps({
|
||||
// version: app.getVersion(),
|
||||
// });
|
||||
|
||||
Nucleus.onError = (type, err) => {
|
||||
log.error(err);
|
||||
// type will either be uncaughtException, unhandledRejection or windowError
|
||||
};
|
||||
// Nucleus.onError = (type, err) => {
|
||||
// log.error(err);
|
||||
// // type will either be uncaughtException, unhandledRejection or windowError
|
||||
// };
|
||||
|
||||
ipcMain.on(ipcTypes.app.toMain.setUserName, (event, userName) => {
|
||||
Nucleus.setUserId(userName);
|
||||
Nucleus.appStarted();
|
||||
// Nucleus.setUserId(userName);
|
||||
// Nucleus.appStarted();
|
||||
});
|
||||
|
||||
ipcMain.on(ipcTypes.app.toMain.track, (e, args) => {
|
||||
log.log("NUCLEUS Event", args);
|
||||
const { event, ...eventDetails } = args;
|
||||
// const { event, ...eventDetails } = args;
|
||||
try {
|
||||
Nucleus.track(event, eventDetails);
|
||||
//// Nucleus.track(event, eventDetails);
|
||||
} catch (error) {
|
||||
log.error(error);
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ const ipcTypes = require("../../src/ipc.types");
|
||||
const {
|
||||
NewNotification,
|
||||
} = require("../notification-wrapper/notification-wrapper");
|
||||
const Nucleus = require("nucleus-nodejs");
|
||||
//const Nucleus = require("nucleus-nodejs");
|
||||
|
||||
async function ImportJob(path) {
|
||||
const b = BrowserWindow.getAllWindows()[0];
|
||||
@@ -27,7 +27,7 @@ async function ImportJob(path) {
|
||||
});
|
||||
} else {
|
||||
log.info(`Ignored job. ${newJob.ERROR}`);
|
||||
Nucleus.track("IGNORE_JOB", { reason: newJob.ERROR });
|
||||
// Nucleus.track("IGNORE_JOB", { reason: newJob.ERROR });
|
||||
NewNotification({
|
||||
title: "Job Ignored",
|
||||
body: newJob.ERROR,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
const { ipcMain } = require("electron");
|
||||
const Nucleus = require("nucleus-nodejs");
|
||||
//const Nucleus = require("nucleus-nodejs");
|
||||
const ipcTypes = require("../../src/ipc.types");
|
||||
const { ImportJob } = require("../decoder/decoder");
|
||||
const { GetListOfEstimates, DeleteAllEms } = require("./file-scan");
|
||||
@@ -18,7 +18,7 @@ ipcMain.on(
|
||||
ipcMain.on(
|
||||
ipcTypes.default.fileScan.toMain.importJob,
|
||||
async (event, filePath) => {
|
||||
Nucleus.track("IMPORT_JOB_FROM_SCAN");
|
||||
// Nucleus.track("IMPORT_JOB_FROM_SCAN");
|
||||
await ImportJob(filePath);
|
||||
}
|
||||
);
|
||||
@@ -26,7 +26,7 @@ ipcMain.on(
|
||||
ipcMain.on(
|
||||
ipcTypes.default.fileScan.toMain.deleteAllEms,
|
||||
async (event, filePath) => {
|
||||
Nucleus.track("DELETE_ALLEMS");
|
||||
// Nucleus.track("DELETE_ALLEMS");
|
||||
await DeleteAllEms();
|
||||
const ret = await GetListOfEstimates();
|
||||
event.reply(
|
||||
|
||||
@@ -3,13 +3,11 @@ const fs = require("fs");
|
||||
const { store } = require("../electron-store");
|
||||
const log = require("electron-log");
|
||||
const fsPromises = fs.promises;
|
||||
const _ = require("lodash");
|
||||
const { DecodeEstimate } = require("../decoder/decoder");
|
||||
const Nucleus = require("nucleus-nodejs");
|
||||
const { format } = require("path");
|
||||
//const Nucleus = require("nucleus-nodejs");
|
||||
|
||||
async function GetListOfEstimates() {
|
||||
Nucleus.track("SCAN_ALL_ESTIMATES");
|
||||
// Nucleus.track("SCAN_ALL_ESTIMATES");
|
||||
log.info("Scanning all local estimates..");
|
||||
const ListOfEnvFiles = await GetEnvFiles();
|
||||
const ListOfSummarizedEstimates = await ReadAllEstimates(ListOfEnvFiles);
|
||||
|
||||
@@ -8,7 +8,7 @@ const {
|
||||
NewNotification,
|
||||
} = require("../notification-wrapper/notification-wrapper");
|
||||
const log = require("electron-log");
|
||||
const Nucleus = require("nucleus-nodejs");
|
||||
//const Nucleus = require("nucleus-nodejs");
|
||||
var watcher;
|
||||
|
||||
async function StartWatcher() {
|
||||
@@ -71,7 +71,7 @@ async function StartWatcher() {
|
||||
log.error("Error in Watcher", error);
|
||||
const b = BrowserWindow.getFocusedWindow();
|
||||
b.webContents.send(ipcTypes.default.fileWatcher.toRenderer.error, error);
|
||||
Nucleus.track("WATCHER_ERROR", error);
|
||||
// Nucleus.track("WATCHER_ERROR", error);
|
||||
})
|
||||
.on("ready", onWatcherReady)
|
||||
.on("raw", function (event, path, details) {
|
||||
|
||||
@@ -15,7 +15,7 @@ const { store } = require("./electron-store");
|
||||
const { autoUpdater } = require("electron-updater");
|
||||
const log = require("electron-log");
|
||||
|
||||
const Nucleus = require("nucleus-nodejs");
|
||||
//const Nucleus = require("nucleus-nodejs");
|
||||
require("./ipc-main-handler");
|
||||
require("./analytics");
|
||||
|
||||
@@ -299,12 +299,12 @@ ipcMain.on(ipcTypes.app.toMain.checkForUpdates, (event, args) => {
|
||||
});
|
||||
|
||||
ipcMain.on(ipcTypes.app.toMain.downloadUpdates, (event, args) => {
|
||||
Nucleus.track("DOWNLOAD_UPDATE_FROM_RENDERER");
|
||||
//Nucleus.track("DOWNLOAD_UPDATE_FROM_RENDERER");
|
||||
autoUpdater.downloadUpdate();
|
||||
});
|
||||
|
||||
ipcMain.on(ipcTypes.app.toMain.installUpdates, (event, args) => {
|
||||
Nucleus.track("INSTALL_UPDATE_FROM_RENDERER");
|
||||
//Nucleus.track("INSTALL_UPDATE_FROM_RENDERER");
|
||||
const isSilent = true;
|
||||
const isForceRunAfter = true;
|
||||
autoUpdater.quitAndInstall(isSilent, isForceRunAfter);
|
||||
@@ -316,7 +316,7 @@ autoUpdater.on("download-progress", (ev) => {
|
||||
});
|
||||
|
||||
autoUpdater.on("update-downloaded", (ev, info) => {
|
||||
Nucleus.track("UPDATE_DOWNLOADED", ev);
|
||||
//Nucleus.track("UPDATE_DOWNLOADED", ev);
|
||||
// if (process.env.NODE_ENV === "production") {
|
||||
mainWindow.webContents.send(ipcTypes.app.toRenderer.downloadProgress, {
|
||||
...ev,
|
||||
|
||||
Reference in New Issue
Block a user