From b0a93e2e2d7fb213f90d73534f7cb71b36f282a8 Mon Sep 17 00:00:00 2001 From: Susmitha Girumala Date: Mon, 12 Apr 2021 16:26:46 -0400 Subject: [PATCH] feat: Check for desktop update on launch --- ui/desktop/electron-app/src/app-updater.js | 5 ++--- ui/desktop/electron-app/src/index.js | 4 ++++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/ui/desktop/electron-app/src/app-updater.js b/ui/desktop/electron-app/src/app-updater.js index 8fcc785e7..b758a6eac 100644 --- a/ui/desktop/electron-app/src/app-updater.js +++ b/ui/desktop/electron-app/src/app-updater.js @@ -88,10 +88,9 @@ const downloadAndInstallUpdate = async (version) => { * Configure inbuilt app updater to use a custom config file * to download and install next available app version. * TODO: download progress in dialog - * TODO: Read current version from app config **/ module.exports = { - run: async () => { + run: async ({ suppressNoUpdatePrompt }) => { let latestVersion; if (debug) { latestVersion = process.env.APP_UPDATER_LATEST_VERSION_TAG; @@ -105,7 +104,7 @@ module.exports = { } // Update not available - do nothing - if (semver.lte(latestVersion, currentVersion)) { + if (!suppressNoUpdatePrompt && semver.lte(latestVersion, currentVersion)) { const dialogOpts = { type: 'info', icon: null, diff --git a/ui/desktop/electron-app/src/index.js b/ui/desktop/electron-app/src/index.js index d2c8fe5cc..0fbcb3524 100644 --- a/ui/desktop/electron-app/src/index.js +++ b/ui/desktop/electron-app/src/index.js @@ -19,6 +19,7 @@ const origin = require('./origin.js'); const { generateCSPHeader } = require('./content-security-policy.js'); const menu = require('./menu.js'); +const appUpdater = require('./app-updater.js'); const isDev = require('electron-is-dev'); // Register the custom file protocol @@ -138,6 +139,9 @@ app.on('ready', async () => { // Load the ember application mainWindow.loadURL(emberAppURL); + // Check for updates on launch + appUpdater.run({ suppressNoUpdatePrompt: true }); + // If a loading operation goes wrong, we'll send Electron back to // Ember App entry point mainWindow.webContents.on('did-fail-load', () => {