Commit 0ba1db98 authored by antoor's avatar antoor

Change the update mode

更改程序更新方式
parent 8f3a41aa
...@@ -62,7 +62,7 @@ app ...@@ -62,7 +62,7 @@ app
electron.Logger = require('./modules/logger')(mainWindow); electron.Logger = require('./modules/logger')(mainWindow);
// 初始化模块 // 初始化模块
['menubar', 'request', 'database', 'cache', 'plugStore'].map((_) => { ['menubar', 'request', 'database', 'cache', 'update', 'plugStore'].map((_) => {
new ( require(`./modules/${_}`) )(electron, app, mainWindow); new ( require(`./modules/${_}`) )(electron, app, mainWindow);
}); });
}); });
...@@ -4,8 +4,6 @@ ...@@ -4,8 +4,6 @@
'use strict'; 'use strict';
const Update = require('./update');
class Menubar { class Menubar {
constructor(electron, app, mainWindow) { constructor(electron, app, mainWindow) {
...@@ -52,13 +50,6 @@ class Menubar { ...@@ -52,13 +50,6 @@ class Menubar {
click: event.sender.send.bind(event.sender, 'menubar', 'settings-aproxy') click: event.sender.send.bind(event.sender, 'menubar', 'settings-aproxy')
}, { }, {
type: 'separator' type: 'separator'
}, {
label: LANG['main']['update'],
enabled: false,
accelerator: 'Shift+CmdOrCtrl+U',
click: () => {
new Update();
}
}, { }, {
label: LANG['main']['settings'], label: LANG['main']['settings'],
accelerator: 'Shift+CmdOrCtrl+S', accelerator: 'Shift+CmdOrCtrl+S',
......
/** /**
* 中国蚁剑::更新程序 * 中国蚁剑::更新程序
* 开写: 2016/05/31 * 开写: 2016/05/31
* 更新: 2016/06/19
* 说明: 从2.0.0起,取消在线更新程序的方式,改为程序启动一分钟后,检测github->release最新的版本更新信息,然后提示手动更新
*/ */
const config = require('./config'); const config = require('./config');
const electron = require('electron');
const BrowserWindow = electron.BrowserWindow;
class Update { class Update {
constructor() { constructor(electron) {
this.listenHandler(); this.logger = new electron.Logger('Update');
this.openWindow(); setTimeout(this.checkUpdate.bind(this), 1000 * 60);
} }
/** /**
* 事件监听器 * 检查更新
* 如果有更新,则以通知的方式提示用户手动更新,用户点击跳转到更新页面
* @return {[type]} [description] * @return {[type]} [description]
*/ */
listenHandler() { checkUpdate() {
electron.ipcMain this.logger.debug('checkUpdate..');
.on('update-getVersion', (event) => {
event.returnValue = config.package['version']
})
}
/**
* 打开更新窗口
* @return {[type]} [description]
*/
openWindow() {
let win = new BrowserWindow({
width: 400,
height: 250,
// height: 180,
// resizable: false,
minimizable: false,
maximizable: false
});
win.loadURL('ant-views://update.html');
win.webContents.openDevTools();
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment