From c0c466706f18a32e20c49fc34a290c717c3cf64d Mon Sep 17 00:00:00 2001 From: Zhongyi Tong Date: Wed, 24 Aug 2016 19:33:00 +0800 Subject: [PATCH] Bump version number to v1.4.0. - Use electron v1.3.4 to pack the app. - Fix issue #217. Will not check update after window reloaded. --- package.json | 2 +- scripts/build.sh | 2 +- src/handlers/update.js | 2 ++ src/windows/controllers/wechat.js | 8 +++++--- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 7e4c3447..c332e963 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "electronic-wechat", - "version": "1.3.0", + "version": "1.4.0", "description": "An Electron application for WeChat", "main": "src/main.js", "scripts": { diff --git a/scripts/build.sh b/scripts/build.sh index f37ac168..f57b48f3 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -27,7 +27,7 @@ fi ignore_list="dist|scripts|\.idea|.*\.md|.*\.yml|node_modules/nodejieba" -electron-packager . "${APP_NAME}" --platform=$PLATFORM --arch=$ARCH --version=1.1.0 --app-version=1.3.0 --asar --icon=assets/icon.icns --overwrite --out=./dist --ignore=${ignore_list} +electron-packager . "${APP_NAME}" --platform=$PLATFORM --arch=$ARCH --version=1.3.4 --app-version=1.4.0 --asar --icon=assets/icon.icns --overwrite --out=./dist --ignore=${ignore_list} if [ $? -eq 0 ]; then echo -e "$(tput setaf 2)Packaging for $PLATFORM $ARCH succeeded.$(tput sgr0)\n" diff --git a/src/handlers/update.js b/src/handlers/update.js index cb70712b..94faee3a 100644 --- a/src/handlers/update.js +++ b/src/handlers/update.js @@ -8,6 +8,7 @@ const Common = require('../common'); class UpdateHandler { checkForUpdate(version, silent) { + UpdateHandler.CHECKED = true; let promise = new Promise((res, rej) => { if (Common.ELECTRON == app.getName()) { rej(Common.UPDATE_ERROR_ELECTRON); @@ -79,5 +80,6 @@ class UpdateHandler { }; } +UpdateHandler.CHECKED = false; module.exports = UpdateHandler; \ No newline at end of file diff --git a/src/windows/controllers/wechat.js b/src/windows/controllers/wechat.js index 40c0acdf..000008b7 100644 --- a/src/windows/controllers/wechat.js +++ b/src/windows/controllers/wechat.js @@ -82,18 +82,20 @@ class WeChatWindow { this.wechatWindow.webContents.insertCSS(CSSInjector.osxCSS); } - new UpdateHandler().checkForUpdate(`v${app.getVersion()}`, true); + if (!UpdateHandler.CHECKED) { + new UpdateHandler().checkForUpdate(`v${app.getVersion()}`, true); + } }); this.wechatWindow.webContents.on('new-window', (event, url) => { event.preventDefault(); shell.openExternal(new MessageHandler().handleRedirectMessage(url)); }); - + this.wechatWindow.webContents.on('will-navigate', (event, url) => { if (url.endsWith('/fake')) event.preventDefault(); }); - + } loadURL(url) {