Skip to content

Commit

Permalink
feat(portative): display message about update in portative version #41
Browse files Browse the repository at this point in the history
  • Loading branch information
DEgITx committed Jul 19, 2018
1 parent 37ff661 commit a89c390
Showing 1 changed file with 29 additions and 3 deletions.
32 changes: 29 additions & 3 deletions src/background/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import path from "path";
import url from "url";
import os from 'os';
import { app, Menu, ipcMain, Tray, dialog } from "electron";
import { app, Menu, ipcMain, Tray, dialog, shell } from "electron";
import createWindow from "./helpers/window";
import { autoUpdater } from 'electron-updater'

Expand Down Expand Up @@ -220,14 +220,40 @@ app.on("ready", () => {
}
})

if (env.name === "production" && !portative) {
if (env.name === "production") {
checkInternet(enabled => {
if(!enabled)
{
console.log('no internet connection were founded, updater not started')
return
}
autoUpdater.checkForUpdates()

if(portative)
{
autoUpdater.getUpdateInfo().then(info => {
if(info.version == app.getVersion())
{
console.log('update not founded for version', app.getVersion())
return
}

dialog.showMessageBox({
type: 'info',
title: 'Found Updates',
message: 'Found updates to version ' + info.version + '. Open page to download manually?',
buttons: ['Open', 'Dont update']
}, (buttonIndex) => {
if (buttonIndex === 0) {
shell.openExternal('https://github.com/DEgITx/rats-search/releases')
}
})
})
}
else
{
// full version, just download update
autoUpdater.checkForUpdates()
}
})
}

Expand Down

0 comments on commit a89c390

Please sign in to comment.