From 7fc0bb6fb2d9596df1e9352ca84922e4025ee5b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Baz=C3=A1n?= Date: Wed, 26 Oct 2016 12:56:33 -0300 Subject: [PATCH] new releases --- src/js/controllers/tab-home.js | 18 +++++++++++++++++- src/js/services/latestReleaseService.js | 2 +- src/sass/views/tab-home.scss | 15 +++++++++++++++ www/views/tab-home.html | 3 +++ 4 files changed, 36 insertions(+), 2 deletions(-) diff --git a/src/js/controllers/tab-home.js b/src/js/controllers/tab-home.js index 200de8b76..10e5d61c1 100644 --- a/src/js/controllers/tab-home.js +++ b/src/js/controllers/tab-home.js @@ -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); diff --git a/src/js/services/latestReleaseService.js b/src/js/services/latestReleaseService.js index bb9520223..87aace87f 100644 --- a/src/js/services/latestReleaseService.js +++ b/src/js/services/latestReleaseService.js @@ -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); }); diff --git a/src/sass/views/tab-home.scss b/src/sass/views/tab-home.scss index 3053f6eb6..2d5368a8d 100644 --- a/src/sass/views/tab-home.scss +++ b/src/sass/views/tab-home.scss @@ -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; + } + } } diff --git a/www/views/tab-home.html b/www/views/tab-home.html index c0e008a50..865afc0bc 100644 --- a/www/views/tab-home.html +++ b/www/views/tab-home.html @@ -10,6 +10,9 @@ spinner="ios-small" on-refresh="onRefresh()"> +
+ An update to this app is available +