From 2011e7cad6a61f75c232b8a34839be629bad6c07 Mon Sep 17 00:00:00 2001 From: meriadec Date: Mon, 15 Jan 2018 18:36:17 +0100 Subject: [PATCH] Create UpdateNotifier and connect it to updates statuses --- package.json | 2 +- src/components/Wrapper.js | 43 +++++++++++++++---------- src/main/app.js | 21 +++++++++--- src/styles/global.js | 1 + yarn.lock | 67 ++++++++++++++++++++++++++++----------- 5 files changed, 93 insertions(+), 41 deletions(-) diff --git a/package.json b/package.json index e420c04c..bd4cee76 100644 --- a/package.json +++ b/package.json @@ -62,7 +62,7 @@ "babel-preset-stage-0": "^6.24.1", "concurrently": "^3.5.1", "electron": "1.7.10", - "electron-builder": "^19.53.6", + "electron-builder": "^19.53.7", "electron-webpack": "1.11.0", "eslint": "^4.13.1", "eslint-config-airbnb": "^16.1.0", diff --git a/src/components/Wrapper.js b/src/components/Wrapper.js index c417f2f5..d23e2fe4 100644 --- a/src/components/Wrapper.js +++ b/src/components/Wrapper.js @@ -1,6 +1,7 @@ // @flow -import React from 'react' +import React, { PureComponent } from 'react' +import { ipcRenderer } from 'electron' // eslint-disable-line import/no-extraneous-dependencies import { Route } from 'react-router' import { translate } from 'react-i18next' @@ -16,21 +17,29 @@ import UpdateNotifier from 'components/UpdateNotifier' import SideBar from 'components/SideBar' import TopBar from 'components/TopBar' -const Wrapper = () => ( - - - - - - - - - - - - - - -) +class Wrapper extends PureComponent<{}> { + componentDidMount() { + ipcRenderer.send('renderer-ready') + } + + render() { + return ( + + + + + + + + + + + + + + + ) + } +} export default translate()(Wrapper) diff --git a/src/main/app.js b/src/main/app.js index 7a6a98fe..063d697a 100644 --- a/src/main/app.js +++ b/src/main/app.js @@ -1,14 +1,23 @@ // @flow -import { app, BrowserWindow } from 'electron' // eslint-disable-line import/no-extraneous-dependencies +import { app, ipcMain, BrowserWindow } from 'electron' // eslint-disable-line import/no-extraneous-dependencies // necessary to prevent win from being garbage collected let mainWindow function createMainWindow() { - const window = new BrowserWindow({ - vibrancy: 'dark', - }) + const windowOptions = { + ...(process.platform === 'darwin' + ? { + frame: false, + titleBarStyle: 'hiddenInset', + vibrancy: 'ultra-dark', + } + : {}), + show: false, + } + + const window = new BrowserWindow(windowOptions) const url = __DEV__ ? `http://localhost:${process.env.ELECTRON_WEBPACK_WDS_PORT || ''}` @@ -24,6 +33,10 @@ function createMainWindow() { mainWindow = null }) + ipcMain.on('renderer-ready', () => { + window.show() + }) + window.webContents.on('devtools-opened', () => { window.focus() setImmediate(() => { diff --git a/src/styles/global.js b/src/styles/global.js index 2a5342d7..1d9214be 100644 --- a/src/styles/global.js +++ b/src/styles/global.js @@ -22,6 +22,7 @@ injectGlobal` line-height: 1.5; font-size: 16px; font-family: "Open Sans", Arial, Helvetica, sans-serif; + -webkit-app-region: drag; } #app { diff --git a/yarn.lock b/yarn.lock index e3eb85a2..217903b9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1589,7 +1589,16 @@ buffers@~0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/buffers/-/buffers-0.1.1.tgz#b24579c3bed4d6d396aeee6d9a8ae7f5482ab7bb" -builder-util-runtime@4.0.1, builder-util-runtime@^4.0.0, builder-util-runtime@^4.0.1, builder-util-runtime@~4.0.0: +builder-util-runtime@4.0.2, builder-util-runtime@^4.0.2: + version "4.0.2" + resolved "https://registry.yarnpkg.com/builder-util-runtime/-/builder-util-runtime-4.0.2.tgz#673f1a0f2e275e6f80a16ce57225589a003c9a52" + dependencies: + bluebird-lst "^1.0.5" + debug "^3.1.0" + fs-extra-p "^4.5.0" + sax "^1.2.4" + +builder-util-runtime@^4.0.1, builder-util-runtime@~4.0.0: version "4.0.1" resolved "https://registry.yarnpkg.com/builder-util-runtime/-/builder-util-runtime-4.0.1.tgz#d8423190a21e8c7cec185d589cb0cb888cc8e731" dependencies: @@ -1598,7 +1607,27 @@ builder-util-runtime@4.0.1, builder-util-runtime@^4.0.0, builder-util-runtime@^4 fs-extra-p "^4.5.0" sax "^1.2.4" -builder-util@4.1.5, builder-util@^4.1.0, builder-util@^4.1.2: +builder-util@4.1.6, builder-util@^4.1.6: + version "4.1.6" + resolved "https://registry.yarnpkg.com/builder-util/-/builder-util-4.1.6.tgz#369313429c3feebb75bb60808382397195e18a30" + dependencies: + "7zip-bin" "^2.3.4" + bluebird-lst "^1.0.5" + builder-util-runtime "^4.0.2" + chalk "^2.3.0" + debug "^3.1.0" + fs-extra-p "^4.5.0" + ini "^1.3.5" + is-ci "^1.1.0" + js-yaml "^3.10.0" + lazy-val "^1.0.3" + semver "^5.4.1" + source-map-support "^0.5.0" + stat-mode "^0.2.2" + temp-file "^3.1.1" + tunnel-agent "^0.6.0" + +builder-util@^4.1.0: version "4.1.5" resolved "https://registry.yarnpkg.com/builder-util/-/builder-util-4.1.5.tgz#924a7ea13368d8d3f9626d22de14a18ef170ff21" dependencies: @@ -2575,22 +2604,22 @@ ejs@^2.5.7: version "2.5.7" resolved "https://registry.yarnpkg.com/ejs/-/ejs-2.5.7.tgz#cc872c168880ae3c7189762fd5ffc00896c9518a" -electron-builder-lib@19.53.6: - version "19.53.6" - resolved "https://registry.yarnpkg.com/electron-builder-lib/-/electron-builder-lib-19.53.6.tgz#c931f0eb488e62fb3fe46d5b027c3413f3bc7159" +electron-builder-lib@19.53.7: + version "19.53.7" + resolved "https://registry.yarnpkg.com/electron-builder-lib/-/electron-builder-lib-19.53.7.tgz#6c994f4ef6c0d8042b88449ad5c6481104a9d0c6" dependencies: "7zip-bin" "^2.3.4" asar-integrity "0.2.4" async-exit-hook "^2.0.1" bluebird-lst "^1.0.5" - builder-util "4.1.5" - builder-util-runtime "4.0.1" + builder-util "4.1.6" + builder-util-runtime "4.0.2" chromium-pickle-js "^0.2.0" debug "^3.1.0" dmg-builder "3.1.0" ejs "^2.5.7" electron-osx-sign "0.4.7" - electron-publish "19.53.3" + electron-publish "19.53.7" fs-extra-p "^4.5.0" hosted-git-info "^2.5.0" is-ci "^1.1.0" @@ -2605,15 +2634,15 @@ electron-builder-lib@19.53.6: semver "^5.4.1" temp-file "^3.1.1" -electron-builder@^19.53.6: - version "19.53.6" - resolved "https://registry.yarnpkg.com/electron-builder/-/electron-builder-19.53.6.tgz#02854a7815084902b33f15d633839ddaf4e345cd" +electron-builder@^19.53.7: + version "19.53.7" + resolved "https://registry.yarnpkg.com/electron-builder/-/electron-builder-19.53.7.tgz#dae5d8d68b6016446a59b279acc1769a3bc555bc" dependencies: bluebird-lst "^1.0.5" - builder-util "4.1.5" - builder-util-runtime "4.0.1" + builder-util "4.1.6" + builder-util-runtime "4.0.2" chalk "^2.3.0" - electron-builder-lib "19.53.6" + electron-builder-lib "19.53.7" electron-download-tf "4.3.4" fs-extra-p "^4.5.0" is-ci "^1.1.0" @@ -2675,13 +2704,13 @@ electron-osx-sign@0.4.7: minimist "^1.2.0" plist "^2.1.0" -electron-publish@19.53.3: - version "19.53.3" - resolved "https://registry.yarnpkg.com/electron-publish/-/electron-publish-19.53.3.tgz#d6c076b24e3558402794c8ee58f9722605aa40d9" +electron-publish@19.53.7: + version "19.53.7" + resolved "https://registry.yarnpkg.com/electron-publish/-/electron-publish-19.53.7.tgz#b52fb70d91fc65825a444c7dd9678761a4720695" dependencies: bluebird-lst "^1.0.5" - builder-util "^4.1.2" - builder-util-runtime "^4.0.0" + builder-util "^4.1.6" + builder-util-runtime "^4.0.2" chalk "^2.3.0" fs-extra-p "^4.5.0" mime "^2.2.0"