mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-13 09:46:22 +00:00
auto update確認
This commit is contained in:
@@ -5,33 +5,38 @@ var path = require('path')
|
|||||||
|
|
||||||
var version = app.getVersion()
|
var version = app.getVersion()
|
||||||
var versionText = (version == null || version.length === 0) ? 'DEV version' : 'v' + version
|
var versionText = (version == null || version.length === 0) ? 'DEV version' : 'v' + version
|
||||||
|
var versionNotified = false
|
||||||
autoUpdater
|
autoUpdater
|
||||||
.on('error', function (err, message) {
|
.on('error', function (err, message) {
|
||||||
console.error(err)
|
console.error(err)
|
||||||
console.error(message)
|
console.error(message)
|
||||||
|
console.log(path.resolve(__dirname, '../resources/favicon-230x230.png'))
|
||||||
nn.notify({
|
nn.notify({
|
||||||
title: 'Error! ' + versionText,
|
title: 'Error! ' + versionText,
|
||||||
icon: path.join(__dirname, 'browser/main/resources/favicon-230x230.png'),
|
icon: path.resolve(__dirname, '../resources/favicon-230x230.png'),
|
||||||
message: message
|
message: message
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
// .on('checking-for-update', function () {
|
// .on('checking-for-update', function () {
|
||||||
// // Connecting
|
// // Connecting
|
||||||
|
// console.log('checking...')
|
||||||
// })
|
// })
|
||||||
.on('update-available', function () {
|
.on('update-available', function () {
|
||||||
nn.notify({
|
nn.notify({
|
||||||
title: 'Update is available!! ' + versionText,
|
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.'
|
message: 'Download started.. wait for the update ready.'
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
.on('update-not-available', function () {
|
.on('update-not-available', function () {
|
||||||
nn.notify({
|
if (!versionNotified) {
|
||||||
title: 'Latest Build!! ' + versionText,
|
nn.notify({
|
||||||
icon: path.join(__dirname, 'browser/main/resources/favicon-230x230.png'),
|
title: 'Latest Build!! ' + versionText,
|
||||||
message: 'Hope you to enjoy our app :D'
|
icon: path.resolve(__dirname, '../resources/favicon-230x230.png'),
|
||||||
})
|
message: 'Hope you to enjoy our app :D'
|
||||||
|
})
|
||||||
|
versionNotified = true
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
module.exports = autoUpdater
|
module.exports = autoUpdater
|
||||||
|
|||||||
@@ -11,8 +11,12 @@ require('../styles/main/index.styl')
|
|||||||
import { openModal } from 'boost/modal'
|
import { openModal } from 'boost/modal'
|
||||||
import Tutorial from 'boost/components/modal/Tutorial'
|
import Tutorial from 'boost/components/modal/Tutorial'
|
||||||
import activityRecord from 'boost/activityRecord'
|
import activityRecord from 'boost/activityRecord'
|
||||||
|
import ipc from 'ipc'
|
||||||
|
|
||||||
activityRecord.init()
|
activityRecord.init()
|
||||||
|
window.addEventListener('online', function () {
|
||||||
|
ipc.send('check-update', 'check-update')
|
||||||
|
})
|
||||||
|
|
||||||
let routes = (
|
let routes = (
|
||||||
<Route path='/' component={MainPage}>
|
<Route path='/' component={MainPage}>
|
||||||
|
|||||||
12
main.js
12
main.js
@@ -30,8 +30,8 @@ updater
|
|||||||
.on('update-downloaded', function (event, releaseNotes, releaseName, releaseDate, updateUrl, quitAndUpdate) {
|
.on('update-downloaded', function (event, releaseNotes, releaseName, releaseDate, updateUrl, quitAndUpdate) {
|
||||||
nn.notify({
|
nn.notify({
|
||||||
title: 'Ready to Update!! ' + versionText,
|
title: 'Ready to Update!! ' + versionText,
|
||||||
icon: path.join(__dirname, 'browser/main/resources/favicon-230x230.png'),
|
icon: path.join(__dirname, '/resources/favicon-230x230.png'),
|
||||||
message: 'Click tray icon to update app: ' + releaseName
|
message: 'Click update button on Main window: ' + releaseName
|
||||||
})
|
})
|
||||||
update = quitAndUpdate
|
update = quitAndUpdate
|
||||||
|
|
||||||
@@ -50,6 +50,14 @@ app.on('ready', function () {
|
|||||||
// menu start
|
// menu start
|
||||||
var template = require('./atom-lib/menu-template')
|
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) {
|
ipc.on('update-app', function (event, msg) {
|
||||||
if (update != null) {
|
if (update != null) {
|
||||||
appQuit = true
|
appQuit = true
|
||||||
|
|||||||
Reference in New Issue
Block a user