Merge pull request #4902 from gabrielbazan7/feat/newRealeases

new releases
This commit is contained in:
Matias Alejo Garcia 2016-10-27 11:58:06 -03:00 committed by GitHub
commit 72f3a79457
4 changed files with 36 additions and 2 deletions

View file

@ -1,7 +1,7 @@
'use strict';
angular.module('copayApp.controllers').controller('tabHomeController',
function($rootScope, $timeout, $scope, $state, $stateParams, $ionicModal, $ionicScrollDelegate, gettextCatalog, lodash, popupService, ongoingProcess, profileService, walletService, configService, $log, platformInfo, storageService, txpModalService, $window, bitpayCardService, startupService, addressbookService) {
function($rootScope, $timeout, $scope, $state, $stateParams, $ionicModal, $ionicScrollDelegate, gettextCatalog, lodash, popupService, ongoingProcess, externalLinkService, latestReleaseService, profileService, walletService, configService, $log, platformInfo, storageService, txpModalService, $window, bitpayCardService, startupService, addressbookService) {
var wallet;
var listeners = [];
var notifications = [];
@ -12,6 +12,7 @@ angular.module('copayApp.controllers').controller('tabHomeController',
$scope.homeTip = $stateParams.fromOnboarding;
$scope.isCordova = platformInfo.isCordova;
$scope.isAndroid = platformInfo.isAndroid;
$scope.isNW = platformInfo.isNW;
$scope.$on("$ionicView.afterEnter", function() {
startupService.ready();
@ -23,6 +24,21 @@ angular.module('copayApp.controllers').controller('tabHomeController',
});
}
if ($scope.isNW) {
latestReleaseService.checkLatestRelease(function(err, newRelease) {
if (err) {
$log.warn(err);
return;
}
if (newRelease) $scope.newRelease = true;
});
}
$scope.openExternalLink = function(url, optIn, title, message, okText, cancelText) {
externalLinkService.open(url, optIn, title, message, okText, cancelText);
};
$scope.openNotificationModal = function(n) {
wallet = profileService.getWallet(n.walletId);

View file

@ -23,7 +23,7 @@ angular.module('copayApp.services')
if (latest.major < current.major || (latest.major == current.major && latest.minor <= current.minor))
return cb(null, false);
$log.debug('A new version of Copay is available: ' + latestVersion);
$log.debug('A new version is available: ' + latestVersion);
return cb(null, true);
});

View file

@ -103,4 +103,19 @@
}
}
}
.release {
cursor: pointer;
cursor: hand;
background-color: #E9E9EC;
padding-top: 30px;
padding-bottom: 20px;
text-align: center;
color: #444;
i {
margin-top: 1px;
font-size: 20px;
margin-left: 10px;
position: absolute;
}
}
}

View file

@ -10,6 +10,9 @@
spinner="ios-small"
on-refresh="onRefresh()">
</ion-refresher>
<div class="release" ng-show="newRelease" ng-click="openExternalLink('https://github.com/bitpay/copay/releases/latest', true, 'Update Available', 'An update to this app is available. For your security, please update to the latest version.', 'View Update', 'Go Back')">
<span translate>An update to this app is available</span><span><i class="icon bp-arrow-right"></i></span>
</div>
<div class="list card homeTip" ng-if="homeTip">
<div class="item item-icon-right item-heading">
<a ng-click="hideHomeTip()"><i class="icon ion-ios-close-empty close-home-tip"></i></a>