William O'Beirne e7633c6d2f MyEtherWallet -> MyCrypto (#977)
* Replace all mentions of MyEtherWallet in translations with MyCrypto

* Replace all translation mentions of kvhnuke/etherwallet repo with MyCryptoHQ/MyCrypto repo.

* Replace all instances of MEW with MyCrypto in translations.

* Replace all instances of myetherwallet.com with mycrypto.com

* First pass of myetherwallet -> mycrypto in codebase.

* Replace most MEWs and mews with MyCrypto or MyC or myc

* Update all assets, clean out unused old assets.

* Adjust v3 url

* Convert all links to help articles to a help link component to make future changes easier.

* Rework onboarding images

* Adjust logo colors due to CMY issue.

* Update donation address, remove mentions of mewtopia.eth

* Update license

* Update sosh meed and referral links.

* Fix more translations strings.

* Tscheck fix.

* Update shapeshift api key.
2018-02-06 22:28:28 -06:00

80 lines
1.9 KiB
TypeScript

import { BrowserWindow, Menu, shell } from 'electron';
import { URL } from 'url';
import MENU from './menu';
import updater from './updater';
import { APP_TITLE } from '../constants';
const isDevelopment = process.env.NODE_ENV !== 'production';
// Cached reference, preventing recreations
let window;
// Construct new BrowserWindow
export default function getWindow() {
if (window) {
return window;
}
window = new BrowserWindow({
title: APP_TITLE,
backgroundColor: '#fbfbfb',
width: 1220,
height: 800,
minWidth: 320,
minHeight: 400,
// TODO - Implement styles for custom title bar in components/ui/TitleBar.scss
// frame: false,
// titleBarStyle: 'hidden',
webPreferences: {
devTools: true,
nodeIntegration: false,
contextIsolation: true
}
});
const port = process.env.HTTPS ? '3443' : '3000';
const appUrl = isDevelopment ? `http://localhost:${port}` : `file://${__dirname}/index.html`;
window.loadURL(appUrl);
window.on('closed', () => {
window = null;
});
window.webContents.on('new-window', (ev, urlStr) => {
// Kill all new window requests by default
ev.preventDefault();
// Only allow HTTPS urls to actually be opened
const url = new URL(urlStr);
if (url.protocol === 'https:') {
shell.openExternal(urlStr);
} else {
console.warn(`Blocked request to open new window '${urlStr}', only HTTPS links are allowed`);
}
});
window.webContents.on('did-finish-load', () => {
updater(window);
});
window.webContents.on('devtools-opened', () => {
window.focus();
setImmediate(() => {
window.focus();
});
});
if (isDevelopment) {
window.webContents.on('did-fail-load', () => {
setTimeout(() => {
if (window && window.webContents) {
window.webContents.reload();
}
}, 500);
});
}
Menu.setApplicationMenu(Menu.buildFromTemplate(MENU));
return window;
}