Skip to content

Commit 76f445c

Browse files
authored
Merge pull request #10 from oslabs-beta/staging
Merge from staging to master - Spectron 2 udpate
2 parents 5c33e98 + 356685b commit 76f445c

File tree

6 files changed

+106
-148
lines changed

6 files changed

+106
-148
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,6 @@ ehthumbs.db
5959
# proto files #
6060
#####################
6161
protos/
62+
63+
# testing #
64+
test/snapshot.png

main.js

Lines changed: 31 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const {
1919
REDUX_DEVTOOLS,
2020
} = require("electron-devtools-installer");
2121
// Import Auto-Updater- Swell will update itself
22-
const { autoUpdater } = require("electron-updater");
22+
// const { autoUpdater } = require("electron-updater");
2323
// TouchBarButtons are our nav buttons(ex: Select All, Deselect All, Open Selected, Close Selected, Clear All)
2424
const { TouchBarButton, TouchBarSpacer } = TouchBar;
2525

@@ -44,9 +44,9 @@ const { ApolloLink } = require("apollo-link");
4444
require("./menu/mainMenu");
4545

4646
// configure logging
47-
autoUpdater.logger = log;
48-
autoUpdater.logger.transports.file.level = "info";
49-
log.info("App starting...");
47+
// autoUpdater.logger = log;
48+
// autoUpdater.logger.transports.file.level = "info";
49+
// log.info("App starting...");
5050

5151
console.log("app.name is ->", app.name)
5252

@@ -136,9 +136,11 @@ const touchBar = new TouchBar([
136136
// -----------------------------------------------
137137

138138
let isDev;
139-
process.argv.includes("--noDevServer") ? (isDev = false) : (isDev = true);
140-
141-
console.log("isDev->", isDev);
139+
// if using Spectron, run it in production
140+
process.argv.includes("--noDevServer") || process.argv.includes("TEST_MODE")
141+
? (isDev = false)
142+
: (isDev = true);
143+
console.log("is this in dev mode? ", isDev);
142144
// let isDev = false;
143145
// console.log("process.defaultApp ->", process.defaultApp);
144146
// console.log("process.execPath -> ", process.execPath);
@@ -264,9 +266,9 @@ function createWindow() {
264266
app.on("ready", () => {
265267
// createLoadingScreen();
266268
createWindow();
267-
if (!isDev) {
268-
autoUpdater.checkForUpdates();
269-
}
269+
// if (!isDev) {
270+
// autoUpdater.checkForUpdates();
271+
// }
270272
});
271273

272274
// Quit when all windows are closed.
@@ -287,10 +289,10 @@ const sendStatusToWindow = (text) => {
287289
}
288290
};
289291

290-
ipcMain.on("check-for-update", () => {
291-
//listens to ipcRenderer in UpdatePopUpContainer.jsx
292-
if (!isDev) autoUpdater.checkForUpdates();
293-
});
292+
// ipcMain.on("check-for-update", () => {
293+
// //listens to ipcRenderer in UpdatePopUpContainer.jsx
294+
// if (!isDev) autoUpdater.checkForUpdates();
295+
// });
294296
// autoUpdater.on('checking-for-update', () => {
295297
// sendStatusToWindow('Checking for update...');
296298
// // });
@@ -300,28 +302,28 @@ ipcMain.on("check-for-update", () => {
300302
// autoUpdater.on('update-not-available', info => {
301303
// sendStatusToWindow('Update not available.');
302304
// });
303-
autoUpdater.on("error", (err) => {
304-
console.error("autoUpdater error -> ", err);
305-
sendStatusToWindow(`Error in auto-updater`);
306-
});
307-
autoUpdater.on("download-progress", (progressObj) => {
308-
sendStatusToWindow(
309-
`Download speed: ${progressObj.bytesPerSecond} - Downloaded ${progressObj.percent}% (${progressObj.transferred} + '/' + ${progressObj.total} + )`
310-
);
311-
});
312-
autoUpdater.on("update-downloaded", (info) => {
313-
sendStatusToWindow("Update downloaded.");
314-
});
305+
// autoUpdater.on("error", (err) => {
306+
// console.error("autoUpdater error -> ", err);
307+
// sendStatusToWindow(`Error in auto-updater`);
308+
// });
309+
// autoUpdater.on("download-progress", (progressObj) => {
310+
// sendStatusToWindow(
311+
// `Download speed: ${progressObj.bytesPerSecond} - Downloaded ${progressObj.percent}% (${progressObj.transferred} + '/' + ${progressObj.total} + )`
312+
// );
313+
// });
314+
// autoUpdater.on("update-downloaded", (info) => {
315+
// sendStatusToWindow("Update downloaded.");
316+
// });
315317

316318
// autoUpdater.on('update-downloaded', info => {
317319
// // Wait 5 seconds, then quit and install
318320
// // In your application, you don't need to wait 500 ms.
319321
// // You could call autoUpdater.quitAndInstall(); immediately
320322
// autoUpdater.quitAndInstall();
321323
// });
322-
ipcMain.on("quit-and-install", () => {
323-
autoUpdater.quitAndInstall();
324-
});
324+
// ipcMain.on("quit-and-install", () => {
325+
// autoUpdater.quitAndInstall();
326+
// });
325327
// App page reloads when user selects "Refresh" from pop-up dialog
326328
ipcMain.on("fatalError", () => {
327329
console.log("received fatal error");

menu/mainMenu.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
const { Menu } = require("electron");
22
const electron = require("electron");
3+
34
const app = electron.app;
45
// --------------------------------------------------------------------------------------------------
56
// Here we are creating an array of menu tabs. Each menu tab will have its own list items(aka a sub-menu).
@@ -93,7 +94,7 @@ const template = [
9394
{
9495
label: "Learn More",
9596
click() {
96-
require("electron").shell.openExternal("http://electron.atom.io");
97+
electron.shell.openExternal("http://electron.atom.io");
9798
},
9899
},
99100
],

0 commit comments

Comments
 (0)