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

notification デバッグ

This commit is contained in:
Rokt33r
2015-11-24 06:17:49 +09:00
parent e4f39d2b6a
commit d4d1c32288
2 changed files with 18 additions and 12 deletions

View File

@@ -24,9 +24,9 @@ function notify (...args) {
return new window.Notification(...args) return new window.Notification(...args)
} }
ipc.on('notify', function (title, message) { ipc.on('notify', function (e, payload) {
notify(title, { notify(payload.title, {
body: message body: payload.body
}) })
}) })

24
main.js
View File

@@ -22,34 +22,40 @@ var appQuit = false
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 var versionNotified = false
function notify (title, body) {
if (mainWindow != null) {
mainWindow.webContents.send('notify', {
title: title,
body: body
})
}
}
autoUpdater autoUpdater
.on('update-downloaded', function (event, releaseNotes, releaseName, releaseDate, updateUrl, quitAndUpdate) { .on('update-downloaded', function (event, releaseNotes, releaseName, releaseDate, updateUrl, quitAndUpdate) {
update = quitAndUpdate update = quitAndUpdate
if (mainWindow != null) { if (mainWindow != null) {
mainWindow.webContents.send('notify', 'Ready to Update! ' + releaseName, 'Click update button on Main window.') notify('Ready to Update! ' + releaseName, 'Click update button on Main window.')
mainWindow.webContents.send('update-available', 'Update available!') mainWindow.webContents.send('update-available', 'Update available!')
} }
}) })
.on('error', function (err, message) { .on('error', function (err, message) {
console.error(err) console.error(err)
if (mainWindow != null && !versionNotified) { notify('Updater error!', message)
mainWindow.webContents.send('notify', 'Updater error!', message)
}
}) })
// .on('checking-for-update', function () { // .on('checking-for-update', function () {
// // Connecting // // Connecting
// console.log('checking...') // console.log('checking...')
// }) // })
.on('update-available', function () { .on('update-available', function () {
if (mainWindow != null) { notify('Update is available!', 'Download started.. wait for the update ready.')
mainWindow.webContents.send('notify', 'Update is available!', 'Download started.. wait for the update ready.')
}
}) })
.on('update-not-available', function () { .on('update-not-available', function () {
if (mainWindow != null && !versionNotified) { if (mainWindow != null && !versionNotified) {
versionNotified = true versionNotified = true
mainWindow.webContents.send('notify', 'Latest Build!! ' + versionText, 'Hope you to enjoy our app :D') notify('Latest Build!! ' + versionText, 'Hope you to enjoy our app :D')
} }
}) })
@@ -59,7 +65,7 @@ app.on('ready', function () {
appQuit = true appQuit = true
}) })
autoUpdater.setFeedURL('http://orbital.b00st.io/rokt33r/boost-dev/latest?version=' + version) autoUpdater.setFeedURL('https://orbital.b00st.io/rokt33r/boost-dev/latest?version=' + version)
var template = require('./atom-lib/menu-template') var template = require('./atom-lib/menu-template')
var menu = Menu.buildFromTemplate(template) var menu = Menu.buildFromTemplate(template)