Skip to content

Commit

Permalink
-Add update mechanism via electron-updater
Browse files Browse the repository at this point in the history
-Add environment constants
-Don't pop open dev tools in about window if we're in prod build
  • Loading branch information
chrisknepper committed Jun 22, 2018
1 parent 9148ccd commit 625bf6d
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 8 deletions.
2 changes: 2 additions & 0 deletions src/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import path from "path";
import url from "url";
import { app, Menu } from "electron";
import { autoUpdater } from 'electron-updater';
import { appMenuTemplate } from './menu/app_menu_template';
import { devMenuTemplate } from "./menu/dev_menu_template";
import { editMenuTemplate } from "./menu/edit_menu_template";
Expand Down Expand Up @@ -35,6 +36,7 @@ if (env.name !== "production") {

app.on("ready", () => {
setApplicationMenu();
autoUpdater.checkForUpdatesAndNotify();

const mainWindow = createWindow("main", {
width: 1100,
Expand Down
27 changes: 20 additions & 7 deletions src/constants/index.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,26 @@
import env from 'env';

const osMap = {
win32: "Windows",
darwin: "macOS",
linux: "Linux"
win32: 'Windows',
darwin: 'macOS',
linux: 'Linux'
};

// Operating system
const osName = process.platform;
const osNameFriendly = osMap[osName];
const IS_WINDOWS = osName === 'win32';
const IS_MAC = osName === 'darwin';
const IS_LINUX = osName === 'linux';
const IS_WINDOWS = (osName === 'win32');
const IS_MAC = (osName === 'darwin');
const IS_LINUX = (osName === 'linux');

// Environment
const IS_DEV = (env.name === 'development');

export { osName, osNameFriendly, IS_WINDOWS, IS_MAC, IS_LINUX };
export {
osName,
osNameFriendly,
IS_WINDOWS,
IS_MAC,
IS_LINUX,
IS_DEV
};
3 changes: 2 additions & 1 deletion src/menu/items/about.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import appIcon from '../../../resources/icons/512x512.png';
import { IS_DEV } from '../../constants';
import openAboutWindow from 'about-window';

export const aboutMenu = () => {
openAboutWindow({
icon_path: appIcon,
copyright: 'Copyright © 2018 Chris Knepper, All rights reserved.',
product_name: 'Android Messages Desktop',
open_devtools: true
open_devtools: IS_DEV
});
};

0 comments on commit 625bf6d

Please sign in to comment.