Skip to content

Commit

Permalink
added user check for update and video recording stop alert
Browse files Browse the repository at this point in the history
  • Loading branch information
hanayik committed Jul 12, 2017
1 parent 243ecc1 commit 653f869
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 1 deletion.
21 changes: 21 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ const os = require("os");
var platform = os.platform() + '_' + os.arch();
var version = app.getVersion();
var updateResponse
var ipcMain = require('electron').ipcMain;
var shouldShowMessageNow = false
app.setName("PNT")
//icon credit: http://www.flaticon.com/authors/madebyoliver
// Keep a global reference of the window object, if you don't, the window will
Expand Down Expand Up @@ -109,6 +111,12 @@ app.on('activate', function () {
}
})

ipcMain.on('user-requests-update', function() {
shouldShowMessageNow = true
console.log('user requested an update check')
autoUpdater.checkForUpdates()
})

autoUpdater.on('error', function(err) {
console.log(err)
})
Expand All @@ -134,6 +142,19 @@ autoUpdater.on('update-available', function(){
})
autoUpdater.on('update-not-available', function(){
console.log('update not available')
if (shouldShowMessageNow) {
var dialogOptions = {
type: "info",
buttons: ["Ok"],
defaultId: 0,
title: "No update available",
message: "There are no updates available. You have the most recent version!",
cancelId: 0
}
dialog.showMessageBox(mainWindow, dialogOptions , function (response) {

})
}
})
autoUpdater.on('update-downloaded', function(){
if (updateResponse == 1) {
Expand Down
7 changes: 6 additions & 1 deletion core.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const ffmpeg = appRootDir+'/ffmpeg/ffmpeg'
const exec = require( 'child_process' ).exec
const si = require('systeminformation');
const mkdirp = require('mkdirp');
var ipcRenderer = require('electron').ipcRenderer;
var moment = require('moment')
var content = document.getElementById("contentDiv")
var picNum = document.getElementById("picNumID")
Expand Down Expand Up @@ -42,7 +43,10 @@ var userDataPath = path.join(app.getPath('userData'),'Data')
makeSureUserDataFolderIsThere()
var savePath


function checkForUpdateFromRender() {
ipcRenderer.send('user-requests-update')
//alert('checked for update')
}



Expand Down Expand Up @@ -216,6 +220,7 @@ function ff() {
exec(cmd,{maxBuffer: 2000 * 1024}, (error, stdout, stderr) => {
if (error) {
console.error(`exec error: ${error}`)
alert('Recording stopped!')
return
}
// console.log(`stdout: ${stdout}`);
Expand Down
5 changes: 5 additions & 0 deletions menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,11 @@ if (process.platform === 'darwin') {
{
role: 'about'
},
{
label: 'Check for update',
type: 'normal',
click() {checkForUpdateFromRender()}
},
{
type: 'separator'
},
Expand Down

0 comments on commit 653f869

Please sign in to comment.