From a4c52b8d647f37ac06e7604e570a15cab996c504 Mon Sep 17 00:00:00 2001 From: Daniel Gasienica Date: Fri, 2 Mar 2018 14:43:03 -0500 Subject: [PATCH] Upgrade to Electron 1.8.2 / Node.js 8.2.1 (#2066) * Upgrade to Electron 1.8.2 / Node.js 8.2.1 * Update CI Node.js versions * Make `engines` top-level property This was accidentally included under `build` which is disallowed by `electron-builder`. * Refactor notification updates Allows easier debugging through variable inspection. * Use `appId` for Application User Model ID Recommended in: https://github.com/electron/electron/issues/10864#issuecomment-346229090 * Update `spectron` to 3.8.0 * Bump `electron-builder` based dependencies * Use `config.extraMetadata` instead of `em` Prevents `Unknown argument: em` error. See: https://github.com/electron-userland/electron-builder/issues/2615 * Revert AUMID to be based on `packageJson.name` In our build artifact `packageJson.build.appId` causes an NPE. --- .nvmrc | 2 +- .travis.yml | 4 ++-- appveyor.yml | 4 ++-- js/notifications.js | 8 +++++--- main.js | 7 +++---- package.json | 15 +++++++++------ yarn.lock | 14 +++++++------- 7 files changed, 29 insertions(+), 25 deletions(-) diff --git a/.nvmrc b/.nvmrc index 4bc5d6181..2b0aa2121 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -7.9.0 +8.2.1 diff --git a/.travis.yml b/.travis.yml index 2915dcc3b..842618223 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,6 @@ language: node_js node_js: - - '7.9.0' + - '8.2.1' os: - linux dist: trusty @@ -12,7 +12,7 @@ script: - yarn eslint - yarn test-server - yarn lint - - ./node_modules/.bin/build --em.environment=$SIGNAL_ENV --config.mac.bundleVersion='$TRAVIS_BUILD_NUMBER' --publish=never + - $(yarn bin)/build --config.extraMetadata.environment=$SIGNAL_ENV --config.mac.bundleVersion='$TRAVIS_BUILD_NUMBER' --publish=never - ./travis.sh env: global: diff --git a/appveyor.yml b/appveyor.yml index f7a95d3a9..82c82f320 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -8,7 +8,7 @@ cache: install: - systeminfo | findstr /C:"OS" - set PATH=C:\Ruby23-x64\bin;%PATH% - - ps: Install-Product node 7.9.0 x64 + - ps: Install-Product node 8.2.1 x64 - yarn install build_script: @@ -20,7 +20,7 @@ build_script: - type package.json | findstr /v certificateSubjectName > temp.json - move temp.json package.json - yarn prepare-beta-build - - node_modules\.bin\build --em.environment=%SIGNAL_ENV% --publish=never + - node_modules\.bin\build --config.extraMetadata.environment=%SIGNAL_ENV% --publish=never test_script: - node build\grunt.js test diff --git a/js/notifications.js b/js/notifications.js index e93d4569d..e89dddb97 100644 --- a/js/notifications.js +++ b/js/notifications.js @@ -26,9 +26,10 @@ this.trigger('click', conversation); }, update: function() { + const isFocused = window.isFocused(); console.log( 'updating notifications - count:', this.length, - 'focused:', window.isFocused(), + 'focused:', isFocused, 'enabled:', enabled ); if (!enabled) { @@ -37,8 +38,9 @@ if (this.length === 0) { return; } - if (window.isFocused()) { - // The window is focused. Consider yourself notified. + + const isNotificationOmitted = isFocused; + if (isNotificationOmitted) { this.clear(); return; } diff --git a/main.js b/main.js index 3182880d2..f17d7912d 100644 --- a/main.js +++ b/main.js @@ -22,10 +22,9 @@ const logging = require('./app/logging'); const autoUpdate = require('./app/auto_update'); const windowState = require('./app/window_state'); - -const aumid = `org.whispersystems.${packageJson.name}`; -console.log(`setting AUMID to ${aumid}`); -app.setAppUserModelId(aumid); +const appUserModelId = `org.whispersystems.${packageJson.name}`; +console.log('Set Windows Application User Model ID (AUMID)', { appUserModelId }); +app.setAppUserModelId(appUserModelId); // Keep a global reference of the window object, if you don't, the window will // be closed automatically when the JavaScript object is garbage collected. diff --git a/package.json b/package.json index e072a61ab..3dd7e49c1 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "asarl": "asar l release/mac/Signal.app/Contents/Resources/app.asar", "icon-gen": "electron-icon-maker --input=images/icon_1024.png --output=./build", "generate": "npm run icon-gen && grunt", - "build": "build --em.environment=$SIGNAL_ENV", + "build": "build --config.extraMetadata.environment=$SIGNAL_ENV", "dist": "npm run generate && npm run build", "pack": "npm run generate && npm run build -- --dir", "prepare-beta-build": "node prepare_beta_build.js", @@ -51,7 +51,7 @@ "electron-config": "^1.0.0", "electron-editor-context-menu": "^1.1.1", "electron-is-dev": "^0.3.0", - "electron-updater": "^2.19.0", + "electron-updater": "^2.21.0", "emoji-datasource": "4.0.0", "emoji-datasource-apple": "4.0.0", "emoji-js": "^3.4.0", @@ -75,10 +75,10 @@ "asar": "^0.14.0", "bower": "^1.8.2", "chai": "^4.1.2", - "electron": "1.7.12", - "electron-builder": "^19.53.7", + "electron": "1.8.2", + "electron-builder": "^20.2.0", "electron-icon-maker": "0.0.3", - "electron-publisher-s3": "^19.53.7", + "electron-publisher-s3": "^20.2.0", "eslint": "^4.14.0", "eslint-config-airbnb-base": "^12.1.0", "eslint-plugin-import": "^2.8.0", @@ -98,9 +98,12 @@ "mocha-testcheck": "^1.0.0-rc.0", "node-sass-import-once": "^1.2.0", "nyc": "^11.4.1", - "spectron": "^3.7.2", + "spectron": "^3.8.0", "tmp": "^0.0.33" }, + "engines": { + "node": "8.2.1" + }, "build": { "appId": "org.whispersystems.signal-desktop", "mac": { diff --git a/yarn.lock b/yarn.lock index 9aaa198d0..0cb1170b0 100644 --- a/yarn.lock +++ b/yarn.lock @@ -22,9 +22,9 @@ "7zip-bin-mac" "^1.0.1" "7zip-bin-win" "^2.1.1" -"@types/node@^7.0.18": - version "7.0.43" - resolved "https://registry.yarnpkg.com/@types/node/-/node-7.0.43.tgz#a187e08495a075f200ca946079c914e1a5fe962c" +"@types/node@^8.0.24": + version "8.9.4" + resolved "https://registry.yarnpkg.com/@types/node/-/node-8.9.4.tgz#dfd327582a06c114eb6e0441fa3d6fab35edad48" "JSV@>= 4.0.x": version "4.0.2" @@ -1535,11 +1535,11 @@ electron-updater@^2.19.0: semver "^5.4.1" source-map-support "^0.5.0" -electron@1.7.12: - version "1.7.12" - resolved "https://registry.yarnpkg.com/electron/-/electron-1.7.12.tgz#dcc61a2c1b0c3df25f68b3425379a01abd01190e" +electron@1.8.2: + version "1.8.2" + resolved "https://registry.yarnpkg.com/electron/-/electron-1.8.2.tgz#a817cd733c2972b3c7cc4f777caf6e424b88014d" dependencies: - "@types/node" "^7.0.18" + "@types/node" "^8.0.24" electron-download "^3.0.1" extract-zip "^1.0.3"