Skip to content

Commit 625bf6d

Browse files
committed
-Add update mechanism via electron-updater
-Add environment constants -Don't pop open dev tools in about window if we're in prod build
1 parent 9148ccd commit 625bf6d

File tree

3 files changed

+24
-8
lines changed

3 files changed

+24
-8
lines changed

src/background.js

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import path from "path";
77
import url from "url";
88
import { app, Menu } from "electron";
9+
import { autoUpdater } from 'electron-updater';
910
import { appMenuTemplate } from './menu/app_menu_template';
1011
import { devMenuTemplate } from "./menu/dev_menu_template";
1112
import { editMenuTemplate } from "./menu/edit_menu_template";
@@ -35,6 +36,7 @@ if (env.name !== "production") {
3536

3637
app.on("ready", () => {
3738
setApplicationMenu();
39+
autoUpdater.checkForUpdatesAndNotify();
3840

3941
const mainWindow = createWindow("main", {
4042
width: 1100,

src/constants/index.js

+20-7
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,26 @@
1+
import env from 'env';
2+
13
const osMap = {
2-
win32: "Windows",
3-
darwin: "macOS",
4-
linux: "Linux"
4+
win32: 'Windows',
5+
darwin: 'macOS',
6+
linux: 'Linux'
57
};
68

9+
// Operating system
710
const osName = process.platform;
811
const osNameFriendly = osMap[osName];
9-
const IS_WINDOWS = osName === 'win32';
10-
const IS_MAC = osName === 'darwin';
11-
const IS_LINUX = osName === 'linux';
12+
const IS_WINDOWS = (osName === 'win32');
13+
const IS_MAC = (osName === 'darwin');
14+
const IS_LINUX = (osName === 'linux');
15+
16+
// Environment
17+
const IS_DEV = (env.name === 'development');
1218

13-
export { osName, osNameFriendly, IS_WINDOWS, IS_MAC, IS_LINUX };
19+
export {
20+
osName,
21+
osNameFriendly,
22+
IS_WINDOWS,
23+
IS_MAC,
24+
IS_LINUX,
25+
IS_DEV
26+
};

src/menu/items/about.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import appIcon from '../../../resources/icons/512x512.png';
2+
import { IS_DEV } from '../../constants';
23
import openAboutWindow from 'about-window';
34

45
export const aboutMenu = () => {
56
openAboutWindow({
67
icon_path: appIcon,
78
copyright: 'Copyright © 2018 Chris Knepper, All rights reserved.',
89
product_name: 'Android Messages Desktop',
9-
open_devtools: true
10+
open_devtools: IS_DEV
1011
});
1112
};

0 commit comments

Comments
 (0)