diff --git a/.DS_Store b/.DS_Store index 133d9b26e..a802e8ee8 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/Apps/.DS_Store b/Apps/.DS_Store index 242a4bffd..a8aec8ae3 100644 Binary files a/Apps/.DS_Store and b/Apps/.DS_Store differ diff --git a/Apps/FrontendSoftware/package.json b/Apps/FrontendSoftware/package.json index b798797f3..0141072df 100644 --- a/Apps/FrontendSoftware/package.json +++ b/Apps/FrontendSoftware/package.json @@ -1,7 +1,7 @@ { "name": "irisrover-ground-terminal-bold-behnken", "productName": "Iris Terminal", - "version": "0.6.3", + "version": "0.6.5", "description": "Terminal Software for the Iris Rover (L2021)", "author": { "name": "Iris Rover Project & CMU", @@ -30,6 +30,7 @@ "d3": "^5.16.0", "d3-sankey": "^0.12.3", "electron": "^3.1.13", + "electron-log": "^4.2.4", "electron-splashscreen": "^1.0.0", "electron-unhandled": "^3.0.2", "electron-updater": "^4.3.4", diff --git a/Apps/FrontendSoftware/src/background.js b/Apps/FrontendSoftware/src/background.js index 3342142e0..6f348f1a6 100644 --- a/Apps/FrontendSoftware/src/background.js +++ b/Apps/FrontendSoftware/src/background.js @@ -7,21 +7,27 @@ * * Author: Connor W. Colombo * Created: 1/2019 - * Last Updated: 08/17/2020 + * Last Updated: 10/01/2020 */ +/* global __static */ +import path from 'path' + +// Electron Dependencies: import { app, protocol, BrowserWindow } from 'electron' import { autoUpdater } from 'electron-updater' import { initSplashScreen, OfficeTemplate } from 'electron-splashscreen'; +import log from 'electron-log'; +// autoUpdater.logger = log; +// autoUpdater.transports.file.level = 'info'; + +// Vue Dependencies: import { createProtocol, installVueDevtools } from 'vue-cli-plugin-electron-builder/lib' const isDevelopment = process.env.NODE_ENV !== 'production' -/* global __static */ -import path from 'path' - // Handle all unhandled exceptions for diagnostics (and reporting): const unhandled = require('electron-unhandled'); unhandled(); @@ -157,3 +163,37 @@ if (isDevelopment) { }) } } + +// #### AUTO-UPDATE MESSAGES #### // + +function sendUpdateMessage(msg){ + if(win){ + win.webContents.send('message', msg); + } +} + +autoUpdater.on('checking-for-update', () => { + sendUpdateMessage('Checking for update...'); +}); + +autoUpdater.on('update-available', () => { + sendUpdateMessage('Update available!'); +}); + +autoUpdater.on('update-not-available', () => { + sendUpdateMessage('No updates available.'); +}); + +autoUpdater.on('download-progress', (progress) => { + sendUpdateMessage(`Download Speed: ${progress.bytesPerSecond}bps — ${progress.percent}% Complete — ${progress.transferred} / ${progress.total}`); +}); + +autoUpdater.on('update-downloaded', () => { + sendUpdateMessage(`Update download complete. Installing now. App will close in 10s.`); + setTimeout( () => {autoUpdater.quitAndInstall();}, 10000 ); + +}); + +autoUpdater.on('error', (err) => { + sendUpdateMessage(`Error during auto-update. Info: ${err.toString()}`); +});