From 1a15519903566e28760c9ed2e7b4246d428e3f2a Mon Sep 17 00:00:00 2001 From: Yemel Jardi Date: Mon, 2 Jun 2014 14:39:12 -0300 Subject: [PATCH 1/2] Add password strenght tooltip --- index.html | 4 ++-- js/directives.js | 12 +++++++----- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/index.html b/index.html index 5631834a3..3fef2b20b 100644 --- a/index.html +++ b/index.html @@ -209,7 +209,7 @@

Join a Wallet in Creation

- +
@@ -300,7 +300,7 @@
Your Wallet Password(doesn't need to be shared) Required
+ ng-model="walletPassword" check-strength="passwordStrength" tooltip="Password strength: {{passwordStrength}}" tooltip-trigger="focus" required>
Wallet name Optional
diff --git a/js/directives.js b/js/directives.js index 822fdae85..33fad2040 100644 --- a/js/directives.js +++ b/js/directives.js @@ -124,7 +124,7 @@ angular.module('copay.directives') return { replace: false, restrict: 'EACM', - scope: { model: '=checkStrength' }, + require: 'ngModel', link: function(scope, element, attrs) { var _grep = function(elems, callback, invert) { var callbackInverse, @@ -146,6 +146,7 @@ angular.module('copay.directives') }; var strength = { + messages: ['too weak', 'weak', 'weak', 'medium', 'strong'], colors: ['#c0392b', '#e74c3c', '#d35400', '#f39c12', '#27ae60'], mesureStrength: function (p) { var _force = 0; @@ -178,14 +179,15 @@ angular.module('copay.directives') else if (s <= 40) { idx = 3; } else { idx = 4; } - return { idx: idx + 1, col: this.colors[idx] }; + return { idx: idx + 1, col: this.colors[idx], message: this.messages[idx] }; } }; - - scope.$watch('model', function (newValue, oldValue) { + + scope.$watch(attrs.ngModel, function (newValue, oldValue) { if (newValue && newValue !== '') { var c = strength.getColor(strength.mesureStrength(newValue)); - element.css({ 'border-color': c.col }) + element.css({ 'border-color': c.col }); + scope[attrs.checkStrength] = c.message; } }); } From 329a48b35443e0f6d1a4925c57c2595394857160 Mon Sep 17 00:00:00 2001 From: Yemel Jardi Date: Mon, 2 Jun 2014 16:52:33 -0300 Subject: [PATCH 2/2] Add warning message on new Copay version --- index.html | 9 +++++++++ js/controllers/header.js | 14 +++++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/index.html b/index.html index 3fef2b20b..3915052a1 100644 --- a/index.html +++ b/index.html @@ -73,6 +73,15 @@
+
+
+
+ A newer version of Copay is now available, please update your wallet to a latest version. + Please check Copay.io. +
+
+
+
diff --git a/js/controllers/header.js b/js/controllers/header.js index 36c40e123..9c76edf88 100644 --- a/js/controllers/header.js +++ b/js/controllers/header.js @@ -1,7 +1,7 @@ 'use strict'; angular.module('copay.header').controller('HeaderController', - function($scope, $rootScope, $location, $notification, walletFactory, controllerUtils) { + function($scope, $rootScope, $location, $notification, $http, walletFactory, controllerUtils) { $scope.menu = [ { 'title': 'Addresses', @@ -23,6 +23,18 @@ angular.module('copay.header').controller('HeaderController', var beep = new Audio('sound/transaction.mp3'); + $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); + + if (currentVersion[0] < latestVersion[0]){ + $scope.updateVersion = 'error'; + } else if (currentVersion[0] == latestVersion[0] && currentVersion[1] < latestVersion[1]) { + $scope.updateVersion = 'info'; + } + }); + // Initialize alert notification (not show when init wallet) $rootScope.txAlertCount = 0; $rootScope.$watch('txAlertCount', function(txAlertCount) {