mirror of https://github.com/BTCPrivate/copay.git
Merge pull request #1045 from cmgustavo/feature/01-version
Feature/01 version
This commit is contained in:
commit
cc164af28b
|
@ -49,6 +49,7 @@ browser-extensions/firefox/firefox-addon
|
|||
browser-extensions/firefox/data
|
||||
browser-extensions/firefox/copay.xpi
|
||||
version.js
|
||||
!js/controllers/version.js
|
||||
|
||||
android/package
|
||||
android/*.apk
|
||||
|
|
|
@ -107,6 +107,7 @@
|
|||
<script src="js/controllers/import.js"></script>
|
||||
<script src="js/controllers/settings.js"></script>
|
||||
<script src="js/controllers/uriPayment.js"></script>
|
||||
<script src="js/controllers/version.js"></script>
|
||||
|
||||
<!-- PLACEHOLDER: CORDOVA SRIPT -->
|
||||
<script src="js/mobile.js"></script>
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
angular.module('copayApp.controllers').controller('SidebarController',
|
||||
function($scope, $rootScope, $sce, $location, $http, notification, controllerUtils) {
|
||||
|
||||
$scope.version = copay.version;
|
||||
$scope.networkName = config.networkName;
|
||||
$scope.menu = [{
|
||||
'title': 'Addresses',
|
||||
'icon': 'fi-address-book',
|
||||
|
@ -62,23 +60,6 @@ angular.module('copayApp.controllers').controller('SidebarController',
|
|||
return new Array(num);
|
||||
}
|
||||
|
||||
$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);
|
||||
}
|
||||
});
|
||||
|
||||
// Init socket handlers (with no wallet yet)
|
||||
controllerUtils.setSocketHandlers();
|
||||
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('VersionController',
|
||||
function($scope, $rootScope, $http, notification) {
|
||||
|
||||
$scope.version = copay.version;
|
||||
$scope.networkName = config.networkName;
|
||||
|
||||
$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);
|
||||
}
|
||||
});
|
||||
|
||||
});
|
|
@ -214,7 +214,7 @@ describe("Unit: Controllers", function() {
|
|||
|
||||
});
|
||||
|
||||
describe("Unit: Sidebar Controller", function() {
|
||||
describe("Unit: Version Controller", function() {
|
||||
var scope, $httpBackendOut;
|
||||
var GH = 'https://api.github.com/repos/bitpay/copay/tags';
|
||||
beforeEach(inject(function($controller, $injector) {
|
||||
|
@ -235,7 +235,7 @@ describe("Unit: Controllers", function() {
|
|||
beforeEach(inject(function($controller, $rootScope) {
|
||||
rootScope = $rootScope;
|
||||
scope = $rootScope.$new();
|
||||
headerCtrl = $controller('SidebarController', {
|
||||
headerCtrl = $controller('VersionController', {
|
||||
$scope: scope,
|
||||
});
|
||||
}));
|
||||
|
@ -273,8 +273,24 @@ describe("Unit: Controllers", function() {
|
|||
scope.$apply();
|
||||
});
|
||||
|
||||
it('should return an array of n undefined elements', function() {
|
||||
it('should return networkName', function() {
|
||||
$httpBackend.flush(); // need flush
|
||||
var networkName = scope.networkName;
|
||||
expect(networkName).equal('livenet');
|
||||
});
|
||||
});
|
||||
|
||||
describe("Unit: Sidebar Controller", function() {
|
||||
var rootScope;
|
||||
beforeEach(inject(function($controller, $rootScope) {
|
||||
rootScope = $rootScope;
|
||||
scope = $rootScope.$new();
|
||||
headerCtrl = $controller('SidebarController', {
|
||||
$scope: scope,
|
||||
});
|
||||
}));
|
||||
|
||||
it('should return an array of n undefined elements', function() {
|
||||
var n = 5;
|
||||
var array = scope.getNumber(n);
|
||||
expect(array.length).equal(n);
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
<div class="row" ng-if='$root.wallet && !$root.wallet.isReady() && !loading'>
|
||||
<div class="large-4 columns logo-setup">
|
||||
<img src="img/logo-negative-beta.svg" alt="Copay">
|
||||
<div ng-include="'views/includes/version.html'"></div>
|
||||
</div>
|
||||
<div class="large-8 columns line-dashed-setup-v">
|
||||
<div class="box-setup oh">
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
<div class="row">
|
||||
<div class="large-4 columns logo-setup">
|
||||
<img src="img/logo-negative-beta.svg" alt="Copay">
|
||||
<div ng-include="'views/includes/version.html'"></div>
|
||||
</div>
|
||||
<div class="large-8 columns line-dashed-setup-v">
|
||||
<div class="button-setup" ng-show="hasWallets">
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
<div class="row" ng-init="choosefile=0; pastetext=0" ng-show="!loading">
|
||||
<div class="large-4 columns logo-setup">
|
||||
<img src="img/logo-negative-beta.svg" alt="Copay">
|
||||
<div ng-include="'views/includes/version.html'"></div>
|
||||
</div>
|
||||
<div class="large-8 columns line-dashed-setup-v">
|
||||
<div class="box-setup">
|
||||
|
|
|
@ -4,9 +4,7 @@
|
|||
<a href="#!/addresses" class="db">
|
||||
<img src="img/logo-negative-beta.svg" alt="" width="80">
|
||||
</a>
|
||||
<small>v{{version}}</small>
|
||||
<small ng-if="$root.wallet.getNetworkName()=='livenet'">LIVENET</small>
|
||||
<small ng-if="$root.wallet.getNetworkName()=='testnet'">TESTNET</small>
|
||||
<div ng-include="'views/includes/version.html'"></div>
|
||||
</div>
|
||||
<div class="line-sidebar-b"></div>
|
||||
<div class="founds size-12 text-center box-founds p10t">
|
||||
|
|
|
@ -4,11 +4,7 @@
|
|||
<a href="#!/addresses" class="db">
|
||||
<img src="img/logo-negative-beta.svg" alt="" width="100">
|
||||
</a>
|
||||
<div>
|
||||
<small>v{{version}}</small>
|
||||
<small ng-if="$root.wallet.getNetworkName()=='livenet'">LIVENET</small>
|
||||
<small ng-if="$root.wallet.getNetworkName()=='testnet'">TESTNET</small>
|
||||
</div>
|
||||
<div ng-include="'views/includes/version.html'"></div>
|
||||
</div>
|
||||
<div class="line-sidebar"></div>
|
||||
<div>
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
<div ng-controller="VersionController">
|
||||
<small>v{{version}}</small>
|
||||
<small ng-if="networkName=='testnet'">[ {{networkName}} ]</small>
|
||||
</div>
|
||||
|
|
@ -6,6 +6,7 @@
|
|||
<div class="row" ng-show="!loading">
|
||||
<div class="large-4 columns logo-setup">
|
||||
<img src="img/logo-negative-beta.svg" alt="Copay">
|
||||
<div ng-include="'views/includes/version.html'"></div>
|
||||
</div>
|
||||
<div class="large-8 columns line-dashed-setup-v">
|
||||
<div class="box-setup">
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
<div class="row" ng-show="!loading">
|
||||
<div class="large-4 columns logo-setup">
|
||||
<img src="img/logo-negative-beta.svg" alt="Copay">
|
||||
<div ng-include="'views/includes/version.html'"></div>
|
||||
</div>
|
||||
<div class="large-8 columns line-dashed-setup-v">
|
||||
<div class="box-setup">
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
<div class="row">
|
||||
<div class="large-4 columns logo-setup">
|
||||
<img src="img/logo-negative-beta.svg" alt="Copay">
|
||||
<div ng-include="'views/includes/version.html'"></div>
|
||||
</div>
|
||||
<div class="large-8 columns line-dashed-setup-v">
|
||||
<div class="box-setup">
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
<div class="row">
|
||||
<div class="large-4 columns logo-setup text-center">
|
||||
<img src="img/logo-negative-beta.svg" alt="Copay">
|
||||
<div ng-include="'views/includes/version.html'"></div>
|
||||
</div>
|
||||
<div class="large-8 columns line-dashed-setup-v">
|
||||
<div class="box-setup oh">
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<div class="text-center logo-setup">
|
||||
<img src="img/logo-negative-beta.svg" alt="Copay">
|
||||
<div ng-include="'views/includes/version.html'"></div>
|
||||
</div>
|
||||
<h1 class="text-center text-white">Browser unsupported</h1>
|
||||
<h3 class="text-center">
|
||||
|
|
Loading…
Reference in New Issue