Implemented job upload

This commit is contained in:
Patrick Fic
2020-10-14 17:08:47 -07:00
parent e7614942e5
commit 0a3c87a6f2
25 changed files with 347 additions and 131 deletions

View File

@@ -1,7 +1,9 @@
const path = require("path");
const { app, BrowserWindow } = require("electron");
const { app, BrowserWindow, ipcMain } = require("electron");
const isDev = require("electron-is-dev");
const settings = require("electron-settings");
const ipcTypes = require("../src/ipc.types");
const { StartWatcher } = require("./file-watcher/file-watcher");
require("./ipc-main-handler");
@@ -20,8 +22,9 @@ if (require("electron-squirrel-startup")) {
console.log(`${__dirname}/preload.js`);
var mainWindow = null;
let mainWindow;
function createWindow() {
makeSingleInstance();
// Create the browser window.
mainWindow = new BrowserWindow({
width: 800,
@@ -35,7 +38,6 @@ function createWindow() {
preload: path.join(__dirname, "preload.js"), // use a preload script
},
});
// and load the index.html of the app.
// win.loadFile("index.html");
mainWindow.loadURL(
@@ -46,15 +48,17 @@ function createWindow() {
// Open the DevTools.
if (isDev) {
mainWindow.webContents.openDevTools({ mode: "detach" });
mainWindow.webContents.openDevTools({
// mode: "detach"
});
}
}
exports.mainWindow = mainWindow;
// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs.
app.whenReady().then(() => {
console.log("*** Ready to launch the app! ***");
createWindow();
if (isDev) {
@@ -63,10 +67,14 @@ app.whenReady().then(() => {
.then((name) => console.log(`Added Extension: ${name}`))
.catch((error) => console.log(`An error occurred: , ${error}`));
}
//Start all of the watchers.
StartWatcher();
// ipcMain.on(ipcTypes.default.webcontent, (event, ...obj) => {
// console.log("event", event);
// mainWindow.webContents.send(event, obj);
// });
});
if (isDev) app.setAppUserModelId(process.execPath);
// Quit when all windows are closed, except on macOS. There, it's common
// for applications and their menu bar to stay active until the user quits
// explicitly with Cmd + Q.
@@ -86,3 +94,15 @@ app.on("activate", () => {
// In this file you can include the rest of your app's specific main process
// code. You can also put them in separate files and require them here.
function makeSingleInstance() {
if (process.mas) return;
app.requestSingleInstanceLock();
app.on("second-instance", () => {
if (mainWindow) {
if (mainWindow.isMinimized()) mainWindow.restore();
mainWindow.focus();
}
});
}