diff --git a/lib/gui/app.js b/lib/gui/app.js index a446502c..f8fd155e 100644 --- a/lib/gui/app.js +++ b/lib/gui/app.js @@ -66,8 +66,27 @@ const app = angular.module('Etcher', [ require('./utils/byte-size/byte-size') ]); -app.run(function(AnalyticsService) { +app.run(function(AnalyticsService, UpdateNotifierService, SelectionStateModel) { AnalyticsService.logEvent('Application start'); + + if (UpdateNotifierService.shouldCheckForUpdates()) { + AnalyticsService.logEvent('Checking for updates'); + + UpdateNotifierService.isLatestVersion().then(function(isLatestVersion) { + + // In case the internet connection is not good and checking the + // latest published version takes too long, only show notify + // the user about the new version if he didn't start the flash + // process (e.g: selected an image), otherwise such interruption + // might be annoying. + if (!isLatestVersion && !SelectionStateModel.hasImage()) { + + AnalyticsService.logEvent('Notifying update'); + UpdateNotifierService.notify(); + } + }); + } + }); app.config(function($stateProvider, $urlRouterProvider) { @@ -116,24 +135,6 @@ app.controller('AppController', function( throw error; }; - if (UpdateNotifierService.shouldCheckForUpdates()) { - AnalyticsService.logEvent('Checking for updates'); - - UpdateNotifierService.isLatestVersion().then(function(isLatestVersion) { - - // In case the internet connection is not good and checking the - // latest published version takes too long, only show notify - // the user about the new version if he didn't start the flash - // process (e.g: selected an image), otherwise such interruption - // might be annoying. - if (!isLatestVersion && !SelectionStateModel.hasImage()) { - - AnalyticsService.logEvent('Notifying update'); - UpdateNotifierService.notify(); - } - }); - } - // This catches the case where the user enters // the settings screen when a flash finished // and goes back to the main screen with the back button.