Skip to content

Commit

Permalink
AutoUpdate
Browse files Browse the repository at this point in the history
  • Loading branch information
akameco committed Jul 2, 2017
1 parent 4638056 commit 9772cb4
Show file tree
Hide file tree
Showing 3 changed files with 185 additions and 51 deletions.
18 changes: 13 additions & 5 deletions app/main.development.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
/* eslint global-require: 0, flowtype-errors/show-errors: 0, camelcase: 1 */
import electron from 'electron'
import referer from 'electron-referer'
import { autoUpdater } from 'electron-updater'
import log from 'electron-log'
import appMenu from './menu'

autoUpdater.logger = log
autoUpdater.logger.transports.file.level = 'info'

const Config = require('electron-config')

const { app, BrowserWindow, ipcMain, shell } = electron
Expand Down Expand Up @@ -111,17 +116,20 @@ app.on('ready', async () => {
mainWindow.show()
mainWindow.focus()

const page = mainWindow.webContents

electron.Menu.setApplicationMenu(appMenu)

autoUpdater.checkForUpdates()

ipcMain.on('tweet', (ev, url) => {
openTweet(url)
})
})

app.on('before-quit', () => {
page.send('save')
})
autoUpdater.on('update-downloaded', () => {
setTimeout(() => {
autoUpdater.quitAndInstall()
app.quit()
}, 2000)
})

function openTweet(url: string) {
Expand Down
212 changes: 168 additions & 44 deletions app/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@
"postinstall": "npm rebuild --runtime=electron --target=1.6.1 --disturl=https://atom.io/download/atom-shell --build-from-source"
},
"dependencies": {
"electron-config": "^0.2.1",
"electron-config": "^1.0.0",
"electron-context-menu": "^0.9.0",
"electron-dl": "^1.9.0",
"electron-referer": "^0.3.0"
"electron-log": "^2.2.6",
"electron-referer": "^0.3.0",
"electron-updater": "^2.4.3"
}
}

0 comments on commit 9772cb4

Please sign in to comment.