-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathmain.js
More file actions
57 lines (44 loc) · 1.47 KB
/
main.js
File metadata and controls
57 lines (44 loc) · 1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
const { app } = require('electron');
const { checkForUpdates, setupUpdater } = require('./main/setupUpdater');
const { openSelectedVaultWin, openSelectedVaultMac } = require('./main/openSelectedVault');
const configureWindowDisplay = require('./main/configureWindowDisplay');
const handleScreenLock = require('./main/handleScreenLock');
const setupWebRequests = require('./main/setupWebRequests');
const isDev = require('./main/isDev');
// keep reference to mainWindow globally
let mainWindow;
function createWindow() {
// Allow users to open a qvault by clicking file on windows
openSelectedVaultWin();
// Display the main window once ready
mainWindow = configureWindowDisplay(mainWindow);
mainWindow.loadFile('index.html');
// Configure hooks for autoUpdate triggers
mainWindow = setupUpdater(mainWindow);
// emit systemIdle events
mainWindow = handleScreenLock(mainWindow);
// setup filters for http requests
mainWindow = setupWebRequests(mainWindow);
// Dereference the window object when the app closes
mainWindow.on('closed', function () {
mainWindow = null;
});
if (isDev){
mainWindow.webContents.openDevTools();
}
return mainWindow;
}
// Allow users to open a qvault by clicking file on mac
openSelectedVaultMac();
app.on('ready', function () {
createWindow();
checkForUpdates();
});
app.on('activate', function () {
if (mainWindow === null) {
createWindow();
}
});
app.on('window-all-closed', function () {
app.quit();
});