1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-13 17:56:25 +00:00

auto update確認

This commit is contained in:
Rokt33r
2015-11-15 03:52:34 +09:00
parent 46c6555f94
commit da9d7a4336
3 changed files with 27 additions and 10 deletions

View File

@@ -5,33 +5,38 @@ var path = require('path')
var version = app.getVersion()
var versionText = (version == null || version.length === 0) ? 'DEV version' : 'v' + version
var versionNotified = false
autoUpdater
.on('error', function (err, message) {
console.error(err)
console.error(message)
console.log(path.resolve(__dirname, '../resources/favicon-230x230.png'))
nn.notify({
title: 'Error! ' + versionText,
icon: path.join(__dirname, 'browser/main/resources/favicon-230x230.png'),
icon: path.resolve(__dirname, '../resources/favicon-230x230.png'),
message: message
})
})
// .on('checking-for-update', function () {
// // Connecting
// console.log('checking...')
// })
.on('update-available', function () {
nn.notify({
title: 'Update is available!! ' + versionText,
icon: path.join(__dirname, 'browser/main/resources/favicon-230x230.png'),
icon: path.resolve(__dirname, '../resources/favicon-230x230.png'),
message: 'Download started.. wait for the update ready.'
})
})
.on('update-not-available', function () {
if (!versionNotified) {
nn.notify({
title: 'Latest Build!! ' + versionText,
icon: path.join(__dirname, 'browser/main/resources/favicon-230x230.png'),
icon: path.resolve(__dirname, '../resources/favicon-230x230.png'),
message: 'Hope you to enjoy our app :D'
})
versionNotified = true
}
})
module.exports = autoUpdater

View File

@@ -11,8 +11,12 @@ require('../styles/main/index.styl')
import { openModal } from 'boost/modal'
import Tutorial from 'boost/components/modal/Tutorial'
import activityRecord from 'boost/activityRecord'
import ipc from 'ipc'
activityRecord.init()
window.addEventListener('online', function () {
ipc.send('check-update', 'check-update')
})
let routes = (
<Route path='/' component={MainPage}>

12
main.js
View File

@@ -30,8 +30,8 @@ updater
.on('update-downloaded', function (event, releaseNotes, releaseName, releaseDate, updateUrl, quitAndUpdate) {
nn.notify({
title: 'Ready to Update!! ' + versionText,
icon: path.join(__dirname, 'browser/main/resources/favicon-230x230.png'),
message: 'Click tray icon to update app: ' + releaseName
icon: path.join(__dirname, '/resources/favicon-230x230.png'),
message: 'Click update button on Main window: ' + releaseName
})
update = quitAndUpdate
@@ -50,6 +50,14 @@ app.on('ready', function () {
// menu start
var template = require('./atom-lib/menu-template')
setInterval(function () {
updater.checkForUpdates()
}, 1000 * 60 * 60 * 24)
ipc.on('check-update', function (event, msg) {
updater.checkForUpdates()
})
ipc.on('update-app', function (event, msg) {
if (update != null) {
appQuit = true