diff --git a/js/controllers/version.js b/js/controllers/version.js index e6c9216ab..f61e7af4b 100644 --- a/js/controllers/version.js +++ b/js/controllers/version.js @@ -1,28 +1,33 @@ 'use strict'; -angular.module('copayApp.controllers').controller('VersionController', - function($scope, $rootScope, $http, notification) { +angular.module('copayApp.controllers').controller('VersionController', + function($scope, $rootScope, $http, notification) { $scope.version = copay.version; $scope.commitHash = copay.commitHash; $scope.networkName = config.networkName; $scope.defaultLanguage = config.defaultLanguage; + if (_.isUndefined($rootScope.checkVersion)) + $rootScope.checkVersion = true; - $http.get('https://api.github.com/repos/bitpay/copay/tags').success(function(data) { - var toInt = function(s) { - return parseInt(s); - }; - var latestVersion = data[0].name.replace('v', '').split('.').map(toInt); - var currentVersion = copay.version.split('.').map(toInt); - var title = 'Copay ' + data[0].name + ' available.'; - var content; - if (currentVersion[0] < latestVersion[0]) { - content = 'It\'s important that you update your wallet at https://copay.io'; - notification.version(title, content, true); - } else if (currentVersion[0] == latestVersion[0] && currentVersion[1] < latestVersion[1]) { - var content = 'Please update your wallet at https://copay.io'; - notification.version(title, content, false); - } - }); + if ($rootScope.checkVersion) { + $rootScope.checkVersion = false; + $http.get('https://api.github.com/repos/bitpay/copay/tags').success(function(data) { + var toInt = function(s) { + return parseInt(s); + }; + var latestVersion = data[0].name.replace('v', '').split('.').map(toInt); + var currentVersion = copay.version.split('.').map(toInt); + var title = 'Copay ' + data[0].name + ' available.'; + var content; + if (currentVersion[0] < latestVersion[0]) { + content = 'It\'s important that you update your wallet at https://copay.io'; + notification.version(title, content, true); + } else if (currentVersion[0] == latestVersion[0] && currentVersion[1] < latestVersion[1]) { + var content = 'Please update your wallet at https://copay.io'; + notification.version(title, content, false); + } + }); + } - }); + }); \ No newline at end of file