From bb1a5d110264a4fe5fbcd70bab48c8300d65f283 Mon Sep 17 00:00:00 2001 From: dabura667 Date: Fri, 24 Mar 2017 14:18:39 +0900 Subject: [PATCH 01/83] Fix settings translation string --- www/views/tab-settings.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/www/views/tab-settings.html b/www/views/tab-settings.html index 9e63a5088..b12ab2b5d 100644 --- a/www/views/tab-settings.html +++ b/www/views/tab-settings.html @@ -33,7 +33,7 @@ - {{'Share'|translate}} {{appName}} + Share {{appName}} From 15b313c27b04a9fb0bb8f0502999bfb4d2803e1e Mon Sep 17 00:00:00 2001 From: dabura667 Date: Fri, 24 Mar 2017 14:31:59 +0900 Subject: [PATCH 02/83] fix template.pot --- i18n/po/template.pot | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/i18n/po/template.pot b/i18n/po/template.pot index 08aa072c0..bca9887c4 100644 --- a/i18n/po/template.pot +++ b/i18n/po/template.pot @@ -2114,7 +2114,6 @@ msgstr "" #: www/views/customAmount.html:20 #: www/views/tab-receive.html:62 -#: www/views/tab-settings.html:36 msgid "Share" msgstr "" @@ -2132,6 +2131,7 @@ msgid "Share this invitation with your copayers" msgstr "" #: src/js/controllers/feedback/complete.js:5 +#: www/views/tab-settings.html:36 msgid "Share {{appName}}" msgstr "" From bc2d530e906205537cbd418504e468520f861370 Mon Sep 17 00:00:00 2001 From: Gustavo Maximiliano Cortez Date: Mon, 27 Mar 2017 11:31:46 -0300 Subject: [PATCH 03/83] Enable input in bits/BTC to reload the debit card --- src/js/controllers/amount.js | 2 +- src/js/controllers/buyAmazon.js | 7 ++++++- src/js/controllers/buyCoinbase.js | 11 ++++++++--- src/js/controllers/buyGlidera.js | 11 ++++++++--- src/js/controllers/sellCoinbase.js | 15 ++++++++++---- src/js/controllers/sellGlidera.js | 15 ++++++++++---- src/js/controllers/topup.js | 10 +++++----- src/js/routes.js | 3 +-- src/js/services/bitpayCardService.js | 29 +--------------------------- src/js/services/coinbaseService.js | 24 ----------------------- src/js/services/glideraService.js | 24 ----------------------- src/js/services/txFormatService.js | 29 ++++++++++++++++++++++++++++ www/views/topup.html | 5 +++-- 13 files changed, 84 insertions(+), 101 deletions(-) diff --git a/src/js/controllers/amount.js b/src/js/controllers/amount.js index 4202b8e01..777513df4 100644 --- a/src/js/controllers/amount.js +++ b/src/js/controllers/amount.js @@ -224,7 +224,7 @@ angular.module('copayApp.controllers').controller('amountController', function($ $state.transitionTo($scope.nextStep, { id: _cardId, amount: _amount, - currency: $scope.showAlternativeAmount ? $scope.alternativeIsoCode : '' + currency: $scope.showAlternativeAmount ? $scope.alternativeIsoCode : $scope.unitName }); } else { var amount = $scope.showAlternativeAmount ? fromFiat(_amount) : _amount; diff --git a/src/js/controllers/buyAmazon.js b/src/js/controllers/buyAmazon.js index b51d34763..a281ed342 100644 --- a/src/js/controllers/buyAmazon.js +++ b/src/js/controllers/buyAmazon.js @@ -112,8 +112,13 @@ angular.module('copayApp.controllers').controller('buyAmazonController', functio $scope.network = amazonService.getNetwork(); $scope.wallets = profileService.getWallets({ onlyComplete: true, - network: $scope.network + network: $scope.network, + hasFunds: true }); + if (lodash.isEmpty($scope.wallets)) { + showErrorAndBack('No wallets with funds'); + return; + } $scope.wallet = $scope.wallets[0]; // Default first wallet }); diff --git a/src/js/controllers/buyCoinbase.js b/src/js/controllers/buyCoinbase.js index b259552cd..8c1bd2ea9 100644 --- a/src/js/controllers/buyCoinbase.js +++ b/src/js/controllers/buyCoinbase.js @@ -1,6 +1,6 @@ 'use strict'; -angular.module('copayApp.controllers').controller('buyCoinbaseController', function($scope, $log, $state, $timeout, $ionicHistory, $ionicScrollDelegate, lodash, coinbaseService, popupService, profileService, ongoingProcess, walletService) { +angular.module('copayApp.controllers').controller('buyCoinbaseController', function($scope, $log, $state, $timeout, $ionicHistory, $ionicScrollDelegate, lodash, coinbaseService, popupService, profileService, ongoingProcess, walletService, txFormatService) { var amount; var currency; @@ -34,8 +34,8 @@ angular.module('copayApp.controllers').controller('buyCoinbaseController', funct }; $scope.$on("$ionicView.beforeEnter", function(event, data) { - $scope.isFiat = data.stateParams.currency ? true : false; - var parsedAmount = coinbaseService.parseAmount( + $scope.isFiat = data.stateParams.currency != 'bits' && data.stateParams.currency != 'BTC' ? true : false; + var parsedAmount = txFormatService.parseAmount( data.stateParams.amount, data.stateParams.currency); @@ -48,6 +48,11 @@ angular.module('copayApp.controllers').controller('buyCoinbaseController', funct onlyComplete: true, network: $scope.network }); + + if (lodash.isEmpty($scope.wallets)) { + showErrorAndBack('No wallets available'); + return; + } $scope.wallet = $scope.wallets[0]; // Default first wallet ongoingProcess.set('connectingCoinbase', true); diff --git a/src/js/controllers/buyGlidera.js b/src/js/controllers/buyGlidera.js index 7839685cc..33afa5c00 100644 --- a/src/js/controllers/buyGlidera.js +++ b/src/js/controllers/buyGlidera.js @@ -1,6 +1,6 @@ 'use strict'; -angular.module('copayApp.controllers').controller('buyGlideraController', function($scope, $log, $state, $timeout, $ionicHistory, lodash, glideraService, popupService, profileService, ongoingProcess, walletService, platformInfo) { +angular.module('copayApp.controllers').controller('buyGlideraController', function($scope, $log, $state, $timeout, $ionicHistory, lodash, glideraService, popupService, profileService, ongoingProcess, walletService, platformInfo, txFormatService) { var amount; var currency; @@ -36,8 +36,8 @@ angular.module('copayApp.controllers').controller('buyGlideraController', functi }; $scope.$on("$ionicView.beforeEnter", function(event, data) { - $scope.isFiat = data.stateParams.currency ? true : false; - var parsedAmount = glideraService.parseAmount( + $scope.isFiat = data.stateParams.currency != 'bits' && data.stateParams.currency != 'BTC' ? true : false; + var parsedAmount = txFormatService.parseAmount( data.stateParams.amount, data.stateParams.currency); @@ -50,6 +50,11 @@ angular.module('copayApp.controllers').controller('buyGlideraController', functi onlyComplete: true, network: $scope.network }); + + if (lodash.isEmpty($scope.wallets)) { + showErrorAndBack('No wallets available'); + return; + } $scope.wallet = $scope.wallets[0]; // Default first wallet ongoingProcess.set('connectingGlidera', true); diff --git a/src/js/controllers/sellCoinbase.js b/src/js/controllers/sellCoinbase.js index a336a4ac6..9e6bf2cd8 100644 --- a/src/js/controllers/sellCoinbase.js +++ b/src/js/controllers/sellCoinbase.js @@ -1,6 +1,6 @@ 'use strict'; -angular.module('copayApp.controllers').controller('sellCoinbaseController', function($scope, $log, $state, $timeout, $ionicHistory, $ionicScrollDelegate, lodash, coinbaseService, popupService, profileService, ongoingProcess, walletService, appConfigService, configService) { +angular.module('copayApp.controllers').controller('sellCoinbaseController', function($scope, $log, $state, $timeout, $ionicHistory, $ionicScrollDelegate, lodash, coinbaseService, popupService, profileService, ongoingProcess, walletService, appConfigService, configService, txFormatService) { var amount; var currency; @@ -117,8 +117,8 @@ angular.module('copayApp.controllers').controller('sellCoinbaseController', func }; $scope.$on("$ionicView.beforeEnter", function(event, data) { - $scope.isFiat = data.stateParams.currency ? true : false; - var parsedAmount = coinbaseService.parseAmount( + $scope.isFiat = data.stateParams.currency != 'bits' && data.stateParams.currency != 'BTC' ? true : false; + var parsedAmount = txFormatService.parseAmount( data.stateParams.amount, data.stateParams.currency); @@ -133,8 +133,15 @@ angular.module('copayApp.controllers').controller('sellCoinbaseController', func $scope.wallets = profileService.getWallets({ m: 1, // Only 1-signature wallet onlyComplete: true, - network: $scope.network + network: $scope.network, + hasFunds: true, + minAmount: parsedAmount.amountSat }); + + if (lodash.isEmpty($scope.wallets)) { + showErrorAndBack('Insufficient funds'); + return; + } $scope.wallet = $scope.wallets[0]; // Default first wallet ongoingProcess.set('connectingCoinbase', true); diff --git a/src/js/controllers/sellGlidera.js b/src/js/controllers/sellGlidera.js index 3028e0df3..119dac2fa 100644 --- a/src/js/controllers/sellGlidera.js +++ b/src/js/controllers/sellGlidera.js @@ -1,6 +1,6 @@ 'use strict'; -angular.module('copayApp.controllers').controller('sellGlideraController', function($scope, $log, $state, $timeout, $ionicHistory, lodash, glideraService, popupService, profileService, ongoingProcess, walletService, configService, platformInfo) { +angular.module('copayApp.controllers').controller('sellGlideraController', function($scope, $log, $state, $timeout, $ionicHistory, lodash, glideraService, popupService, profileService, ongoingProcess, walletService, configService, platformInfo, txFormatService) { var amount; var currency; @@ -36,8 +36,8 @@ angular.module('copayApp.controllers').controller('sellGlideraController', funct }; $scope.$on("$ionicView.beforeEnter", function(event, data) { - $scope.isFiat = data.stateParams.currency ? true : false; - var parsedAmount = glideraService.parseAmount( + $scope.isFiat = data.stateParams.currency != 'bits' && data.stateParams.currency != 'BTC' ? true : false; + var parsedAmount = txFormatService.parseAmount( data.stateParams.amount, data.stateParams.currency); @@ -49,8 +49,15 @@ angular.module('copayApp.controllers').controller('sellGlideraController', funct $scope.wallets = profileService.getWallets({ m: 1, // Only 1-signature wallet onlyComplete: true, - network: $scope.network + network: $scope.network, + hasFunds: true, + minAmount: parsedAmount.amountSat }); + + if (lodash.isEmpty($scope.wallets)) { + showErrorAndBack('Insufficient funds'); + return; + } $scope.wallet = $scope.wallets[0]; // Default first wallet ongoingProcess.set('connectingGlidera', true); diff --git a/src/js/controllers/topup.js b/src/js/controllers/topup.js index 44c8e4148..b90794b15 100644 --- a/src/js/controllers/topup.js +++ b/src/js/controllers/topup.js @@ -1,6 +1,6 @@ 'use strict'; -angular.module('copayApp.controllers').controller('topUpController', function($scope, $log, $state, $timeout, $ionicHistory, lodash, popupService, profileService, ongoingProcess, walletService, configService, platformInfo, bitpayService, bitpayCardService, payproService, bwcError) { +angular.module('copayApp.controllers').controller('topUpController', function($scope, $log, $state, $timeout, $ionicHistory, lodash, popupService, profileService, ongoingProcess, walletService, configService, platformInfo, bitpayService, bitpayCardService, payproService, bwcError, txFormatService) { var amount; var currency; @@ -50,21 +50,21 @@ angular.module('copayApp.controllers').controller('topUpController', function($s }; $scope.$on("$ionicView.beforeEnter", function(event, data) { - $scope.isFiat = data.stateParams.currency ? true : false; cardId = data.stateParams.id; if (!cardId) { showErrorAndBack('No card selected'); return; } - - var parsedAmount = bitpayCardService.parseAmount( + + var parsedAmount = txFormatService.parseAmount( data.stateParams.amount, data.stateParams.currency); amount = parsedAmount.amount; currency = parsedAmount.currency; $scope.amountUnitStr = parsedAmount.amountUnitStr; + $scope.alternativeIsoCode = parsedAmount.alternativeIsoCode; $scope.network = bitpayService.getEnvironment().network; $scope.wallets = profileService.getWallets({ @@ -80,7 +80,7 @@ angular.module('copayApp.controllers').controller('topUpController', function($s } $scope.onWalletSelect($scope.wallets[0]); // Default first wallet - bitpayCardService.getRates(currency, function(err, data) { + bitpayCardService.getRates($scope.alternativeIsoCode, function(err, data) { if (err) $log.error(err); $scope.rate = data.rate; }); diff --git a/src/js/routes.js b/src/js/routes.js index e95c63bb4..4fc657bd4 100644 --- a/src/js/routes.js +++ b/src/js/routes.js @@ -1060,8 +1060,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr }, params: { id: null, - currency: 'USD', - forceCurrency: true + currency: 'USD' } }) .state('tabs.bitpayCard.amount', { diff --git a/src/js/services/bitpayCardService.js b/src/js/services/bitpayCardService.js index ed3157cf6..d1aea6b19 100644 --- a/src/js/services/bitpayCardService.js +++ b/src/js/services/bitpayCardService.js @@ -1,6 +1,6 @@ 'use strict'; -angular.module('copayApp.services').factory('bitpayCardService', function($log, $rootScope, $filter, lodash, storageService, bitauthService, platformInfo, moment, appIdentityService, bitpayService, nextStepsService, configService, txFormatService, appConfigService, rateService) { +angular.module('copayApp.services').factory('bitpayCardService', function($log, $rootScope, $filter, lodash, storageService, bitauthService, platformInfo, moment, appIdentityService, bitpayService, nextStepsService, configService, txFormatService, appConfigService) { var root = {}; var _setError = function(msg, e) { @@ -39,33 +39,6 @@ angular.module('copayApp.services').factory('bitpayCardService', function($log, return history; }; - root.parseAmount = function(amount, currency) { - var config = configService.getSync().wallet.settings; - var satToBtc = 1 / 100000000; - var unitToSatoshi = config.unitToSatoshi; - var amountUnitStr; - var amountSat; - - // IF 'USD' - if (currency) { - amountUnitStr = $filter('formatFiatAmount')(amount) + ' ' + currency; - amountSat = rateService.fromFiat(amount, currency).toFixed(0); - } else { - amountSat = parseInt((amount * unitToSatoshi).toFixed(0)); - amountUnitStr = txFormatService.formatAmountStr(amountSat); - // convert unit to BTC - amount = (amountSat * satToBtc).toFixed(8); - currency = 'BTC'; - } - - return { - amount: amount, - currency: currency, - amountSat: amountSat, - amountUnitStr: amountUnitStr - }; - }; - root.sync = function(apiContext, cb) { var json = { method: 'getDebitCards' diff --git a/src/js/services/coinbaseService.js b/src/js/services/coinbaseService.js index 07aca04c8..ac3bca0aa 100644 --- a/src/js/services/coinbaseService.js +++ b/src/js/services/coinbaseService.js @@ -107,30 +107,6 @@ angular.module('copayApp.services').factory('coinbaseService', function($http, $ }; }; - root.parseAmount = function(amount, currency) { - var config = configService.getSync().wallet.settings; - var satToBtc = 1 / 100000000; - var unitToSatoshi = config.unitToSatoshi; - var amountUnitStr; - - // IF 'USD' - if (currency) { - amountUnitStr = $filter('formatFiatAmount')(amount) + ' ' + currency; - } else { - var amountSat = parseInt((amount * unitToSatoshi).toFixed(0)); - amountUnitStr = txFormatService.formatAmountStr(amountSat); - // convert unit to BTC - amount = (amountSat * satToBtc).toFixed(8); - currency = 'BTC'; - } - - return { - amount: amount, - currency: currency, - amountUnitStr: amountUnitStr - }; - }; - root.getSignupUrl = function() { return credentials.HOST + '/signup'; } diff --git a/src/js/services/glideraService.js b/src/js/services/glideraService.js index 79bee5f38..f60230cdf 100644 --- a/src/js/services/glideraService.js +++ b/src/js/services/glideraService.js @@ -53,30 +53,6 @@ angular.module('copayApp.services').factory('glideraService', function($http, $l return 'USD'; }; - root.parseAmount = function(amount, currency) { - var config = configService.getSync().wallet.settings; - var satToBtc = 1 / 100000000; - var unitToSatoshi = config.unitToSatoshi; - var amountUnitStr; - - // IF 'USD' - if (currency) { - amountUnitStr = $filter('formatFiatAmount')(amount) + ' ' + currency; - } else { - var amountSat = parseInt((amount * unitToSatoshi).toFixed(0)); - amountUnitStr = txFormatService.formatAmountStr(amountSat); - // convert unit to BTC - amount = (amountSat * satToBtc).toFixed(8); - currency = 'BTC'; - } - - return { - amount: amount, - currency: currency, - amountUnitStr: amountUnitStr - }; - }; - root.getSignupUrl = function() { return credentials.HOST + '/register'; } diff --git a/src/js/services/txFormatService.js b/src/js/services/txFormatService.js index 77533b692..a28079d3f 100644 --- a/src/js/services/txFormatService.js +++ b/src/js/services/txFormatService.js @@ -155,5 +155,34 @@ angular.module('copayApp.services').factory('txFormatService', function($filter, return txps; }; + root.parseAmount = function(amount, currency) { + var config = configService.getSync().wallet.settings; + var satToBtc = 1 / 100000000; + var unitToSatoshi = config.unitToSatoshi; + var amountUnitStr; + var amountSat; + var alternativeIsoCode = config.alternativeIsoCode; + + // If fiat currency + if (currency != 'bits' && currency != 'BTC') { + amountUnitStr = $filter('formatFiatAmount')(amount) + ' ' + currency; + amountSat = rateService.fromFiat(amount, currency).toFixed(0); + } else { + amountSat = parseInt((amount * unitToSatoshi).toFixed(0)); + amountUnitStr = root.formatAmountStr(amountSat); + // convert unit to BTC + amount = (amountSat * satToBtc).toFixed(8); + currency = 'BTC'; + } + + return { + amount: amount, + currency: currency, + alternativeIsoCode: alternativeIsoCode, + amountSat: amountSat, + amountUnitStr: amountUnitStr + }; + }; + return root; }); diff --git a/www/views/topup.html b/www/views/topup.html index 28ae3d32d..4c003aa1a 100644 --- a/www/views/topup.html +++ b/www/views/topup.html @@ -18,8 +18,9 @@
{{amountUnitStr}}
-
- @ {{rate | currency:'$':2}} per BTC +
+ @ {{rate | currency:'$':2}} per BTC + ...
From 45bb0f00764a7d2ab86797cc2328abff9389ebc4 Mon Sep 17 00:00:00 2001 From: Gustavo Maximiliano Cortez Date: Mon, 27 Mar 2017 11:38:17 -0300 Subject: [PATCH 04/83] Fix rate --- src/js/controllers/topup.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/js/controllers/topup.js b/src/js/controllers/topup.js index b90794b15..c7894185d 100644 --- a/src/js/controllers/topup.js +++ b/src/js/controllers/topup.js @@ -64,7 +64,6 @@ angular.module('copayApp.controllers').controller('topUpController', function($s amount = parsedAmount.amount; currency = parsedAmount.currency; $scope.amountUnitStr = parsedAmount.amountUnitStr; - $scope.alternativeIsoCode = parsedAmount.alternativeIsoCode; $scope.network = bitpayService.getEnvironment().network; $scope.wallets = profileService.getWallets({ @@ -80,7 +79,7 @@ angular.module('copayApp.controllers').controller('topUpController', function($s } $scope.onWalletSelect($scope.wallets[0]); // Default first wallet - bitpayCardService.getRates($scope.alternativeIsoCode, function(err, data) { + bitpayCardService.getRates('USD', function(err, data) { if (err) $log.error(err); $scope.rate = data.rate; }); From 850739e17e6f15c6ec05e294d01f7780264178bd Mon Sep 17 00:00:00 2001 From: JDonadio Date: Mon, 27 Mar 2017 16:59:01 -0300 Subject: [PATCH 05/83] paste evaluated amount --- src/js/controllers/amount.js | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/src/js/controllers/amount.js b/src/js/controllers/amount.js index 4202b8e01..8901f1a8d 100644 --- a/src/js/controllers/amount.js +++ b/src/js/controllers/amount.js @@ -1,6 +1,6 @@ 'use strict'; -angular.module('copayApp.controllers').controller('amountController', function($scope, $filter, $timeout, $ionicScrollDelegate, $ionicHistory, gettextCatalog, platformInfo, lodash, configService, rateService, $stateParams, $window, $state, $log, txFormatService, ongoingProcess, popupService, bwcError, payproService, profileService, bitcore, amazonService) { +angular.module('copayApp.controllers').controller('amountController', function($scope, $filter, $timeout, $ionicScrollDelegate, $ionicHistory, gettextCatalog, platformInfo, lodash, configService, rateService, $stateParams, $window, $state, $log, txFormatService, ongoingProcess, popupService, bwcError, payproService, profileService, bitcore, amazonService, nodeWebkitService) { var _cardId; var unitToSatoshi; var satToUnit; @@ -8,6 +8,7 @@ angular.module('copayApp.controllers').controller('amountController', function($ var satToBtc; var SMALL_FONT_SIZE_LIMIT = 10; var LENGTH_EXPRESSION_LIMIT = 19; + var isNW = platformInfo.isNW; $scope.isChromeApp = platformInfo.isChromeApp; $scope.$on('$ionicView.leave', function() { @@ -15,7 +16,6 @@ angular.module('copayApp.controllers').controller('amountController', function($ }); $scope.$on("$ionicView.beforeEnter", function(event, data) { - // Go to... _cardId = data.stateParams.id; // Optional (BitPay Card ID) $scope.nextStep = data.stateParams.nextStep; @@ -42,18 +42,20 @@ angular.module('copayApp.controllers').controller('amountController', function($ var reOp = /^[\*\+\-\/]$/; var disableKeys = angular.element($window).on('keydown', function(e) { + if (!e.key) return; if (e.which === 8) { // you can add others here inside brackets. e.preventDefault(); $scope.removeDigit(); } - if (e.key && e.key.match(reNr)) + if (e.key.match(reNr)) { $scope.pushDigit(e.key); - - else if (e.key && e.key.match(reOp)) + } else if (e.key.match(reOp)) { $scope.pushOperator(e.key); - - else if (e.key && e.key == 'Enter') + } else if (e.keyCode === 86) { + if (e.ctrlKey || e.metaKey) + processClipboard(); + } else if (e.keyCode === 13) $scope.finish(); $timeout(function() { @@ -89,6 +91,20 @@ angular.module('copayApp.controllers').controller('amountController', function($ }, 10); }); + function paste(value) { + $scope.amount = value; + processAmount(value); + $timeout(function() { + $scope.$apply(); + }); + }; + + function processClipboard() { + if (!isNW) return; + var value = nodeWebkitService.readFromClipboard(); + if (value && evaluate(value) > 0) paste(evaluate(value)); + }; + $scope.showSendMaxMenu = function() { $scope.showSendMax = true; }; From cd4afb37d3490ed66147cd7cd8ba73f536fc6fac Mon Sep 17 00:00:00 2001 From: Karel Bilek Date: Wed, 29 Mar 2017 20:49:32 +0200 Subject: [PATCH 06/83] Using new version of connect --- Gruntfile.js | 2 +- bower.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 4f43bc7aa..d936ce969 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -146,7 +146,7 @@ module.exports = function(grunt) { 'src/js/externalServices.js', 'src/js/init.js', 'src/js/trezor-url.js', - 'bower_components/trezor-connect/login.js', + 'bower_components/trezor-connect/connect.js', 'node_modules/bezier-easing/dist/bezier-easing.min.js', 'node_modules/cordova-plugin-qrscanner/dist/cordova-plugin-qrscanner-lib.min.js' ], diff --git a/bower.json b/bower.json index ac2e0a9ee..cae33e2d6 100644 --- a/bower.json +++ b/bower.json @@ -15,7 +15,7 @@ "moment": "2.10.3", "ng-lodash": "0.2.3", "qrcode-decoder-js": "*", - "trezor-connect": "~1.0.1", + "trezor-connect": "~1.1.2", "ng-csv": "~0.3.6", "ionic-toast": "^0.4.1", "angular-clipboard": "^1.4.2", From f3a0044797ae0f7a5bc8157d20dc6f22fc624dea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20B=C3=ADlek?= Date: Wed, 29 Mar 2017 22:23:45 +0200 Subject: [PATCH 07/83] Newer version --- bower.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bower.json b/bower.json index cae33e2d6..830a156c7 100644 --- a/bower.json +++ b/bower.json @@ -15,7 +15,7 @@ "moment": "2.10.3", "ng-lodash": "0.2.3", "qrcode-decoder-js": "*", - "trezor-connect": "~1.1.2", + "trezor-connect": "~1.1.3", "ng-csv": "~0.3.6", "ionic-toast": "^0.4.1", "angular-clipboard": "^1.4.2", From f677d4bd75dcce134f83421516ad8aa9de556390 Mon Sep 17 00:00:00 2001 From: Gabriel Date: Thu, 30 Mar 2017 21:37:12 +0200 Subject: [PATCH 08/83] fix spinner in windows phone --- src/js/controllers/create.js | 2 +- src/js/controllers/onboarding/tour.js | 64 ++++++++++++++------------- src/js/services/onGoingProcess.js | 15 ++++--- 3 files changed, 43 insertions(+), 38 deletions(-) diff --git a/src/js/controllers/create.js b/src/js/controllers/create.js index 1b44ae283..78561a45a 100644 --- a/src/js/controllers/create.js +++ b/src/js/controllers/create.js @@ -211,6 +211,6 @@ angular.module('copayApp.controllers').controller('createController', }, 100); } else $state.go('tabs.home'); }); - }, 100); + }, 300); } }); diff --git a/src/js/controllers/onboarding/tour.js b/src/js/controllers/onboarding/tour.js index c2a38791e..7652366f6 100644 --- a/src/js/controllers/onboarding/tour.js +++ b/src/js/controllers/onboarding/tour.js @@ -43,38 +43,40 @@ angular.module('copayApp.controllers').controller('tourController', var retryCount = 0; $scope.createDefaultWallet = function() { ongoingProcess.set('creatingWallet', true); - profileService.createDefaultWallet(function(err, walletClient) { - if (err) { - $log.warn(err); + $timeout(function() { + profileService.createDefaultWallet(function(err, walletClient) { + if (err) { + $log.warn(err); - return $timeout(function() { - $log.warn('Retrying to create default wallet.....:' + ++retryCount); - if (retryCount > 3) { - ongoingProcess.set('creatingWallet', false); - popupService.showAlert( - gettextCatalog.getString('Cannot Create Wallet'), err, - function() { - retryCount = 0; - return $scope.createDefaultWallet(); - }, gettextCatalog.getString('Retry')); - } else { - return $scope.createDefaultWallet(); - } - }, 2000); - }; - ongoingProcess.set('creatingWallet', false); - var wallet = walletClient; - var walletId = wallet.credentials.walletId; - if (!usePushNotifications) { - $state.go('onboarding.backupRequest', { - walletId: walletId - }); - } else { - $state.go('onboarding.notifications', { - walletId: walletId - }); - } - }); + return $timeout(function() { + $log.warn('Retrying to create default wallet.....:' + ++retryCount); + if (retryCount > 3) { + ongoingProcess.set('creatingWallet', false); + popupService.showAlert( + gettextCatalog.getString('Cannot Create Wallet'), err, + function() { + retryCount = 0; + return $scope.createDefaultWallet(); + }, gettextCatalog.getString('Retry')); + } else { + return $scope.createDefaultWallet(); + } + }, 2000); + }; + ongoingProcess.set('creatingWallet', false); + var wallet = walletClient; + var walletId = wallet.credentials.walletId; + if (!usePushNotifications) { + $state.go('onboarding.backupRequest', { + walletId: walletId + }); + } else { + $state.go('onboarding.notifications', { + walletId: walletId + }); + } + }); + }, 300); }; $scope.goBack = function() { diff --git a/src/js/services/onGoingProcess.js b/src/js/services/onGoingProcess.js index 2e0692b17..763cccfbb 100644 --- a/src/js/services/onGoingProcess.js +++ b/src/js/services/onGoingProcess.js @@ -3,6 +3,7 @@ angular.module('copayApp.services').factory('ongoingProcess', function($log, $timeout, $filter, lodash, $ionicLoading, gettext, platformInfo) { var root = {}; var isCordova = platformInfo.isCordova; + var isWP = platformInfo.isWP; var ongoingProcess = {}; @@ -49,7 +50,7 @@ angular.module('copayApp.services').factory('ongoingProcess', function($log, $ti root.clear = function() { ongoingProcess = {}; - if (isCordova) { + if (isCordova && !isWP) { window.plugins.spinnerDialog.hide(); } else { $ionicLoading.hide(); @@ -79,21 +80,23 @@ angular.module('copayApp.services').factory('ongoingProcess', function($log, $ti if (customHandler) { customHandler(processName, showName, isOn); } else if (root.onGoingProcessName) { - if (isCordova) { + if (isCordova && !isWP) { window.plugins.spinnerDialog.show(null, showName, root.clear); } else { - var tmpl = '
' + showName + '
'; + var tmpl; + if (isWP) tmpl = '
' + showName +'
'; + else tmpl = '
' + showName + '
'; $ionicLoading.show({ template: tmpl }); } } else { - if (isCordova) { + if (isCordova && !isWP) { window.plugins.spinnerDialog.hide(); } else { - $ionicLoading.hide(); - } + $ionicLoading.hide(); + } } }; From cf818a17eed4e31c57ab2b3129f48b16f959e49e Mon Sep 17 00:00:00 2001 From: Gabriel Date: Thu, 30 Mar 2017 21:45:30 +0200 Subject: [PATCH 09/83] adding windows release build --- app-template/package-template.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app-template/package-template.json b/app-template/package-template.json index 46015f139..c6b567f25 100644 --- a/app-template/package-template.json +++ b/app-template/package-template.json @@ -94,6 +94,7 @@ "build:windows": "cordova prepare windows && cordova build windows -- --arch=\"x86\"", "build:ios-release": "cordova prepare ios && cordova build ios --release", "build:android-release": "cordova prepare android && cordova build android --release", + "build:windows-release": "cordova prepare windows && cordova build windows --release --arch=\"x86\"", "build:desktop": "grunt desktop", "build:macos": "grunt macos", "open:ios": "open platforms/ios/*.xcodeproj", @@ -101,6 +102,7 @@ "final:www": "npm run build:www-release", "final:ios": "npm run final:www && npm run build:ios-release && npm run open:ios", "final:android": "npm run final:www && npm run build:android-release && npm run sign:android && npm run run:android-release", + "final:windows": "npm run final:www && npm run build:windows-release", "final:desktop": "npm run build:desktop && npm run build:macos", "run:android": "cordova run android --device", "run:android-release": "cordova run android --device --release", From 1ca3f24fa75de7292e3dfc096acd69e6bc4d0de1 Mon Sep 17 00:00:00 2001 From: JDonadio Date: Tue, 4 Apr 2017 09:34:01 -0300 Subject: [PATCH 10/83] remove unnecessary parameter --- src/js/controllers/amount.js | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/src/js/controllers/amount.js b/src/js/controllers/amount.js index 8901f1a8d..726dffcc3 100644 --- a/src/js/controllers/amount.js +++ b/src/js/controllers/amount.js @@ -84,7 +84,7 @@ angular.module('copayApp.controllers').controller('amountController', function($ $scope.amount = (($stateParams.toAmount) * satToUnit).toFixed(unitDecimals); } - processAmount($scope.amount); + processAmount(); $timeout(function() { $ionicScrollDelegate.resize(); @@ -93,7 +93,7 @@ angular.module('copayApp.controllers').controller('amountController', function($ function paste(value) { $scope.amount = value; - processAmount(value); + processAmount(); $timeout(function() { $scope.$apply(); }); @@ -144,7 +144,7 @@ angular.module('copayApp.controllers').controller('amountController', function($ $scope.amount = ($scope.amount + digit).replace('..', '.'); checkFontSize(); - processAmount($scope.amount); + processAmount(); }; $scope.pushOperator = function(operator) { @@ -172,7 +172,7 @@ angular.module('copayApp.controllers').controller('amountController', function($ $scope.removeDigit = function() { $scope.amount = $scope.amount.slice(0, -1); - processAmount($scope.amount); + processAmount(); checkFontSize(); }; @@ -182,17 +182,12 @@ angular.module('copayApp.controllers').controller('amountController', function($ checkFontSize(); }; - function processAmount(val) { - if (!val) { - $scope.resetAmount(); - return; - } - - var formatedValue = format(val); + function processAmount() { + var formatedValue = format($scope.amount); var result = evaluate(formatedValue); $scope.allowSend = lodash.isNumber(result) && +result > 0; if (lodash.isNumber(result)) { - $scope.globalResult = isExpression(val) ? '= ' + processResult(result) : ''; + $scope.globalResult = isExpression($scope.amount) ? '= ' + processResult(result) : ''; $scope.amountResult = $filter('formatFiatAmount')(toFiat(result)); $scope.alternativeResult = txFormatService.formatAmount(fromFiat(result) * unitToSatoshi, true); } From 86b8bd4326a9ded79ebf2f814fa6087acc0effda Mon Sep 17 00:00:00 2001 From: JDonadio Date: Thu, 23 Feb 2017 16:56:46 -0500 Subject: [PATCH 11/83] add pincode view-controller --- src/js/controllers/pincode.js | 44 ++++++++++++++++++++++ src/js/routes.js | 16 ++++++++ src/sass/views/pincode.scss | 38 +++++++++++++++++++ src/sass/views/views.scss | 1 + www/views/pincode.html | 69 +++++++++++++++++++++++++++++++++++ www/views/tab-home.html | 4 +- 6 files changed, 170 insertions(+), 2 deletions(-) create mode 100644 src/js/controllers/pincode.js create mode 100644 src/sass/views/pincode.scss create mode 100644 www/views/pincode.html diff --git a/src/js/controllers/pincode.js b/src/js/controllers/pincode.js new file mode 100644 index 000000000..dca8f08f4 --- /dev/null +++ b/src/js/controllers/pincode.js @@ -0,0 +1,44 @@ +'use strict'; + +angular.module('copayApp.controllers').controller('pincodeController', function($timeout, $scope, $log, $window) { + + angular.element($window).on('keydown', function(e) { + if (e.which === 8) { // you can add others here inside brackets. + e.preventDefault(); + $scope.delete(); + } + + if (e.key && e.key.match(/^[0-9]$/)) + $scope.add(e.key); + else if (e.key && e.key == 'Enter') + console.log('DONE'); + }); + + $scope.$on('$ionicView.beforeEnter', function(event, data) { + $scope.passcode = ""; + }); + + $scope.add = function(value) { + if (isComplete()) $log.debug("The four digit code was entered"); + else updatePassCode(value); + }; + + $scope.delete = function() { + if ($scope.passcode.length > 0) { + $scope.passcode = $scope.passcode.substring(0, $scope.passcode.length - 1); + updatePassCode(); + } + }; + + function isComplete() { + if ($scope.passcode.length < 4) return false; + else return true; + }; + + function updatePassCode(value) { + if (value) $scope.passcode = $scope.passcode + value; + $timeout(function() { + $scope.$apply(); + }); + }; +}); diff --git a/src/js/routes.js b/src/js/routes.js index 4fc657bd4..b02f18937 100644 --- a/src/js/routes.js +++ b/src/js/routes.js @@ -672,6 +672,22 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr } }) + /* + * + * Pin Code + * + */ + + .state('tabs.home.pincode', { + url: '/pincode', + views: { + 'tab-home@tabs': { + templateUrl: 'views/pincode.html', + controller: 'pincodeController' + } + } + }) + /* * * Paper Wallet diff --git a/src/sass/views/pincode.scss b/src/sass/views/pincode.scss new file mode 100644 index 000000000..64a4b8584 --- /dev/null +++ b/src/sass/views/pincode.scss @@ -0,0 +1,38 @@ +.button-stretch { + width: 100%; +} + +.col-offset-15 { + margin-left: 15%; +} + +@mixin centerer { + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); +} + +.content { + position: relative; + width: 100%; + height: 100%; +} + +.block-code { + @include centerer; + top: 20% !important; + width: 50%; + + > .row > .col { + border-bottom: 1px solid #3E3E3E; + padding: 5px; + margin: 10px; + height: 35px; + } +} + +.block-buttons { + @include centerer; + padding: 20px; +} diff --git a/src/sass/views/views.scss b/src/sass/views/views.scss index a4648928f..5516fd9ab 100644 --- a/src/sass/views/views.scss +++ b/src/sass/views/views.scss @@ -46,3 +46,4 @@ @import "includes/accountSelector"; @import "integrations/integrations"; @import "custom-amount"; +@import "pincode"; diff --git a/www/views/pincode.html b/www/views/pincode.html new file mode 100644 index 000000000..7bbf96677 --- /dev/null +++ b/www/views/pincode.html @@ -0,0 +1,69 @@ + +
+
+
+
+ {{passcode.substring(0, 1)}} +
+
+ {{passcode.substring(1, 2)}} +
+
+ {{passcode.substring(2, 3)}} +
+
+ {{passcode.substring(3, 4)}} +
+
+
+
+
+
+ +
+
+ +
+
+ +
+
+
+
+ +
+
+ +
+
+ +
+
+
+
+ +
+
+ +
+
+ +
+
+
+
+ +
+
+ +
+
+ +
+
+
+
+ +
diff --git a/www/views/tab-home.html b/www/views/tab-home.html index 5e1b1a99c..6f0d57ece 100644 --- a/www/views/tab-home.html +++ b/www/views/tab-home.html @@ -66,7 +66,7 @@
Wallets - +
@@ -91,7 +91,7 @@ {{wallet.status.totalBalanceStr ? wallet.status.totalBalanceStr : ( wallet.cachedBalance ? wallet.cachedBalance + (wallet.cachedBalanceUpdatedOn ? ' · ' + ( wallet.cachedBalanceUpdatedOn * 1000 | amTimeAgo) : '') : '' ) }} - + [Balance Hidden] {{wallet.m}}-of-{{wallet.n}} From 1ee75fd4249606dcd80dc02058fdb9e65e53413e Mon Sep 17 00:00:00 2001 From: JDonadio Date: Fri, 24 Feb 2017 14:46:54 -0500 Subject: [PATCH 12/83] use modal - css refactor --- src/js/controllers/pincode.js | 28 +++++++----- src/js/controllers/tab-home.js | 11 +++++ src/js/routes.js | 16 ------- src/js/services/configService.js | 4 ++ src/sass/views/pincode.scss | 68 ++++++++++++++--------------- www/views/{ => modals}/pincode.html | 15 +++---- www/views/tab-home.html | 2 +- 7 files changed, 72 insertions(+), 72 deletions(-) rename www/views/{ => modals}/pincode.html (88%) diff --git a/src/js/controllers/pincode.js b/src/js/controllers/pincode.js index dca8f08f4..448ed58fa 100644 --- a/src/js/controllers/pincode.js +++ b/src/js/controllers/pincode.js @@ -1,6 +1,7 @@ 'use strict'; -angular.module('copayApp.controllers').controller('pincodeController', function($timeout, $scope, $log, $window) { +angular.module('copayApp.controllers').controller('pincodeController', function($timeout, $scope, $log, $window, configService) { + $scope.pincode = ''; angular.element($window).on('keydown', function(e) { if (e.which === 8) { // you can add others here inside brackets. @@ -11,34 +12,39 @@ angular.module('copayApp.controllers').controller('pincodeController', function( if (e.key && e.key.match(/^[0-9]$/)) $scope.add(e.key); else if (e.key && e.key == 'Enter') - console.log('DONE'); - }); - - $scope.$on('$ionicView.beforeEnter', function(event, data) { - $scope.passcode = ""; + checkPasscode(); }); $scope.add = function(value) { - if (isComplete()) $log.debug("The four digit code was entered"); + if (isComplete()) checkPasscode(); else updatePassCode(value); }; $scope.delete = function() { - if ($scope.passcode.length > 0) { - $scope.passcode = $scope.passcode.substring(0, $scope.passcode.length - 1); + if ($scope.pincode.length > 0) { + $scope.pincode = $scope.pincode.substring(0, $scope.pincode.length - 1); updatePassCode(); } }; function isComplete() { - if ($scope.passcode.length < 4) return false; + if ($scope.pincode.length < 4) return false; else return true; }; function updatePassCode(value) { - if (value) $scope.passcode = $scope.passcode + value; + if (value) $scope.pincode = $scope.pincode + value; $timeout(function() { + checkPasscode(); $scope.$apply(); }); }; + + function checkPasscode() { + configService.whenAvailable(function(config) { + var value = '1234'; + if (value != $scope.pincode) return; + console.log('MATCH'); + }); + }; }); diff --git a/src/js/controllers/tab-home.js b/src/js/controllers/tab-home.js index 7a3fd83f8..8abcb08d2 100644 --- a/src/js/controllers/tab-home.js +++ b/src/js/controllers/tab-home.js @@ -15,6 +15,17 @@ angular.module('copayApp.controllers').controller('tabHomeController', $scope.isNW = platformInfo.isNW; $scope.showRateCard = {}; + function openPincodeModal() { + $ionicModal.fromTemplateUrl('views/modals/pincode.html', { + scope: $scope, + backdropClickToClose: false, + hardwareBackButtonClose: false + }).then(function(modal) { + $scope.pincodeModal = modal; + $scope.pincodeModal.show(); + }); + }; + openPincodeModal(); $scope.$on("$ionicView.afterEnter", function() { startupService.ready(); }); diff --git a/src/js/routes.js b/src/js/routes.js index b02f18937..4fc657bd4 100644 --- a/src/js/routes.js +++ b/src/js/routes.js @@ -672,22 +672,6 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr } }) - /* - * - * Pin Code - * - */ - - .state('tabs.home.pincode', { - url: '/pincode', - views: { - 'tab-home@tabs': { - templateUrl: 'views/pincode.html', - controller: 'pincodeController' - } - } - }) - /* * * Paper Wallet diff --git a/src/js/services/configService.js b/src/js/services/configService.js index 747554ca1..1a16992fb 100644 --- a/src/js/services/configService.js +++ b/src/js/services/configService.js @@ -53,6 +53,10 @@ angular.module('copayApp.services').factory('configService', function(storageSer } }, + pincode: { + value: null, + }, + // External services recentTransactions: { enabled: true, diff --git a/src/sass/views/pincode.scss b/src/sass/views/pincode.scss index 64a4b8584..97413fc47 100644 --- a/src/sass/views/pincode.scss +++ b/src/sass/views/pincode.scss @@ -1,38 +1,36 @@ -.button-stretch { +#pin-code { + background-color: #C3C3C3; + + .button-stretch { + width: 100%; + } + .col-offset-15 { + margin-left: 15%; + } + @mixin centerer { + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + } + .content { + position: absolute; width: 100%; -} - -.col-offset-15 { - margin-left: 15%; -} - -@mixin centerer { - position: absolute; - top: 50%; - left: 50%; - transform: translate(-50%, -50%); -} - -.content { - position: relative; - width: 100%; - height: 100%; -} - -.block-code { - @include centerer; - top: 20% !important; - width: 50%; - - > .row > .col { - border-bottom: 1px solid #3E3E3E; - padding: 5px; - margin: 10px; - height: 35px; + height: 100%; + .block-code { + @include centerer; + top: 20% !important; + width: 50%; + > .row > .col { + border-bottom: 1px solid #3E3E3E; + padding: 5px; + margin: 10px; + height: 35px; + } + } + .block-buttons { + @include centerer; + padding: 20px; + } } } - -.block-buttons { - @include centerer; - padding: 20px; -} diff --git a/www/views/pincode.html b/www/views/modals/pincode.html similarity index 88% rename from www/views/pincode.html rename to www/views/modals/pincode.html index 7bbf96677..aeee3a3dc 100644 --- a/www/views/pincode.html +++ b/www/views/modals/pincode.html @@ -1,18 +1,18 @@ - +
- {{passcode.substring(0, 1)}} + {{pincode.substring(0, 1)}}
- {{passcode.substring(1, 2)}} + {{pincode.substring(1, 2)}}
- {{passcode.substring(2, 3)}} + {{pincode.substring(2, 3)}}
- {{passcode.substring(3, 4)}} + {{pincode.substring(3, 4)}}
@@ -63,7 +63,4 @@
- - + diff --git a/www/views/tab-home.html b/www/views/tab-home.html index 6f0d57ece..6d2ec9247 100644 --- a/www/views/tab-home.html +++ b/www/views/tab-home.html @@ -66,7 +66,7 @@
From 82e556b026d3269b0d84937042078130f5049396 Mon Sep 17 00:00:00 2001 From: JDonadio Date: Tue, 28 Feb 2017 10:32:10 -0300 Subject: [PATCH 13/83] wip add modal config --- src/js/controllers/advancedSettings.js | 37 +++++++++++++++++++++++--- src/js/controllers/pincode.js | 6 +++++ src/js/controllers/tab-home.js | 2 +- src/js/services/configService.js | 1 + src/sass/views/pincode.scss | 6 ++++- www/views/advancedSettings.html | 8 +++++- www/views/modals/pincode.html | 5 ++-- 7 files changed, 57 insertions(+), 8 deletions(-) diff --git a/src/js/controllers/advancedSettings.js b/src/js/controllers/advancedSettings.js index c5cd65103..826ae3c81 100644 --- a/src/js/controllers/advancedSettings.js +++ b/src/js/controllers/advancedSettings.js @@ -1,6 +1,6 @@ 'use strict'; -angular.module('copayApp.controllers').controller('advancedSettingsController', function($scope, $rootScope, $log, $window, lodash, configService, uxLanguage, platformInfo, profileService, feeService, storageService, $ionicHistory, $timeout, $ionicScrollDelegate) { +angular.module('copayApp.controllers').controller('advancedSettingsController', function($scope, $rootScope, $log, $window, $ionicModal, lodash, configService, uxLanguage, platformInfo, pushNotificationsService, profileService, feeService, storageService, $ionicHistory, $timeout, $ionicScrollDelegate) { var updateConfig = function() { var config = configService.getSync(); @@ -11,10 +11,12 @@ angular.module('copayApp.controllers').controller('advancedSettingsController', $scope.recentTransactionsEnabled = { value: config.recentTransactions.enabled }; - $scope.hideNextSteps = { value: config.hideNextSteps.enabled }; + $scope.usePincode = { + value: config.pincode ? config.pincode.enabled : false + }; }; $scope.spendUnconfirmedChange = function() { @@ -31,7 +33,24 @@ angular.module('copayApp.controllers').controller('advancedSettingsController', $scope.nextStepsChange = function() { var opts = { hideNextSteps: { - enabled: $scope.hideNextSteps.value + enabled: $scope.hideNextSteps.value + }, + }; + configService.set(opts, function(err) { + if (err) $log.debug(err); + }); + }; + + $scope.savePincodeChanges = function(val) { + if (!val || val.length < 4) { + $scope.usePincode = { + value: false + } + return; + } + var opts = { + usePincode: { + enabled: $scope.usePincode.enabled }, }; configService.set(opts, function(err) { @@ -50,6 +69,18 @@ angular.module('copayApp.controllers').controller('advancedSettingsController', }); }; + $scope.showPincodeModal = function() { + $scope.fromSettings = true; + $ionicModal.fromTemplateUrl('views/modals/pincode.html', { + scope: $scope, + backdropClickToClose: false, + hardwareBackButtonClose: false + }).then(function(modal) { + $scope.pincodeModal = modal; + $scope.pincodeModal.show(); + }); + }; + $scope.$on("$ionicView.beforeEnter", function(event, data) { updateConfig(); }); diff --git a/src/js/controllers/pincode.js b/src/js/controllers/pincode.js index 448ed58fa..53c3da987 100644 --- a/src/js/controllers/pincode.js +++ b/src/js/controllers/pincode.js @@ -41,10 +41,16 @@ angular.module('copayApp.controllers').controller('pincodeController', function( }; function checkPasscode() { + console.log('Checking'); configService.whenAvailable(function(config) { var value = '1234'; if (value != $scope.pincode) return; console.log('MATCH'); }); }; + + $scope.cancel = function() { + $scope.savePincodeChanges(false); + $scope.pincodeModal.hide(); + }; }); diff --git a/src/js/controllers/tab-home.js b/src/js/controllers/tab-home.js index 8abcb08d2..00566a01f 100644 --- a/src/js/controllers/tab-home.js +++ b/src/js/controllers/tab-home.js @@ -25,7 +25,7 @@ angular.module('copayApp.controllers').controller('tabHomeController', $scope.pincodeModal.show(); }); }; - openPincodeModal(); + // openPincodeModal(); $scope.$on("$ionicView.afterEnter", function() { startupService.ready(); }); diff --git a/src/js/services/configService.js b/src/js/services/configService.js index 1a16992fb..9e1a54319 100644 --- a/src/js/services/configService.js +++ b/src/js/services/configService.js @@ -54,6 +54,7 @@ angular.module('copayApp.services').factory('configService', function(storageSer }, pincode: { + enabled: false, value: null, }, diff --git a/src/sass/views/pincode.scss b/src/sass/views/pincode.scss index 97413fc47..040d0113a 100644 --- a/src/sass/views/pincode.scss +++ b/src/sass/views/pincode.scss @@ -1,6 +1,9 @@ #pin-code { background-color: #C3C3C3; - + .close { + cursor: pointer; + padding: .5rem; + } .button-stretch { width: 100%; } @@ -15,6 +18,7 @@ } .content { position: absolute; + text-align: center; width: 100%; height: 100%; .block-code { diff --git a/www/views/advancedSettings.html b/www/views/advancedSettings.html index 9905fdec2..26566061b 100644 --- a/www/views/advancedSettings.html +++ b/www/views/advancedSettings.html @@ -13,7 +13,7 @@
If enabled, wallets will also try to spend unconfirmed funds. This option may cause transaction delays.
- +
@@ -28,6 +28,12 @@ Hide Next Steps Card + +
+ + + Use pin to lock/unlock the app +
diff --git a/www/views/modals/pincode.html b/www/views/modals/pincode.html index aeee3a3dc..ab75264e7 100644 --- a/www/views/modals/pincode.html +++ b/www/views/modals/pincode.html @@ -1,4 +1,5 @@ +
Close
@@ -52,13 +53,13 @@
- +
- +
From 313269a45c9950e477a43af06e97109ba122892d Mon Sep 17 00:00:00 2001 From: JDonadio Date: Wed, 1 Mar 2017 17:29:39 -0300 Subject: [PATCH 14/83] add pincode service - refactor --- src/js/controllers/advancedSettings.js | 44 ++++++++-------------- src/js/controllers/pincode.js | 51 +++++++++++++++++--------- src/js/services/pincodeService.js | 32 ++++++++++++++++ www/views/advancedSettings.html | 2 +- www/views/modals/pincode.html | 4 +- 5 files changed, 85 insertions(+), 48 deletions(-) create mode 100644 src/js/services/pincodeService.js diff --git a/src/js/controllers/advancedSettings.js b/src/js/controllers/advancedSettings.js index 826ae3c81..a34e6b749 100644 --- a/src/js/controllers/advancedSettings.js +++ b/src/js/controllers/advancedSettings.js @@ -1,6 +1,6 @@ 'use strict'; -angular.module('copayApp.controllers').controller('advancedSettingsController', function($scope, $rootScope, $log, $window, $ionicModal, lodash, configService, uxLanguage, platformInfo, pushNotificationsService, profileService, feeService, storageService, $ionicHistory, $timeout, $ionicScrollDelegate) { +angular.module('copayApp.controllers').controller('advancedSettingsController', function($scope, $rootScope, $log, $window, $ionicModal, lodash, configService, uxLanguage, platformInfo, pushNotificationsService, profileService, feeService, storageService, $ionicHistory, $ionicScrollDelegate, pincodeService) { var updateConfig = function() { var config = configService.getSync(); @@ -15,7 +15,7 @@ angular.module('copayApp.controllers').controller('advancedSettingsController', value: config.hideNextSteps.enabled }; $scope.usePincode = { - value: config.pincode ? config.pincode.enabled : false + enabled: config.pincode ? config.pincode.enabled : false }; }; @@ -41,23 +41,6 @@ angular.module('copayApp.controllers').controller('advancedSettingsController', }); }; - $scope.savePincodeChanges = function(val) { - if (!val || val.length < 4) { - $scope.usePincode = { - value: false - } - return; - } - var opts = { - usePincode: { - enabled: $scope.usePincode.enabled - }, - }; - configService.set(opts, function(err) { - if (err) $log.debug(err); - }); - }; - $scope.recentTransactionsChange = function() { var opts = { recentTransactions: { @@ -69,15 +52,20 @@ angular.module('copayApp.controllers').controller('advancedSettingsController', }); }; - $scope.showPincodeModal = function() { - $scope.fromSettings = true; - $ionicModal.fromTemplateUrl('views/modals/pincode.html', { - scope: $scope, - backdropClickToClose: false, - hardwareBackButtonClose: false - }).then(function(modal) { - $scope.pincodeModal = modal; - $scope.pincodeModal.show(); + $scope.usePincodeChange = function() { + var opts = {}; + opts.enabled = $scope.usePincode.enabled; + opts.from = 'settings'; + + pincodeService.lockChange(opts, function(err) { + if (err) { + $log.warn(err); + + // ToDo show error? + $scope.usePincode.enabled = false; + $scope.$apply(); + return; + } }); }; diff --git a/src/js/controllers/pincode.js b/src/js/controllers/pincode.js index 53c3da987..d7beadfa4 100644 --- a/src/js/controllers/pincode.js +++ b/src/js/controllers/pincode.js @@ -1,7 +1,11 @@ 'use strict'; angular.module('copayApp.controllers').controller('pincodeController', function($timeout, $scope, $log, $window, configService) { - $scope.pincode = ''; + var config = configService.getSync(); + $scope.currentPincode = config.pincode ? config.pincode.value : null; + $scope.pincode = $scope.pc1 = $scope.pc2 = ''; + + console.log('#######', $scope.from, $scope.enabled); angular.element($window).on('keydown', function(e) { if (e.which === 8) { // you can add others here inside brackets. @@ -9,15 +13,16 @@ angular.module('copayApp.controllers').controller('pincodeController', function( $scope.delete(); } - if (e.key && e.key.match(/^[0-9]$/)) + if (e && e.key.match(/^[0-9]$/)) $scope.add(e.key); - else if (e.key && e.key == 'Enter') - checkPasscode(); + else if (e && e.keyCode == 27) + $scope.close(false); + else if (e && e.keyCode == 13) + $scope.save(); }); $scope.add = function(value) { - if (isComplete()) checkPasscode(); - else updatePassCode(value); + updatePassCode(value); }; $scope.delete = function() { @@ -33,24 +38,36 @@ angular.module('copayApp.controllers').controller('pincodeController', function( }; function updatePassCode(value) { - if (value) $scope.pincode = $scope.pincode + value; + if (value && $scope.pincode.length < 4) + $scope.pincode = $scope.pincode + value; $timeout(function() { - checkPasscode(); $scope.$apply(); }); }; - function checkPasscode() { - console.log('Checking'); - configService.whenAvailable(function(config) { - var value = '1234'; - if (value != $scope.pincode) return; - console.log('MATCH'); - }); + $scope.save = function() { + if (!$scope.pc1) { + console.log('No pc 1'); + $scope.pc1 = $scope.pincode; + console.log('$scope.pc1', $scope.pc1); + $scope.pincode = ''; + $timeout(function() { + $scope.$apply(); + }); + return; + } else { + $scope.pc2 = $scope.pincode; + console.log('$scope.pc2', $scope.pc2); + } + + if ($scope.pc1 == $scope.pc2) { + $scope.close($scope.pc1); + } else { + $scope.enabled ? pincodeService.lockApp() : pincodeService.unlockApp(); + } }; - $scope.cancel = function() { - $scope.savePincodeChanges(false); + $scope.close = function() { $scope.pincodeModal.hide(); }; }); diff --git a/src/js/services/pincodeService.js b/src/js/services/pincodeService.js new file mode 100644 index 000000000..d6b244e20 --- /dev/null +++ b/src/js/services/pincodeService.js @@ -0,0 +1,32 @@ +'use strict'; + +angular.module('copayApp.services').factory('pincodeService', function($log, $rootScope, $ionicModal, configService) { + var root = {}; + + var openPincodeModal = function(opts) { + var scope = $rootScope.$new(true); + scope.from = opts.from; + scope.enabled = opts.enabled; + $ionicModal.fromTemplateUrl('views/modals/pincode.html', { + scope: scope, + backdropClickToClose: false, + hardwareBackButtonClose: false + }).then(function(modal) { + scope.pincodeModal = modal; + scope.pincodeModal.show(); + }); + }; + + root.lockChange = function(opts, cb) { + if (opts.enabled) console.log('Locking app from service'); + else console.log('Unlocking app from service'); + openPincodeModal(opts); + }; + + root.isLocked = function() { + var config = configService.getSync(); + return config.pincode ? config.pincode.enabled : false; + }; + + return root; +}); diff --git a/www/views/advancedSettings.html b/www/views/advancedSettings.html index 26566061b..8a8208587 100644 --- a/www/views/advancedSettings.html +++ b/www/views/advancedSettings.html @@ -31,7 +31,7 @@
- + Use pin to lock/unlock the app
diff --git a/www/views/modals/pincode.html b/www/views/modals/pincode.html index ab75264e7..8dce84143 100644 --- a/www/views/modals/pincode.html +++ b/www/views/modals/pincode.html @@ -1,5 +1,5 @@ -
Close
+
Close
@@ -53,7 +53,7 @@
- +
From 34413278ec08028214e75759c3f211d1dea39fcb Mon Sep 17 00:00:00 2001 From: JDonadio Date: Thu, 2 Mar 2017 11:25:38 -0300 Subject: [PATCH 15/83] update option if enabled/disabled --- src/js/controllers/advancedSettings.js | 27 +++++++++++++------------- src/js/controllers/pincode.js | 15 ++++++++------ src/js/services/pincodeService.js | 2 +- 3 files changed, 23 insertions(+), 21 deletions(-) diff --git a/src/js/controllers/advancedSettings.js b/src/js/controllers/advancedSettings.js index a34e6b749..e2ac64fab 100644 --- a/src/js/controllers/advancedSettings.js +++ b/src/js/controllers/advancedSettings.js @@ -1,6 +1,6 @@ 'use strict'; -angular.module('copayApp.controllers').controller('advancedSettingsController', function($scope, $rootScope, $log, $window, $ionicModal, lodash, configService, uxLanguage, platformInfo, pushNotificationsService, profileService, feeService, storageService, $ionicHistory, $ionicScrollDelegate, pincodeService) { +angular.module('copayApp.controllers').controller('advancedSettingsController', function($scope, $rootScope, $timeout, $log, $window, $ionicModal, lodash, configService, uxLanguage, platformInfo, pushNotificationsService, profileService, feeService, storageService, $ionicHistory, $ionicScrollDelegate, pincodeService) { var updateConfig = function() { var config = configService.getSync(); @@ -53,22 +53,21 @@ angular.module('copayApp.controllers').controller('advancedSettingsController', }; $scope.usePincodeChange = function() { - var opts = {}; - opts.enabled = $scope.usePincode.enabled; - opts.from = 'settings'; - - pincodeService.lockChange(opts, function(err) { - if (err) { - $log.warn(err); - - // ToDo show error? - $scope.usePincode.enabled = false; - $scope.$apply(); - return; - } + pincodeService.lockChange({ + enabled: $scope.usePincode.enabled, + from: 'settings' }); }; + $rootScope.$on('updatePincodeOption', function(event) { + console.log('ON'); + var config = configService.getSync(); + $scope.usePincode = { + enabled: config.pincode ? config.pincode.enabled : false + }; + $scope.$apply(); + }); + $scope.$on("$ionicView.beforeEnter", function(event, data) { updateConfig(); }); diff --git a/src/js/controllers/pincode.js b/src/js/controllers/pincode.js index d7beadfa4..bf1391b1c 100644 --- a/src/js/controllers/pincode.js +++ b/src/js/controllers/pincode.js @@ -1,14 +1,12 @@ 'use strict'; -angular.module('copayApp.controllers').controller('pincodeController', function($timeout, $scope, $log, $window, configService) { +angular.module('copayApp.controllers').controller('pincodeController', function($rootScope, $timeout, $scope, $log, $window, configService) { var config = configService.getSync(); $scope.currentPincode = config.pincode ? config.pincode.value : null; - $scope.pincode = $scope.pc1 = $scope.pc2 = ''; - - console.log('#######', $scope.from, $scope.enabled); + $scope.pincode = $scope.pc1 = $scope.pc2 = null; angular.element($window).on('keydown', function(e) { - if (e.which === 8) { // you can add others here inside brackets. + if (e.which === 8) { e.preventDefault(); $scope.delete(); } @@ -16,7 +14,7 @@ angular.module('copayApp.controllers').controller('pincodeController', function( if (e && e.key.match(/^[0-9]$/)) $scope.add(e.key); else if (e && e.keyCode == 27) - $scope.close(false); + $scope.cancel(); else if (e && e.keyCode == 13) $scope.save(); }); @@ -70,4 +68,9 @@ angular.module('copayApp.controllers').controller('pincodeController', function( $scope.close = function() { $scope.pincodeModal.hide(); }; + + $scope.cancel = function() { + $rootScope.$emit('updatePincodeOption', false); + $scope.close(); + }; }); diff --git a/src/js/services/pincodeService.js b/src/js/services/pincodeService.js index d6b244e20..ab69e5e94 100644 --- a/src/js/services/pincodeService.js +++ b/src/js/services/pincodeService.js @@ -17,7 +17,7 @@ angular.module('copayApp.services').factory('pincodeService', function($log, $ro }); }; - root.lockChange = function(opts, cb) { + root.lockChange = function(opts) { if (opts.enabled) console.log('Locking app from service'); else console.log('Unlocking app from service'); openPincodeModal(opts); From e5ecc111f3320fdfbcc8314c600ec369c284623a Mon Sep 17 00:00:00 2001 From: JDonadio Date: Thu, 2 Mar 2017 16:32:08 -0300 Subject: [PATCH 16/83] set lock/unlock properly --- src/js/controllers/advancedSettings.js | 17 ++++--- src/js/controllers/pincode.js | 68 ++++++++++++++------------ src/js/services/configService.js | 2 +- src/js/services/pincodeService.js | 10 +--- www/views/modals/pincode.html | 8 +-- 5 files changed, 54 insertions(+), 51 deletions(-) diff --git a/src/js/controllers/advancedSettings.js b/src/js/controllers/advancedSettings.js index e2ac64fab..0a678b27d 100644 --- a/src/js/controllers/advancedSettings.js +++ b/src/js/controllers/advancedSettings.js @@ -54,18 +54,19 @@ angular.module('copayApp.controllers').controller('advancedSettingsController', $scope.usePincodeChange = function() { pincodeService.lockChange({ - enabled: $scope.usePincode.enabled, - from: 'settings' + from: 'settings', + locking: $scope.usePincode.enabled }); }; $rootScope.$on('updatePincodeOption', function(event) { - console.log('ON'); - var config = configService.getSync(); - $scope.usePincode = { - enabled: config.pincode ? config.pincode.enabled : false - }; - $scope.$apply(); + $timeout(function() { + var config = configService.getSync(); + $scope.usePincode = { + enabled: config.pincode ? config.pincode.enabled : false + }; + $scope.$apply(); + }); }); $scope.$on("$ionicView.beforeEnter", function(event, data) { diff --git a/src/js/controllers/pincode.js b/src/js/controllers/pincode.js index bf1391b1c..69c1c656c 100644 --- a/src/js/controllers/pincode.js +++ b/src/js/controllers/pincode.js @@ -1,9 +1,7 @@ 'use strict'; angular.module('copayApp.controllers').controller('pincodeController', function($rootScope, $timeout, $scope, $log, $window, configService) { - var config = configService.getSync(); - $scope.currentPincode = config.pincode ? config.pincode.value : null; - $scope.pincode = $scope.pc1 = $scope.pc2 = null; + $scope.currentPincode = $scope.newPincode = ''; angular.element($window).on('keydown', function(e) { if (e.which === 8) { @@ -14,7 +12,7 @@ angular.module('copayApp.controllers').controller('pincodeController', function( if (e && e.key.match(/^[0-9]$/)) $scope.add(e.key); else if (e && e.keyCode == 27) - $scope.cancel(); + $scope.close(); else if (e && e.keyCode == 13) $scope.save(); }); @@ -24,53 +22,63 @@ angular.module('copayApp.controllers').controller('pincodeController', function( }; $scope.delete = function() { - if ($scope.pincode.length > 0) { - $scope.pincode = $scope.pincode.substring(0, $scope.pincode.length - 1); + if ($scope.currentPincode.length > 0) { + $scope.currentPincode = $scope.currentPincode.substring(0, $scope.currentPincode.length - 1); updatePassCode(); } }; function isComplete() { - if ($scope.pincode.length < 4) return false; + if ($scope.currentPincode.length < 4) return false; else return true; }; function updatePassCode(value) { - if (value && $scope.pincode.length < 4) - $scope.pincode = $scope.pincode + value; + if (value && $scope.currentPincode.length < 4) + $scope.currentPincode = $scope.currentPincode + value; $timeout(function() { $scope.$apply(); }); }; $scope.save = function() { - if (!$scope.pc1) { - console.log('No pc 1'); - $scope.pc1 = $scope.pincode; - console.log('$scope.pc1', $scope.pc1); - $scope.pincode = ''; - $timeout(function() { - $scope.$apply(); - }); - return; - } else { - $scope.pc2 = $scope.pincode; - console.log('$scope.pc2', $scope.pc2); - } + if (!isComplete()) return; + var config = configService.getSync(); + var match = config.pincode.value == $scope.currentPincode ? true : false; - if ($scope.pc1 == $scope.pc2) { - $scope.close($scope.pc1); + if (!$scope.locking && !match) return; + checkCodes(); + }; + + function checkCodes() { + if (!$scope.newPincode) { + $scope.newPincode = $scope.currentPincode; + $scope.currentPincode = ''; } else { - $scope.enabled ? pincodeService.lockApp() : pincodeService.unlockApp(); + if ($scope.newPincode == $scope.currentPincode) + saveSettings($scope.locking, $scope.newPincode); } + $timeout(function() { + $scope.$apply(); + }); + }; + + function saveSettings(enabled, value) { + var opts = { + pincode: { + enabled: enabled, + value: value + } + }; + + configService.set(opts, function(err) { + if (err) $log.debug(err); + $scope.close(); + }); }; $scope.close = function() { + $rootScope.$emit('updatePincodeOption'); $scope.pincodeModal.hide(); }; - - $scope.cancel = function() { - $rootScope.$emit('updatePincodeOption', false); - $scope.close(); - }; }); diff --git a/src/js/services/configService.js b/src/js/services/configService.js index 9e1a54319..30522da04 100644 --- a/src/js/services/configService.js +++ b/src/js/services/configService.js @@ -55,7 +55,7 @@ angular.module('copayApp.services').factory('configService', function(storageSer pincode: { enabled: false, - value: null, + value: '', }, // External services diff --git a/src/js/services/pincodeService.js b/src/js/services/pincodeService.js index ab69e5e94..15f20420e 100644 --- a/src/js/services/pincodeService.js +++ b/src/js/services/pincodeService.js @@ -3,10 +3,10 @@ angular.module('copayApp.services').factory('pincodeService', function($log, $rootScope, $ionicModal, configService) { var root = {}; - var openPincodeModal = function(opts) { + root.lockChange = function(opts) { var scope = $rootScope.$new(true); scope.from = opts.from; - scope.enabled = opts.enabled; + scope.locking = opts.locking; $ionicModal.fromTemplateUrl('views/modals/pincode.html', { scope: scope, backdropClickToClose: false, @@ -17,12 +17,6 @@ angular.module('copayApp.services').factory('pincodeService', function($log, $ro }); }; - root.lockChange = function(opts) { - if (opts.enabled) console.log('Locking app from service'); - else console.log('Unlocking app from service'); - openPincodeModal(opts); - }; - root.isLocked = function() { var config = configService.getSync(); return config.pincode ? config.pincode.enabled : false; diff --git a/www/views/modals/pincode.html b/www/views/modals/pincode.html index 8dce84143..78790b052 100644 --- a/www/views/modals/pincode.html +++ b/www/views/modals/pincode.html @@ -4,16 +4,16 @@
- {{pincode.substring(0, 1)}} + {{currentPincode.substring(0, 1)}}
- {{pincode.substring(1, 2)}} + {{currentPincode.substring(1, 2)}}
- {{pincode.substring(2, 3)}} + {{currentPincode.substring(2, 3)}}
- {{pincode.substring(3, 4)}} + {{currentPincode.substring(3, 4)}}
From 6419342c4b877e7894d8d1f3867d9c0b6eff1c2e Mon Sep 17 00:00:00 2001 From: JDonadio Date: Thu, 2 Mar 2017 16:49:07 -0300 Subject: [PATCH 17/83] show lock screen at start --- src/js/controllers/advancedSettings.js | 2 +- src/js/controllers/tab-home.js | 11 ----------- src/js/routes.js | 11 ++++++++++- src/js/services/pincodeService.js | 2 +- www/views/modals/pincode.html | 2 +- 5 files changed, 13 insertions(+), 15 deletions(-) diff --git a/src/js/controllers/advancedSettings.js b/src/js/controllers/advancedSettings.js index 0a678b27d..60f32b9e9 100644 --- a/src/js/controllers/advancedSettings.js +++ b/src/js/controllers/advancedSettings.js @@ -54,7 +54,7 @@ angular.module('copayApp.controllers').controller('advancedSettingsController', $scope.usePincodeChange = function() { pincodeService.lockChange({ - from: 'settings', + fromSettings: true, locking: $scope.usePincode.enabled }); }; diff --git a/src/js/controllers/tab-home.js b/src/js/controllers/tab-home.js index 00566a01f..7a3fd83f8 100644 --- a/src/js/controllers/tab-home.js +++ b/src/js/controllers/tab-home.js @@ -15,17 +15,6 @@ angular.module('copayApp.controllers').controller('tabHomeController', $scope.isNW = platformInfo.isNW; $scope.showRateCard = {}; - function openPincodeModal() { - $ionicModal.fromTemplateUrl('views/modals/pincode.html', { - scope: $scope, - backdropClickToClose: false, - hardwareBackButtonClose: false - }).then(function(modal) { - $scope.pincodeModal = modal; - $scope.pincodeModal.show(); - }); - }; - // openPincodeModal(); $scope.$on("$ionicView.afterEnter", function() { startupService.ready(); }); diff --git a/src/js/routes.js b/src/js/routes.js index 4fc657bd4..2f9e02317 100644 --- a/src/js/routes.js +++ b/src/js/routes.js @@ -1091,11 +1091,20 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr } }); }) - .run(function($rootScope, $state, $location, $log, $timeout, $ionicHistory, $ionicPlatform, $window, appConfigService, lodash, platformInfo, profileService, uxLanguage, gettextCatalog, openURLService, storageService, scannerService, /* plugins START HERE => */ coinbaseService, glideraService, amazonService, bitpayCardService) { + .run(function($rootScope, $state, $location, $log, $timeout, $ionicHistory, $ionicPlatform, $window, appConfigService, lodash, platformInfo, profileService, uxLanguage, gettextCatalog, openURLService, storageService, scannerService, configService, pincodeService, /* plugins START HERE => */ coinbaseService, glideraService, amazonService, bitpayCardService) { uxLanguage.init(); $ionicPlatform.ready(function() { + configService.whenAvailable(function(config) { + if (config.pincode && config.pincode.enabled) { + pincodeService.lockChange({ + fromSettings: false, + locking: false, + }); + } + }); + if (screen.width < 768 && platformInfo.isCordova) screen.lockOrientation('portrait'); diff --git a/src/js/services/pincodeService.js b/src/js/services/pincodeService.js index 15f20420e..fea790bca 100644 --- a/src/js/services/pincodeService.js +++ b/src/js/services/pincodeService.js @@ -5,7 +5,7 @@ angular.module('copayApp.services').factory('pincodeService', function($log, $ro root.lockChange = function(opts) { var scope = $rootScope.$new(true); - scope.from = opts.from; + scope.fromSettings = opts.fromSettings; scope.locking = opts.locking; $ionicModal.fromTemplateUrl('views/modals/pincode.html', { scope: scope, diff --git a/www/views/modals/pincode.html b/www/views/modals/pincode.html index 78790b052..765d374a7 100644 --- a/www/views/modals/pincode.html +++ b/www/views/modals/pincode.html @@ -1,5 +1,5 @@ -
Close
+
Close
From 0e9b39a5107e788d81c538c94f857551510e0d3b Mon Sep 17 00:00:00 2001 From: JDonadio Date: Thu, 2 Mar 2017 16:54:55 -0300 Subject: [PATCH 18/83] unlock the app with first match --- src/js/controllers/pincode.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/js/controllers/pincode.js b/src/js/controllers/pincode.js index 69c1c656c..c676a7d6e 100644 --- a/src/js/controllers/pincode.js +++ b/src/js/controllers/pincode.js @@ -46,7 +46,15 @@ angular.module('copayApp.controllers').controller('pincodeController', function( var config = configService.getSync(); var match = config.pincode.value == $scope.currentPincode ? true : false; - if (!$scope.locking && !match) return; + if (!$scope.fromSettings && match) { + $scope.currentPincode = ''; + $scope.close(); + return; + } + if (!$scope.locking) { + if (!match) return; + saveSettings($scope.locking, ''); + } checkCodes(); }; @@ -79,6 +87,6 @@ angular.module('copayApp.controllers').controller('pincodeController', function( $scope.close = function() { $rootScope.$emit('updatePincodeOption'); - $scope.pincodeModal.hide(); + $scope.pincodeModal.remove(); }; }); From 93168cdae69c75ee548cf725dc4bc691c056d886 Mon Sep 17 00:00:00 2001 From: JDonadio Date: Fri, 3 Mar 2017 14:18:56 -0300 Subject: [PATCH 19/83] views instead modal --- src/js/controllers/advancedSettings.js | 8 +++-- src/js/controllers/pincode.js | 13 +++++-- src/js/routes.js | 48 +++++++++++++++++++------- www/views/{modals => }/pincode.html | 2 +- 4 files changed, 52 insertions(+), 19 deletions(-) rename www/views/{modals => }/pincode.html (96%) diff --git a/src/js/controllers/advancedSettings.js b/src/js/controllers/advancedSettings.js index 60f32b9e9..7b9a201dd 100644 --- a/src/js/controllers/advancedSettings.js +++ b/src/js/controllers/advancedSettings.js @@ -1,6 +1,6 @@ 'use strict'; -angular.module('copayApp.controllers').controller('advancedSettingsController', function($scope, $rootScope, $timeout, $log, $window, $ionicModal, lodash, configService, uxLanguage, platformInfo, pushNotificationsService, profileService, feeService, storageService, $ionicHistory, $ionicScrollDelegate, pincodeService) { +angular.module('copayApp.controllers').controller('advancedSettingsController', function($scope, $rootScope, $timeout, $state, $log, $window, $ionicModal, lodash, configService, uxLanguage, platformInfo, pushNotificationsService, profileService, feeService, storageService, $ionicHistory, $ionicScrollDelegate, pincodeService) { var updateConfig = function() { var config = configService.getSync(); @@ -53,7 +53,11 @@ angular.module('copayApp.controllers').controller('advancedSettingsController', }; $scope.usePincodeChange = function() { - pincodeService.lockChange({ + // pincodeService.lockChange({ + // fromSettings: true, + // locking: $scope.usePincode.enabled + // }); + $state.go('tabs.pincode', { fromSettings: true, locking: $scope.usePincode.enabled }); diff --git a/src/js/controllers/pincode.js b/src/js/controllers/pincode.js index c676a7d6e..f9d4831b7 100644 --- a/src/js/controllers/pincode.js +++ b/src/js/controllers/pincode.js @@ -1,7 +1,13 @@ 'use strict'; -angular.module('copayApp.controllers').controller('pincodeController', function($rootScope, $timeout, $scope, $log, $window, configService) { - $scope.currentPincode = $scope.newPincode = ''; +angular.module('copayApp.controllers').controller('pincodeController', function($rootScope, $state, $timeout, $scope, $log, $window, configService) { + + $scope.$on("$ionicView.beforeEnter", function(event, data) { + $scope.currentPincode = $scope.newPincode = ''; + $scope.fromSettings = data.stateParams.fromSettings == 'true' ? true : false; + $scope.locking = data.stateParams.locking == 'true' ? true : false; + console.log('### From Settings:', $scope.fromSettings, 'Locking:', $scope.locking); + }); angular.element($window).on('keydown', function(e) { if (e.which === 8) { @@ -87,6 +93,7 @@ angular.module('copayApp.controllers').controller('pincodeController', function( $scope.close = function() { $rootScope.$emit('updatePincodeOption'); - $scope.pincodeModal.remove(); + if ($scope.fromSettings) $state.go('tabs.advanced'); + else $state.go('tabs.home'); }; }); diff --git a/src/js/routes.js b/src/js/routes.js index 2f9e02317..249d7bd85 100644 --- a/src/js/routes.js +++ b/src/js/routes.js @@ -119,6 +119,18 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr } }) + /* + * + * Pin code + * + */ + + .state('pincode', { + url: '/pincode/:fromSettings/:locking', + controller: 'pincodeController', + templateUrl: 'views/pincode.html' + }) + /* * * URI @@ -439,6 +451,15 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr } } }) + .state('tabs.pincode', { + url: '/pincode/:fromSettings/:locking', + views: { + 'tab-settings@tabs': { + controller: 'pincodeController', + templateUrl: 'views/pincode.html', + } + } + }) /* * @@ -1091,20 +1112,11 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr } }); }) - .run(function($rootScope, $state, $location, $log, $timeout, $ionicHistory, $ionicPlatform, $window, appConfigService, lodash, platformInfo, profileService, uxLanguage, gettextCatalog, openURLService, storageService, scannerService, configService, pincodeService, /* plugins START HERE => */ coinbaseService, glideraService, amazonService, bitpayCardService) { + .run(function($rootScope, $state, $location, $log, $timeout, $ionicHistory, $ionicPlatform, $window, appConfigService, lodash, platformInfo, profileService, uxLanguage, gettextCatalog, openURLService, storageService, scannerService, configService, /* plugins START HERE => */ coinbaseService, glideraService, amazonService, bitpayCardService) { uxLanguage.init(); $ionicPlatform.ready(function() { - configService.whenAvailable(function(config) { - if (config.pincode && config.pincode.enabled) { - pincodeService.lockChange({ - fromSettings: false, - locking: false, - }); - } - }); - if (screen.width < 768 && platformInfo.isCordova) screen.lockOrientation('portrait'); @@ -1205,9 +1217,19 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr disableAnimate: true, historyRoot: true }); - $state.transitionTo('tabs.home').then(function() { - // Clear history - $ionicHistory.clearHistory(); + configService.whenAvailable(function(config) { + console.log('### CONFIG', config.pincode); + if (config.pincode && config.pincode.enabled) { + $state.go('pincode', { + fromSettings: false, + locking: false + }); + } else { + $state.transitionTo('tabs.home').then(function() { + // Clear history + $ionicHistory.clearHistory(); + }); + } }); }); } diff --git a/www/views/modals/pincode.html b/www/views/pincode.html similarity index 96% rename from www/views/modals/pincode.html rename to www/views/pincode.html index 765d374a7..5f8f75a4d 100644 --- a/www/views/modals/pincode.html +++ b/www/views/pincode.html @@ -1,4 +1,4 @@ - +
Close
From e89847af559346438ead2539185056e01d1a12cb Mon Sep 17 00:00:00 2001 From: JDonadio Date: Mon, 6 Mar 2017 12:45:37 -0300 Subject: [PATCH 20/83] refactor - only mobile --- src/js/controllers/advancedSettings.js | 21 ++++----- src/js/controllers/pincode.js | 61 ++++++++++---------------- src/js/routes.js | 17 +++---- www/views/advancedSettings.html | 2 +- www/views/pincode.html | 29 +++++++----- 5 files changed, 58 insertions(+), 72 deletions(-) diff --git a/src/js/controllers/advancedSettings.js b/src/js/controllers/advancedSettings.js index 7b9a201dd..934adddfe 100644 --- a/src/js/controllers/advancedSettings.js +++ b/src/js/controllers/advancedSettings.js @@ -1,6 +1,6 @@ 'use strict'; -angular.module('copayApp.controllers').controller('advancedSettingsController', function($scope, $rootScope, $timeout, $state, $log, $window, $ionicModal, lodash, configService, uxLanguage, platformInfo, pushNotificationsService, profileService, feeService, storageService, $ionicHistory, $ionicScrollDelegate, pincodeService) { +angular.module('copayApp.controllers').controller('advancedSettingsController', function($scope, $timeout, $state, $log, $window, $ionicModal, lodash, configService, uxLanguage, platformInfo, pushNotificationsService, profileService, feeService, storageService, $ionicHistory, $ionicScrollDelegate, pincodeService) { var updateConfig = function() { var config = configService.getSync(); @@ -53,27 +53,22 @@ angular.module('copayApp.controllers').controller('advancedSettingsController', }; $scope.usePincodeChange = function() { - // pincodeService.lockChange({ - // fromSettings: true, - // locking: $scope.usePincode.enabled - // }); $state.go('tabs.pincode', { fromSettings: true, locking: $scope.usePincode.enabled }); }; - $rootScope.$on('updatePincodeOption', function(event) { - $timeout(function() { - var config = configService.getSync(); - $scope.usePincode = { - enabled: config.pincode ? config.pincode.enabled : false - }; - $scope.$apply(); - }); + $scope.$on('updatePincodeOption', function(event) { + var config = configService.getSync(); + $scope.usePincode = { + enabled: config.pincode ? config.pincode.enabled : false + }; + $scope.$apply(); }); $scope.$on("$ionicView.beforeEnter", function(event, data) { + $scope.isCordova = platformInfo.isCordova; updateConfig(); }); diff --git a/src/js/controllers/pincode.js b/src/js/controllers/pincode.js index f9d4831b7..35c888ed6 100644 --- a/src/js/controllers/pincode.js +++ b/src/js/controllers/pincode.js @@ -1,36 +1,17 @@ 'use strict'; -angular.module('copayApp.controllers').controller('pincodeController', function($rootScope, $state, $timeout, $scope, $log, $window, configService) { +angular.module('copayApp.controllers').controller('pincodeController', function($state, $stateParams, $timeout, $scope, $log, $window, configService) { - $scope.$on("$ionicView.beforeEnter", function(event, data) { + $scope.$on("$ionicView.beforeEnter", function(event) { $scope.currentPincode = $scope.newPincode = ''; - $scope.fromSettings = data.stateParams.fromSettings == 'true' ? true : false; - $scope.locking = data.stateParams.locking == 'true' ? true : false; - console.log('### From Settings:', $scope.fromSettings, 'Locking:', $scope.locking); + $scope.fromSettings = $stateParams.fromSettings == 'true' ? true : false; + $scope.locking = $stateParams.locking == 'true' ? true : false; }); - angular.element($window).on('keydown', function(e) { - if (e.which === 8) { - e.preventDefault(); - $scope.delete(); - } - - if (e && e.key.match(/^[0-9]$/)) - $scope.add(e.key); - else if (e && e.keyCode == 27) - $scope.close(); - else if (e && e.keyCode == 13) - $scope.save(); - }); - - $scope.add = function(value) { - updatePassCode(value); - }; - $scope.delete = function() { if ($scope.currentPincode.length > 0) { $scope.currentPincode = $scope.currentPincode.substring(0, $scope.currentPincode.length - 1); - updatePassCode(); + $scope.updatePinCode(); } }; @@ -39,12 +20,18 @@ angular.module('copayApp.controllers').controller('pincodeController', function( else return true; }; - function updatePassCode(value) { - if (value && $scope.currentPincode.length < 4) + $scope.updatePinCode = function(value) { + if (value && !isComplete()) { $scope.currentPincode = $scope.currentPincode + value; + } $timeout(function() { $scope.$apply(); }); + if (!$scope.locking && isComplete()) { + $timeout(function() { + $scope.save(); + }); + } }; $scope.save = function() { @@ -52,29 +39,27 @@ angular.module('copayApp.controllers').controller('pincodeController', function( var config = configService.getSync(); var match = config.pincode.value == $scope.currentPincode ? true : false; - if (!$scope.fromSettings && match) { - $scope.currentPincode = ''; - $scope.close(); - return; - } if (!$scope.locking) { - if (!match) return; - saveSettings($scope.locking, ''); + if (match) { + $scope.fromSettings ? saveSettings($scope.locking, '') : $scope.close(); + return; + } + } else { + checkCodes(); } - checkCodes(); }; function checkCodes() { if (!$scope.newPincode) { $scope.newPincode = $scope.currentPincode; $scope.currentPincode = ''; + $timeout(function() { + $scope.$apply(); + }); } else { if ($scope.newPincode == $scope.currentPincode) saveSettings($scope.locking, $scope.newPincode); } - $timeout(function() { - $scope.$apply(); - }); }; function saveSettings(enabled, value) { @@ -92,7 +77,7 @@ angular.module('copayApp.controllers').controller('pincodeController', function( }; $scope.close = function() { - $rootScope.$emit('updatePincodeOption'); + $scope.$emit('updatePincodeOption'); if ($scope.fromSettings) $state.go('tabs.advanced'); else $state.go('tabs.home'); }; diff --git a/src/js/routes.js b/src/js/routes.js index 249d7bd85..31dafd194 100644 --- a/src/js/routes.js +++ b/src/js/routes.js @@ -126,9 +126,9 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr */ .state('pincode', { - url: '/pincode/:fromSettings/:locking', + url: '/pincode/', controller: 'pincodeController', - templateUrl: 'views/pincode.html' + templateUrl: 'views/pincode.html', }) /* @@ -457,6 +457,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr 'tab-settings@tabs': { controller: 'pincodeController', templateUrl: 'views/pincode.html', + cache: false } } }) @@ -1112,7 +1113,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr } }); }) - .run(function($rootScope, $state, $location, $log, $timeout, $ionicHistory, $ionicPlatform, $window, appConfigService, lodash, platformInfo, profileService, uxLanguage, gettextCatalog, openURLService, storageService, scannerService, configService, /* plugins START HERE => */ coinbaseService, glideraService, amazonService, bitpayCardService) { + .run(function($rootScope, $state, $location, $log, $timeout, startupService, $ionicHistory, $ionicPlatform, $window, appConfigService, lodash, platformInfo, profileService, uxLanguage, gettextCatalog, openURLService, storageService, scannerService, configService, /* plugins START HERE => */ coinbaseService, glideraService, amazonService, bitpayCardService) { uxLanguage.init(); @@ -1218,11 +1219,11 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr historyRoot: true }); configService.whenAvailable(function(config) { - console.log('### CONFIG', config.pincode); - if (config.pincode && config.pincode.enabled) { - $state.go('pincode', { - fromSettings: false, - locking: false + startupService.ready(); + if (platformInfo.isCordova && config.pincode && config.pincode.enabled) { + $state.transitionTo('pincode').then(function() { + // Clear history + $ionicHistory.clearHistory(); }); } else { $state.transitionTo('tabs.home').then(function() { diff --git a/www/views/advancedSettings.html b/www/views/advancedSettings.html index 8a8208587..861e325a0 100644 --- a/www/views/advancedSettings.html +++ b/www/views/advancedSettings.html @@ -31,7 +31,7 @@
- + Use pin to lock/unlock the app
diff --git a/www/views/pincode.html b/www/views/pincode.html index 5f8f75a4d..cd8138eaf 100644 --- a/www/views/pincode.html +++ b/www/views/pincode.html @@ -1,4 +1,9 @@ - + + + {{'Pin Code' | translate}} + + +
Close
@@ -20,35 +25,35 @@
- +
- +
- +
- +
- +
- +
- +
- +
- +
@@ -56,7 +61,7 @@
- +
@@ -64,4 +69,4 @@
- + From 5f08ad236b383477115b8a2904b509dea8793781 Mon Sep 17 00:00:00 2001 From: JDonadio Date: Mon, 6 Mar 2017 16:48:21 -0300 Subject: [PATCH 21/83] remove unnecessary event --- src/js/controllers/advancedSettings.js | 8 -------- src/js/controllers/pincode.js | 1 - 2 files changed, 9 deletions(-) diff --git a/src/js/controllers/advancedSettings.js b/src/js/controllers/advancedSettings.js index 934adddfe..a3881b719 100644 --- a/src/js/controllers/advancedSettings.js +++ b/src/js/controllers/advancedSettings.js @@ -59,14 +59,6 @@ angular.module('copayApp.controllers').controller('advancedSettingsController', }); }; - $scope.$on('updatePincodeOption', function(event) { - var config = configService.getSync(); - $scope.usePincode = { - enabled: config.pincode ? config.pincode.enabled : false - }; - $scope.$apply(); - }); - $scope.$on("$ionicView.beforeEnter", function(event, data) { $scope.isCordova = platformInfo.isCordova; updateConfig(); diff --git a/src/js/controllers/pincode.js b/src/js/controllers/pincode.js index 35c888ed6..911c5cd91 100644 --- a/src/js/controllers/pincode.js +++ b/src/js/controllers/pincode.js @@ -77,7 +77,6 @@ angular.module('copayApp.controllers').controller('pincodeController', function( }; $scope.close = function() { - $scope.$emit('updatePincodeOption'); if ($scope.fromSettings) $state.go('tabs.advanced'); else $state.go('tabs.home'); }; From a51151b1d4377ba132be09b28deff44e21128489 Mon Sep 17 00:00:00 2001 From: JDonadio Date: Tue, 7 Mar 2017 11:33:17 -0300 Subject: [PATCH 22/83] apply mocks styling for both distributions --- src/sass/views/pincode.scss | 86 ++++++++++++++++++++++----------- www/views/advancedSettings.html | 10 ++-- www/views/pincode.html | 75 ++++++++++++++-------------- 3 files changed, 100 insertions(+), 71 deletions(-) diff --git a/src/sass/views/pincode.scss b/src/sass/views/pincode.scss index 040d0113a..eeb7bd068 100644 --- a/src/sass/views/pincode.scss +++ b/src/sass/views/pincode.scss @@ -1,40 +1,70 @@ #pin-code { - background-color: #C3C3C3; - .close { - cursor: pointer; - padding: .5rem; - } - .button-stretch { - width: 100%; - } - .col-offset-15 { - margin-left: 15%; - } - @mixin centerer { - position: absolute; - top: 50%; - left: 50%; - transform: translate(-50%, -50%); + background-color: #FAFAFA; + .bar.bar-clear { + background-color: transparent; + border: none; } .content { - position: absolute; text-align: center; width: 100%; height: 100%; - .block-code { - @include centerer; - top: 20% !important; - width: 50%; - > .row > .col { - border-bottom: 1px solid #3E3E3E; - padding: 5px; - margin: 10px; - height: 35px; + .row .col { + margin: 10px; + height: 25px; + } + .app-icon { + margin-top: -55px; + .big-icon-svg { + > .bg { + background-image: url("../img/app/icon.png"); + height: 60px; + width: 60px; + margin: auto; + } } } + .block-text { + align-items: center; + background-color: #F1F1F1; + text-align: center; + height: 30%; + border-bottom: 1px solid #c5c5c5; + span { + width: 60%; + margin: 10% auto; + } + } + .block-code { + width: 300px; + margin: auto; + padding: 0 50px 0 50px; + } .block-buttons { - @include centerer; - padding: 20px; + .row { + padding: 3%; + } + @media (max-height: 480px) { + .row { + padding: 2%; + } + } + cursor: pointer; + position: absolute; + bottom: 3%; + left: 0; + width: 100%; } } + .circle { + border: 1px solid #666666; + border-radius: 50%; + opacity: 0.6; + box-shadow: 0 0 1px 0px rgb( 255, 255, 255); + width: 5px; + height: 5px; + transition: background-color .5s ease-in-out; + } + .filled { + background-color: #666666; + } } diff --git a/www/views/advancedSettings.html b/www/views/advancedSettings.html index 861e325a0..251fd9940 100644 --- a/www/views/advancedSettings.html +++ b/www/views/advancedSettings.html @@ -29,11 +29,13 @@ Hide Next Steps Card -
+
+
- - Use pin to lock/unlock the app - + + Use pin to lock/unlock the app + +
diff --git a/www/views/pincode.html b/www/views/pincode.html index cd8138eaf..9e653e5eb 100644 --- a/www/views/pincode.html +++ b/www/views/pincode.html @@ -1,70 +1,67 @@ - - {{'Pin Code' | translate}} + -
Close
+
Please enter your mobile unlock code
+
Confirm your mobile unlock code
+
+ +
+
+
-
- {{currentPincode.substring(0, 1)}} -
-
- {{currentPincode.substring(1, 2)}} -
-
- {{currentPincode.substring(2, 3)}} -
-
- {{currentPincode.substring(3, 4)}} -
+
+
+
+
-
- +
+
1
-
- +
+
2
-
- +
+
3
-
- +
+
4
-
- +
+
5
-
- +
+
6
-
- +
+
7
-
- +
+
8
-
- +
+
9
-
- +
+
+
+
+
0
- -
-
- +
From 107694cd5863041efe70059fd3d348604f90b4c1 Mon Sep 17 00:00:00 2001 From: JDonadio Date: Tue, 7 Mar 2017 15:39:40 -0300 Subject: [PATCH 23/83] reduce fill color time effect - dark back arrow color --- src/js/controllers/pincode.js | 8 ++++---- src/sass/views/pincode.scss | 5 ++++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/js/controllers/pincode.js b/src/js/controllers/pincode.js index 911c5cd91..dc83d1c50 100644 --- a/src/js/controllers/pincode.js +++ b/src/js/controllers/pincode.js @@ -28,9 +28,7 @@ angular.module('copayApp.controllers').controller('pincodeController', function( $scope.$apply(); }); if (!$scope.locking && isComplete()) { - $timeout(function() { - $scope.save(); - }); + $scope.save(); } }; @@ -72,7 +70,9 @@ angular.module('copayApp.controllers').controller('pincodeController', function( configService.set(opts, function(err) { if (err) $log.debug(err); - $scope.close(); + $timeout(function() { + $scope.close(); + }); }); }; diff --git a/src/sass/views/pincode.scss b/src/sass/views/pincode.scss index eeb7bd068..d2a79c659 100644 --- a/src/sass/views/pincode.scss +++ b/src/sass/views/pincode.scss @@ -3,6 +3,9 @@ .bar.bar-clear { background-color: transparent; border: none; + .back-button .icon:before { + color: #2d3f50; + } } .content { text-align: center; @@ -62,7 +65,7 @@ box-shadow: 0 0 1px 0px rgb( 255, 255, 255); width: 5px; height: 5px; - transition: background-color .5s ease-in-out; + transition: background-color .1s ease-in-out; } .filled { background-color: #666666; From 015708529bd9050a559ab46aeb04417360441542 Mon Sep 17 00:00:00 2001 From: JDonadio Date: Wed, 8 Mar 2017 14:27:43 -0300 Subject: [PATCH 24/83] request pin when resume event is fired --- src/js/routes.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/js/routes.js b/src/js/routes.js index 31dafd194..46f688f0a 100644 --- a/src/js/routes.js +++ b/src/js/routes.js @@ -1175,7 +1175,11 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr }); $ionicPlatform.on('resume', function() { - // Nothing to do + configService.whenAvailable(function(config) { + if (platformInfo.isCordova && config.pincode && config.pincode.enabled) { + $state.go('pincode'); + } + }); }); $ionicPlatform.on('menubutton', function() { From d4c8576032634c007d19af15bd10062153dc2f9d Mon Sep 17 00:00:00 2001 From: JDonadio Date: Wed, 8 Mar 2017 16:02:34 -0300 Subject: [PATCH 25/83] improve performance and UX - handle history views properly --- src/js/controllers/advancedSettings.js | 2 +- src/js/controllers/pincode.js | 16 +++++++--------- src/js/services/pincodeService.js | 26 -------------------------- src/sass/views/pincode.scss | 24 ++++++++---------------- 4 files changed, 16 insertions(+), 52 deletions(-) delete mode 100644 src/js/services/pincodeService.js diff --git a/src/js/controllers/advancedSettings.js b/src/js/controllers/advancedSettings.js index a3881b719..a7f6187a8 100644 --- a/src/js/controllers/advancedSettings.js +++ b/src/js/controllers/advancedSettings.js @@ -1,6 +1,6 @@ 'use strict'; -angular.module('copayApp.controllers').controller('advancedSettingsController', function($scope, $timeout, $state, $log, $window, $ionicModal, lodash, configService, uxLanguage, platformInfo, pushNotificationsService, profileService, feeService, storageService, $ionicHistory, $ionicScrollDelegate, pincodeService) { +angular.module('copayApp.controllers').controller('advancedSettingsController', function($scope, $timeout, $state, $log, $window, $ionicModal, lodash, configService, uxLanguage, platformInfo, pushNotificationsService, profileService, feeService, storageService, $ionicHistory, $ionicScrollDelegate) { var updateConfig = function() { var config = configService.getSync(); diff --git a/src/js/controllers/pincode.js b/src/js/controllers/pincode.js index dc83d1c50..c2ba22363 100644 --- a/src/js/controllers/pincode.js +++ b/src/js/controllers/pincode.js @@ -1,6 +1,6 @@ 'use strict'; -angular.module('copayApp.controllers').controller('pincodeController', function($state, $stateParams, $timeout, $scope, $log, $window, configService) { +angular.module('copayApp.controllers').controller('pincodeController', function($state, $stateParams, $ionicHistory, $timeout, $scope, $log, $window, configService) { $scope.$on("$ionicView.beforeEnter", function(event) { $scope.currentPincode = $scope.newPincode = ''; @@ -39,8 +39,7 @@ angular.module('copayApp.controllers').controller('pincodeController', function( if (!$scope.locking) { if (match) { - $scope.fromSettings ? saveSettings($scope.locking, '') : $scope.close(); - return; + $scope.fromSettings ? saveSettings($scope.locking, '') : $scope.close(150); } } else { checkCodes(); @@ -70,14 +69,13 @@ angular.module('copayApp.controllers').controller('pincodeController', function( configService.set(opts, function(err) { if (err) $log.debug(err); - $timeout(function() { - $scope.close(); - }); + $scope.close(); }); }; - $scope.close = function() { - if ($scope.fromSettings) $state.go('tabs.advanced'); - else $state.go('tabs.home'); + $scope.close = function(delay) { + $timeout(function() { + $ionicHistory.viewHistory().backView ? $ionicHistory.goBack() : $state.go('tabs.home'); + }, delay || 1); }; }); diff --git a/src/js/services/pincodeService.js b/src/js/services/pincodeService.js deleted file mode 100644 index fea790bca..000000000 --- a/src/js/services/pincodeService.js +++ /dev/null @@ -1,26 +0,0 @@ -'use strict'; - -angular.module('copayApp.services').factory('pincodeService', function($log, $rootScope, $ionicModal, configService) { - var root = {}; - - root.lockChange = function(opts) { - var scope = $rootScope.$new(true); - scope.fromSettings = opts.fromSettings; - scope.locking = opts.locking; - $ionicModal.fromTemplateUrl('views/modals/pincode.html', { - scope: scope, - backdropClickToClose: false, - hardwareBackButtonClose: false - }).then(function(modal) { - scope.pincodeModal = modal; - scope.pincodeModal.show(); - }); - }; - - root.isLocked = function() { - var config = configService.getSync(); - return config.pincode ? config.pincode.enabled : false; - }; - - return root; -}); diff --git a/src/sass/views/pincode.scss b/src/sass/views/pincode.scss index d2a79c659..272591c21 100644 --- a/src/sass/views/pincode.scss +++ b/src/sass/views/pincode.scss @@ -11,10 +11,6 @@ text-align: center; width: 100%; height: 100%; - .row .col { - margin: 10px; - height: 25px; - } .app-icon { margin-top: -55px; .big-icon-svg { @@ -38,18 +34,15 @@ } } .block-code { - width: 300px; + width: 120px; margin: auto; - padding: 0 50px 0 50px; + .row { + height: 35px; + } } .block-buttons { - .row { - padding: 3%; - } - @media (max-height: 480px) { - .row { - padding: 2%; - } + .col { + padding: 5%; } cursor: pointer; position: absolute; @@ -63,9 +56,8 @@ border-radius: 50%; opacity: 0.6; box-shadow: 0 0 1px 0px rgb( 255, 255, 255); - width: 5px; - height: 5px; - transition: background-color .1s ease-in-out; + margin: 2px; + transition: background-color .2s ease-in-out; } .filled { background-color: #666666; From 824362af7cb6af8a4e2925c4fc9e9e4aa5f534b3 Mon Sep 17 00:00:00 2001 From: JDonadio Date: Fri, 10 Mar 2017 12:10:00 -0300 Subject: [PATCH 26/83] add fingerprint option - add lock app view and options --- src/js/controllers/advancedSettings.js | 9 +--- src/js/controllers/lockapp.js | 65 ++++++++++++++++++++++++++ src/js/controllers/pincode.js | 15 ++++-- src/js/routes.js | 17 +++++-- src/js/services/configService.js | 11 +++-- www/views/advancedSettings.html | 11 +++-- www/views/lockapp.html | 19 ++++++++ 7 files changed, 121 insertions(+), 26 deletions(-) create mode 100644 src/js/controllers/lockapp.js create mode 100644 www/views/lockapp.html diff --git a/src/js/controllers/advancedSettings.js b/src/js/controllers/advancedSettings.js index a7f6187a8..8af32de96 100644 --- a/src/js/controllers/advancedSettings.js +++ b/src/js/controllers/advancedSettings.js @@ -1,6 +1,6 @@ 'use strict'; -angular.module('copayApp.controllers').controller('advancedSettingsController', function($scope, $timeout, $state, $log, $window, $ionicModal, lodash, configService, uxLanguage, platformInfo, pushNotificationsService, profileService, feeService, storageService, $ionicHistory, $ionicScrollDelegate) { +angular.module('copayApp.controllers').controller('advancedSettingsController', function($scope, $log, configService, platformInfo) { var updateConfig = function() { var config = configService.getSync(); @@ -52,13 +52,6 @@ angular.module('copayApp.controllers').controller('advancedSettingsController', }); }; - $scope.usePincodeChange = function() { - $state.go('tabs.pincode', { - fromSettings: true, - locking: $scope.usePincode.enabled - }); - }; - $scope.$on("$ionicView.beforeEnter", function(event, data) { $scope.isCordova = platformInfo.isCordova; updateConfig(); diff --git a/src/js/controllers/lockapp.js b/src/js/controllers/lockapp.js new file mode 100644 index 000000000..02f68921c --- /dev/null +++ b/src/js/controllers/lockapp.js @@ -0,0 +1,65 @@ +'use strict'; + +angular.module('copayApp.controllers').controller('lockappController', function($state, $scope, $log, configService, popupService, gettextCatalog, appConfigService) { + + $scope.$on("$ionicView.beforeEnter", function(event) { + var config = configService.getSync(); + $scope.fingerprintAvailable = true; + // $scope.fingerprintAvailable = fingerprintService.isAvailable(); + + $scope.usePincode = { + enabled: config.lockapp ? config.lockapp.pincode.enabled : false + }; + $scope.useFingerprint = { + enabled: config.lockapp ? config.lockapp.fingerprint.enabled : false + }; + }); + + $scope.usePincodeChange = function() { + $state.go('tabs.lockapp.pincode', { + fromSettings: true, + locking: $scope.usePincode.enabled + }); + }; + + $scope.useFingerprintChange = function() { + if ($scope.usePincode.enabled) { + var message = gettextCatalog.getString('{{appName}} is protected by Pin Code. Are you sure you want to disable it?', { + appName: appConfigService.nameCase + }); + var okText = gettextCatalog.getString('Yes'); + var cancelText = gettextCatalog.getString('Cancel'); + popupService.showConfirm(null, message, okText, cancelText, function(ok) { + if (!ok) { + $scope.useFingerprint = { + enabled: false + }; + return; + } + saveConfig(); + }); + } else + saveConfig(); + + function saveConfig() { + $scope.usePincode = { + enabled: false + }; + var opts = { + lockapp: { + pincode: { + enabled: false, + value: '' + }, + fingerprint: { + enabled: $scope.useFingerprint.enabled + } + } + }; + + configService.set(opts, function(err) { + if (err) $log.debug(err); + }); + }; + }; +}); diff --git a/src/js/controllers/pincode.js b/src/js/controllers/pincode.js index c2ba22363..65249208a 100644 --- a/src/js/controllers/pincode.js +++ b/src/js/controllers/pincode.js @@ -1,6 +1,6 @@ 'use strict'; -angular.module('copayApp.controllers').controller('pincodeController', function($state, $stateParams, $ionicHistory, $timeout, $scope, $log, $window, configService) { +angular.module('copayApp.controllers').controller('pincodeController', function($state, $stateParams, $ionicHistory, $timeout, $scope, $log, configService) { $scope.$on("$ionicView.beforeEnter", function(event) { $scope.currentPincode = $scope.newPincode = ''; @@ -35,7 +35,7 @@ angular.module('copayApp.controllers').controller('pincodeController', function( $scope.save = function() { if (!isComplete()) return; var config = configService.getSync(); - var match = config.pincode.value == $scope.currentPincode ? true : false; + var match = config.lockapp.pincode.value == $scope.currentPincode ? true : false; if (!$scope.locking) { if (match) { @@ -61,9 +61,14 @@ angular.module('copayApp.controllers').controller('pincodeController', function( function saveSettings(enabled, value) { var opts = { - pincode: { - enabled: enabled, - value: value + lockapp: { + pincode: { + enabled: enabled, + value: value + }, + fingerprint: { + enabled: false + } } }; diff --git a/src/js/routes.js b/src/js/routes.js index 46f688f0a..48ce91c04 100644 --- a/src/js/routes.js +++ b/src/js/routes.js @@ -451,11 +451,20 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr } } }) - .state('tabs.pincode', { + .state('tabs.lockapp', { + url: '/lockapp', + views: { + 'tab-settings@tabs': { + controller: 'lockappController', + templateUrl: 'views/lockapp.html', + } + } + }) + .state('tabs.lockapp.pincode', { url: '/pincode/:fromSettings/:locking', views: { 'tab-settings@tabs': { - controller: 'pincodeController', + controller: 'lockappController', templateUrl: 'views/pincode.html', cache: false } @@ -1224,14 +1233,12 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr }); configService.whenAvailable(function(config) { startupService.ready(); - if (platformInfo.isCordova && config.pincode && config.pincode.enabled) { + if (platformInfo.isCordova && config.lockapp.pincode && config.lockapp.pincode.enabled) { $state.transitionTo('pincode').then(function() { - // Clear history $ionicHistory.clearHistory(); }); } else { $state.transitionTo('tabs.home').then(function() { - // Clear history $ionicHistory.clearHistory(); }); } diff --git a/src/js/services/configService.js b/src/js/services/configService.js index 30522da04..b4069f092 100644 --- a/src/js/services/configService.js +++ b/src/js/services/configService.js @@ -53,9 +53,14 @@ angular.module('copayApp.services').factory('configService', function(storageSer } }, - pincode: { - enabled: false, - value: '', + lockapp: { + pincode: { + enabled: false, + value: '', + }, + fingerprint: { + enabled: false + } }, // External services diff --git a/www/views/advancedSettings.html b/www/views/advancedSettings.html index 251fd9940..ee20c46e0 100644 --- a/www/views/advancedSettings.html +++ b/www/views/advancedSettings.html @@ -29,13 +29,14 @@ Hide Next Steps Card -
+
- - Use pin to lock/unlock the app - -
+ + Lock App + + +
diff --git a/www/views/lockapp.html b/www/views/lockapp.html new file mode 100644 index 000000000..3a2381b5c --- /dev/null +++ b/www/views/lockapp.html @@ -0,0 +1,19 @@ + + + {{'Lock App' | translate}} + + + + + + + Enable Pin Code + + +
+ + Enable Fingerprint + +
+
+
From 014995fd364f85a15dcf5c5f456b05f6d5f08fa9 Mon Sep 17 00:00:00 2001 From: JDonadio Date: Fri, 10 Mar 2017 14:17:23 -0300 Subject: [PATCH 27/83] add dead view (wip) - fix last/current state --- src/js/controllers/deadview.js | 13 +++++++ src/js/controllers/lockapp.js | 8 +++- src/js/routes.js | 54 +++++++++++++++++++++------ src/js/services/fingerprintService.js | 5 ++- www/views/deadview.html | 14 +++++++ 5 files changed, 80 insertions(+), 14 deletions(-) create mode 100644 src/js/controllers/deadview.js create mode 100644 www/views/deadview.html diff --git a/src/js/controllers/deadview.js b/src/js/controllers/deadview.js new file mode 100644 index 000000000..41b7b6ce4 --- /dev/null +++ b/src/js/controllers/deadview.js @@ -0,0 +1,13 @@ +'use strict'; + +angular.module('copayApp.controllers').controller('deadviewController', function($state, $scope, $ionicHistory, fingerprintService) { + + $scope.requestFingerprint = function() { + fingerprintService.check('unlockingApp', function(err) { + if (err) return; + $state.transitionTo('tabs.home').then(function() { + $ionicHistory.clearHistory(); + }); + }); + }; +}); diff --git a/src/js/controllers/lockapp.js b/src/js/controllers/lockapp.js index 02f68921c..f7ea02b2f 100644 --- a/src/js/controllers/lockapp.js +++ b/src/js/controllers/lockapp.js @@ -1,6 +1,6 @@ 'use strict'; -angular.module('copayApp.controllers').controller('lockappController', function($state, $scope, $log, configService, popupService, gettextCatalog, appConfigService) { +angular.module('copayApp.controllers').controller('lockappController', function($state, $scope, $timeout, $log, configService, popupService, gettextCatalog, appConfigService) { $scope.$on("$ionicView.beforeEnter", function(event) { var config = configService.getSync(); @@ -34,6 +34,9 @@ angular.module('copayApp.controllers').controller('lockappController', function( $scope.useFingerprint = { enabled: false }; + $timeout(function() { + $scope.$apply(); + }); return; } saveConfig(); @@ -45,6 +48,9 @@ angular.module('copayApp.controllers').controller('lockappController', function( $scope.usePincode = { enabled: false }; + $timeout(function() { + $scope.$apply(); + }); var opts = { lockapp: { pincode: { diff --git a/src/js/routes.js b/src/js/routes.js index 48ce91c04..9f8aecbb4 100644 --- a/src/js/routes.js +++ b/src/js/routes.js @@ -131,6 +131,18 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr templateUrl: 'views/pincode.html', }) + /* + * + * Dead state - locked + * + */ + + .state('deadview', { + url: '/deadview/', + controller: 'deadviewController', + templateUrl: 'views/deadview.html', + }) + /* * * URI @@ -1122,7 +1134,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr } }); }) - .run(function($rootScope, $state, $location, $log, $timeout, startupService, $ionicHistory, $ionicPlatform, $window, appConfigService, lodash, platformInfo, profileService, uxLanguage, gettextCatalog, openURLService, storageService, scannerService, configService, /* plugins START HERE => */ coinbaseService, glideraService, amazonService, bitpayCardService) { + .run(function($rootScope, $state, $location, $log, $timeout, startupService, fingerprintService, $ionicHistory, $ionicPlatform, $window, appConfigService, lodash, platformInfo, profileService, uxLanguage, gettextCatalog, openURLService, storageService, scannerService, configService, /* plugins START HERE => */ coinbaseService, glideraService, amazonService, bitpayCardService) { uxLanguage.init(); @@ -1185,9 +1197,22 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr $ionicPlatform.on('resume', function() { configService.whenAvailable(function(config) { - if (platformInfo.isCordova && config.pincode && config.pincode.enabled) { - $state.go('pincode'); - } + var nextView; + var lockapp = config.lockapp; + if (fingerprintService.isAvailable() && lockapp.fingerprint && lockapp.fingerprint.enabled) { + fingerprintService.check('unlockingApp', function(err) { + if (err) nextView = 'deadview'; + else nextView = $ionicHistory.currentStateName(); + goTo(nextView); + }); + } else if (platformInfo.isCordova && lockapp.pincode && lockapp.pincode.enabled) { + goTo('pincode'); + } else + goTo('tabs.home'); + + function goTo(nextView) { + $state.go(nextView); + }; }); }); @@ -1232,16 +1257,23 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr historyRoot: true }); configService.whenAvailable(function(config) { + var lockapp = config.lockapp; startupService.ready(); - if (platformInfo.isCordova && config.lockapp.pincode && config.lockapp.pincode.enabled) { - $state.transitionTo('pincode').then(function() { + if (fingerprintService.isAvailable() && lockapp.fingerprint && lockapp.fingerprint.enabled) { + fingerprintService.check('unlockingApp', function(err) { + if (err) goTo('deadview'); + else goTo('tabs.home'); + }); + } else if (platformInfo.isCordova && lockapp.pincode && lockapp.pincode.enabled) { + goTo('pincode'); + } else + goTo('tabs.home'); + + function goTo(nextView) { + $state.transitionTo(nextView).then(function() { $ionicHistory.clearHistory(); }); - } else { - $state.transitionTo('tabs.home').then(function() { - $ionicHistory.clearHistory(); - }); - } + }; }); }); } diff --git a/src/js/services/fingerprintService.js b/src/js/services/fingerprintService.js index 39e937360..86488a96a 100644 --- a/src/js/services/fingerprintService.js +++ b/src/js/services/fingerprintService.js @@ -14,7 +14,7 @@ angular.module('copayApp.services').factory('fingerprintService', function($log, function(msg) { FingerprintAuth.isAvailable(function(result) { - if (result.isAvailable) + if (result.isAvailable) _isAvailable = 'ANDROID'; }, function() { @@ -71,6 +71,7 @@ angular.module('copayApp.services').factory('fingerprintService', function($log, var isNeeded = function(client) { if (!_isAvailable) return false; + if (client === 'unlockingApp') return true; var config = configService.getSync(); config.touchIdFor = config.touchIdFor || {}; @@ -84,7 +85,7 @@ angular.module('copayApp.services').factory('fingerprintService', function($log, root.check = function(client, cb) { if (isNeeded(client)) { - $log.debug('FingerPrint Service:', _isAvailable); + $log.debug('FingerPrint Service:', _isAvailable); if (_isAvailable == 'IOS') return requestTouchId(cb); else diff --git a/www/views/deadview.html b/www/views/deadview.html new file mode 100644 index 000000000..f68ddce16 --- /dev/null +++ b/www/views/deadview.html @@ -0,0 +1,14 @@ + + + {{'App Locked' | translate}} + + + +
+ APP LOCKED +
+
+ Request Fingerprint Authentication +
+
+
From 1df951ad85352a1df4d720fe0fbb2211df6a4c8e Mon Sep 17 00:00:00 2001 From: JDonadio Date: Fri, 10 Mar 2017 17:04:36 -0300 Subject: [PATCH 28/83] styling dead view --- src/js/controllers/deadview.js | 6 +++- src/js/routes.js | 4 +-- src/sass/views/deadview.scss | 36 ++++++++++++++++++++ src/sass/views/views.scss | 1 + www/img/icon-fingerprint-bitpay.svg | 52 +++++++++++++++++++++++++++++ www/img/icon-fingerprint-copay.svg | 52 +++++++++++++++++++++++++++++ www/views/deadview.html | 16 +++++---- www/views/pincode.html | 2 +- 8 files changed, 159 insertions(+), 10 deletions(-) create mode 100644 src/sass/views/deadview.scss create mode 100644 www/img/icon-fingerprint-bitpay.svg create mode 100644 www/img/icon-fingerprint-copay.svg diff --git a/src/js/controllers/deadview.js b/src/js/controllers/deadview.js index 41b7b6ce4..c16faddd8 100644 --- a/src/js/controllers/deadview.js +++ b/src/js/controllers/deadview.js @@ -1,6 +1,10 @@ 'use strict'; -angular.module('copayApp.controllers').controller('deadviewController', function($state, $scope, $ionicHistory, fingerprintService) { +angular.module('copayApp.controllers').controller('deadviewController', function($state, $scope, $ionicHistory, fingerprintService, appConfigService, gettextCatalog) { + $scope.$on("$ionicView.beforeEnter", function(event) { + $scope.title = appConfigService.nameCase + ' ' + gettextCatalog.getString('is locked'); + $scope.appName = appConfigService.name; + }); $scope.requestFingerprint = function() { fingerprintService.check('unlockingApp', function(err) { diff --git a/src/js/routes.js b/src/js/routes.js index 9f8aecbb4..1c7188c00 100644 --- a/src/js/routes.js +++ b/src/js/routes.js @@ -1199,7 +1199,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr configService.whenAvailable(function(config) { var nextView; var lockapp = config.lockapp; - if (fingerprintService.isAvailable() && lockapp.fingerprint && lockapp.fingerprint.enabled) { + if (platformInfo.isCordova && fingerprintService.isAvailable() && lockapp.fingerprint && lockapp.fingerprint.enabled) { fingerprintService.check('unlockingApp', function(err) { if (err) nextView = 'deadview'; else nextView = $ionicHistory.currentStateName(); @@ -1259,7 +1259,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr configService.whenAvailable(function(config) { var lockapp = config.lockapp; startupService.ready(); - if (fingerprintService.isAvailable() && lockapp.fingerprint && lockapp.fingerprint.enabled) { + if (platformInfo.isCordova && fingerprintService.isAvailable() && lockapp.fingerprint && lockapp.fingerprint.enabled) { fingerprintService.check('unlockingApp', function(err) { if (err) goTo('deadview'); else goTo('tabs.home'); diff --git a/src/sass/views/deadview.scss b/src/sass/views/deadview.scss new file mode 100644 index 000000000..06c9ee17c --- /dev/null +++ b/src/sass/views/deadview.scss @@ -0,0 +1,36 @@ +#dead-view { + @mixin img-frame { + height: 60px; + width: 60px; + box-shadow: none; + margin: auto; + } + .img-container-copay { + padding: 20%; + .big-icon-svg { + > .bg { + @include img-frame; + background-image: url("../img/icon-fingerprint-copay.svg"); + } + } + } + .img-container-bitpay { + padding: 20%; + .big-icon-svg { + > .bg { + @include img-frame; + background-image: url("../img/icon-fingerprint-bitpay.svg"); + } + } + } + .comments { + text-align: center; + .header { + font-size: 20px; + } + .text-content { + width: 90%; + margin: 5% auto; + } + } +} diff --git a/src/sass/views/views.scss b/src/sass/views/views.scss index 5516fd9ab..ac53386d8 100644 --- a/src/sass/views/views.scss +++ b/src/sass/views/views.scss @@ -47,3 +47,4 @@ @import "integrations/integrations"; @import "custom-amount"; @import "pincode"; +@import "deadview"; diff --git a/www/img/icon-fingerprint-bitpay.svg b/www/img/icon-fingerprint-bitpay.svg new file mode 100644 index 000000000..edf9f95da --- /dev/null +++ b/www/img/icon-fingerprint-bitpay.svg @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/img/icon-fingerprint-copay.svg b/www/img/icon-fingerprint-copay.svg new file mode 100644 index 000000000..dcad0d889 --- /dev/null +++ b/www/img/icon-fingerprint-copay.svg @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/views/deadview.html b/www/views/deadview.html index f68ddce16..4716b1292 100644 --- a/www/views/deadview.html +++ b/www/views/deadview.html @@ -1,14 +1,18 @@ - + - {{'App Locked' | translate}} + {{title}} -
- APP LOCKED +
+
-
- Request Fingerprint Authentication +
+
+
+
+
One-touch Sign In
+
Please place your fingertip on the scanner to verify your identity
diff --git a/www/views/pincode.html b/www/views/pincode.html index 9e653e5eb..fe98700b2 100644 --- a/www/views/pincode.html +++ b/www/views/pincode.html @@ -8,7 +8,7 @@
Confirm your mobile unlock code
-
+
From 775b16e0fdd3a5e4e3123493318db24eee54f8ee Mon Sep 17 00:00:00 2001 From: JDonadio Date: Fri, 10 Mar 2017 17:19:32 -0300 Subject: [PATCH 29/83] clean services --- src/js/controllers/advancedSettings.js | 19 ++++++++++++++++++- www/views/advancedSettings.html | 4 ++-- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/js/controllers/advancedSettings.js b/src/js/controllers/advancedSettings.js index 8af32de96..059f00cb0 100644 --- a/src/js/controllers/advancedSettings.js +++ b/src/js/controllers/advancedSettings.js @@ -15,7 +15,7 @@ angular.module('copayApp.controllers').controller('advancedSettingsController', value: config.hideNextSteps.enabled }; $scope.usePincode = { - enabled: config.pincode ? config.pincode.enabled : false + value: config.pincode ? config.pincode.enabled : false }; }; @@ -41,6 +41,23 @@ angular.module('copayApp.controllers').controller('advancedSettingsController', }); }; + $scope.savePincodeChanges = function(val) { + if (!val || val.length < 4) { + $scope.usePincode = { + value: false + } + return; + } + var opts = { + usePincode: { + enabled: $scope.usePincode.enabled + }, + }; + configService.set(opts, function(err) { + if (err) $log.debug(err); + }); + }; + $scope.recentTransactionsChange = function() { var opts = { recentTransactions: { diff --git a/www/views/advancedSettings.html b/www/views/advancedSettings.html index ee20c46e0..ac92e9be0 100644 --- a/www/views/advancedSettings.html +++ b/www/views/advancedSettings.html @@ -29,14 +29,14 @@ Hide Next Steps Card - +
From dccd14310f6246a18ea80932b3387c0466ea0daa Mon Sep 17 00:00:00 2001 From: JDonadio Date: Mon, 13 Mar 2017 09:56:06 -0300 Subject: [PATCH 30/83] add scan button --- www/views/deadview.html | 3 +++ 1 file changed, 3 insertions(+) diff --git a/www/views/deadview.html b/www/views/deadview.html index 4716b1292..a38d5fad4 100644 --- a/www/views/deadview.html +++ b/www/views/deadview.html @@ -14,5 +14,8 @@
One-touch Sign In
Please place your fingertip on the scanner to verify your identity
+ From 47729129c9c9964fff61bb9d10c9d6198ccb15d6 Mon Sep 17 00:00:00 2001 From: JDonadio Date: Fri, 17 Mar 2017 15:52:34 -0300 Subject: [PATCH 31/83] ref styling --- src/js/controllers/pincode.js | 24 ++++++++++++++------- src/sass/views/pincode.scss | 40 ++++++++++++++++++++++------------- www/views/pincode.html | 19 ++++++++++------- 3 files changed, 52 insertions(+), 31 deletions(-) diff --git a/src/js/controllers/pincode.js b/src/js/controllers/pincode.js index 65249208a..74efd43ee 100644 --- a/src/js/controllers/pincode.js +++ b/src/js/controllers/pincode.js @@ -1,13 +1,19 @@ 'use strict'; -angular.module('copayApp.controllers').controller('pincodeController', function($state, $stateParams, $ionicHistory, $timeout, $scope, $log, configService) { +angular.module('copayApp.controllers').controller('pincodeController', function($state, $stateParams, $ionicHistory, $timeout, $scope, $log, configService, appConfigService) { $scope.$on("$ionicView.beforeEnter", function(event) { $scope.currentPincode = $scope.newPincode = ''; $scope.fromSettings = $stateParams.fromSettings == 'true' ? true : false; $scope.locking = $stateParams.locking == 'true' ? true : false; + $scope.match = false; + $scope.appName = appConfigService.name; }); + $scope.getFilledClass = function(limit) { + return $scope.currentPincode.length >= limit ? 'filled-' + $scope.appName : null; + }; + $scope.delete = function() { if ($scope.currentPincode.length > 0) { $scope.currentPincode = $scope.currentPincode.substring(0, $scope.currentPincode.length - 1); @@ -15,30 +21,32 @@ angular.module('copayApp.controllers').controller('pincodeController', function( } }; - function isComplete() { + $scope.isComplete = function() { if ($scope.currentPincode.length < 4) return false; else return true; }; $scope.updatePinCode = function(value) { - if (value && !isComplete()) { + if (value && !$scope.isComplete()) { $scope.currentPincode = $scope.currentPincode + value; } $timeout(function() { $scope.$apply(); }); - if (!$scope.locking && isComplete()) { + if (!$scope.locking && $scope.isComplete()) { $scope.save(); } }; $scope.save = function() { - if (!isComplete()) return; + if (!$scope.isComplete()) return; var config = configService.getSync(); - var match = config.lockapp.pincode.value == $scope.currentPincode ? true : false; - + $scope.match = config.lockapp.pincode.value == $scope.currentPincode ? true : false; + $timeout(function() { + $scope.$apply(); + }); if (!$scope.locking) { - if (match) { + if ($scope.match) { $scope.fromSettings ? saveSettings($scope.locking, '') : $scope.close(150); } } else { diff --git a/src/sass/views/pincode.scss b/src/sass/views/pincode.scss index 272591c21..f81621c3f 100644 --- a/src/sass/views/pincode.scss +++ b/src/sass/views/pincode.scss @@ -34,11 +34,8 @@ } } .block-code { - width: 120px; + width: 50%; margin: auto; - .row { - height: 35px; - } } .block-buttons { .col { @@ -47,19 +44,32 @@ cursor: pointer; position: absolute; bottom: 3%; - left: 0; - width: 100%; + left: 5%; + width: 90%; } } - .circle { - border: 1px solid #666666; - border-radius: 50%; - opacity: 0.6; - box-shadow: 0 0 1px 0px rgb( 255, 255, 255); - margin: 2px; - transition: background-color .2s ease-in-out; + @mixin circle { + border-radius: 50%; + box-shadow: 0 0 1px 0px rgb( 255, 255, 255); + transition: background-color .2s ease-in-out; + padding: 7%; + margin: 5%; } - .filled { - background-color: #666666; + .circle-copay { + @include circle; + border: 1px solid $v-accent-color; + } + .circle-bitpay { + @include circle; + border: 1px solid $v-primary-color; + } + .filled-copay { + background-color: $v-accent-color; + } + .filled-bitpay { + background-color: $v-primary-color; + } + .error { + color: #f13333; } } diff --git a/www/views/pincode.html b/www/views/pincode.html index fe98700b2..b6914478f 100644 --- a/www/views/pincode.html +++ b/www/views/pincode.html @@ -4,8 +4,11 @@
-
Please enter your mobile unlock code
-
Confirm your mobile unlock code
+
+ Please enter your mobile unlock code + Confirm your mobile unlock code + Incorrect code, try again. +
@@ -13,10 +16,10 @@
-
-
-
-
+
+
+
+
@@ -60,8 +63,8 @@
0
-
-
+
+
From 9049c3148d819e01ee656bf2ff602ce8ae23deff Mon Sep 17 00:00:00 2001 From: JDonadio Date: Thu, 23 Mar 2017 11:07:47 -0300 Subject: [PATCH 32/83] improve responsiveness --- src/sass/views/deadview.scss | 6 ++++++ src/sass/views/pincode.scss | 21 +++++++++++++++++++-- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/src/sass/views/deadview.scss b/src/sass/views/deadview.scss index 06c9ee17c..7fdc3d318 100644 --- a/src/sass/views/deadview.scss +++ b/src/sass/views/deadview.scss @@ -7,6 +7,9 @@ } .img-container-copay { padding: 20%; + @media(min-width: 480px) { + max-height: 150px; + } .big-icon-svg { > .bg { @include img-frame; @@ -16,6 +19,9 @@ } .img-container-bitpay { padding: 20%; + @media(min-width: 480px) { + max-height: 150px; + } .big-icon-svg { > .bg { @include img-frame; diff --git a/src/sass/views/pincode.scss b/src/sass/views/pincode.scss index f81621c3f..6974c2360 100644 --- a/src/sass/views/pincode.scss +++ b/src/sass/views/pincode.scss @@ -32,25 +32,42 @@ width: 60%; margin: 10% auto; } + @media(min-width: 480px) { + span { + font-size: 30px; + width: 90%; + } + } } .block-code { width: 50%; margin: auto; + @media(min-width: 480px) { + width: 25%; + } } .block-buttons { .col { padding: 5%; } + color: $v-dark-gray; + font-size: 1.7rem; + font-family: $v-font-family-light; cursor: pointer; position: absolute; bottom: 3%; left: 5%; width: 90%; + @media(min-width: 480px) { + left: 15%; + width: 70%; + max-height: 55%; + } } } @mixin circle { border-radius: 50%; - box-shadow: 0 0 1px 0px rgb( 255, 255, 255); + box-shadow: 0 0 3px 0px #5b5b5b; transition: background-color .2s ease-in-out; padding: 7%; margin: 5%; @@ -67,7 +84,7 @@ background-color: $v-accent-color; } .filled-bitpay { - background-color: $v-primary-color; + background-color: #1f3598; } .error { color: #f13333; From 07be82f9d094d6081dfd795cca32c4f63207544b Mon Sep 17 00:00:00 2001 From: JDonadio Date: Wed, 29 Mar 2017 09:25:18 -0300 Subject: [PATCH 33/83] enable devel mode --- src/js/controllers/advancedSettings.js | 1 + src/js/controllers/lockapp.js | 3 +-- src/js/routes.js | 4 ++-- www/views/advancedSettings.html | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/js/controllers/advancedSettings.js b/src/js/controllers/advancedSettings.js index 059f00cb0..9c616dbc8 100644 --- a/src/js/controllers/advancedSettings.js +++ b/src/js/controllers/advancedSettings.js @@ -71,6 +71,7 @@ angular.module('copayApp.controllers').controller('advancedSettingsController', $scope.$on("$ionicView.beforeEnter", function(event, data) { $scope.isCordova = platformInfo.isCordova; + $scope.isDevel = platformInfo.isDevel; updateConfig(); }); diff --git a/src/js/controllers/lockapp.js b/src/js/controllers/lockapp.js index f7ea02b2f..95b1c0727 100644 --- a/src/js/controllers/lockapp.js +++ b/src/js/controllers/lockapp.js @@ -4,8 +4,7 @@ angular.module('copayApp.controllers').controller('lockappController', function( $scope.$on("$ionicView.beforeEnter", function(event) { var config = configService.getSync(); - $scope.fingerprintAvailable = true; - // $scope.fingerprintAvailable = fingerprintService.isAvailable(); + $scope.fingerprintAvailable = fingerprintService.isAvailable(); $scope.usePincode = { enabled: config.lockapp ? config.lockapp.pincode.enabled : false diff --git a/src/js/routes.js b/src/js/routes.js index 1c7188c00..d0953da02 100644 --- a/src/js/routes.js +++ b/src/js/routes.js @@ -1259,12 +1259,12 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr configService.whenAvailable(function(config) { var lockapp = config.lockapp; startupService.ready(); - if (platformInfo.isCordova && fingerprintService.isAvailable() && lockapp.fingerprint && lockapp.fingerprint.enabled) { + if ((platformInfo.isCordova || platformInfo.isDevel) && fingerprintService.isAvailable() && lockapp.fingerprint && lockapp.fingerprint.enabled) { fingerprintService.check('unlockingApp', function(err) { if (err) goTo('deadview'); else goTo('tabs.home'); }); - } else if (platformInfo.isCordova && lockapp.pincode && lockapp.pincode.enabled) { + } else if ((platformInfo.isCordova || platformInfo.isDevel) && lockapp.pincode && lockapp.pincode.enabled) { goTo('pincode'); } else goTo('tabs.home'); diff --git a/www/views/advancedSettings.html b/www/views/advancedSettings.html index ac92e9be0..b129f1d01 100644 --- a/www/views/advancedSettings.html +++ b/www/views/advancedSettings.html @@ -29,7 +29,7 @@ Hide Next Steps Card -
+
From 5c2b067c8714a643597413a741b17a5cdea9905d Mon Sep 17 00:00:00 2001 From: JDonadio Date: Wed, 29 Mar 2017 11:30:16 -0300 Subject: [PATCH 34/83] refactor --- src/js/controllers/advancedSettings.js | 20 ---- src/js/controllers/{lockapp.js => lock.js} | 29 ++--- .../{deadview.js => lockedView.js} | 2 +- src/js/controllers/pin.js | 98 ++++++++++++++++ src/js/controllers/pincode.js | 94 --------------- src/js/routes.js | 110 +++++++++--------- src/js/services/configService.js | 11 +- .../views/{deadview.scss => lockedView.scss} | 2 +- src/sass/views/{pincode.scss => pin.scss} | 2 +- src/sass/views/views.scss | 4 +- www/views/advancedSettings.html | 2 +- www/views/{lockapp.html => lock.html} | 4 +- www/views/{deadview.html => lockedView.html} | 2 +- www/views/{pincode.html => pin.html} | 32 +++-- 14 files changed, 195 insertions(+), 217 deletions(-) rename src/js/controllers/{lockapp.js => lock.js} (62%) rename src/js/controllers/{deadview.js => lockedView.js} (73%) create mode 100644 src/js/controllers/pin.js delete mode 100644 src/js/controllers/pincode.js rename src/sass/views/{deadview.scss => lockedView.scss} (98%) rename src/sass/views/{pincode.scss => pin.scss} (99%) rename www/views/{lockapp.html => lock.html} (74%) rename www/views/{deadview.html => lockedView.html} (96%) rename www/views/{pincode.html => pin.html} (58%) diff --git a/src/js/controllers/advancedSettings.js b/src/js/controllers/advancedSettings.js index 9c616dbc8..1617ef9fe 100644 --- a/src/js/controllers/advancedSettings.js +++ b/src/js/controllers/advancedSettings.js @@ -14,9 +14,6 @@ angular.module('copayApp.controllers').controller('advancedSettingsController', $scope.hideNextSteps = { value: config.hideNextSteps.enabled }; - $scope.usePincode = { - value: config.pincode ? config.pincode.enabled : false - }; }; $scope.spendUnconfirmedChange = function() { @@ -41,23 +38,6 @@ angular.module('copayApp.controllers').controller('advancedSettingsController', }); }; - $scope.savePincodeChanges = function(val) { - if (!val || val.length < 4) { - $scope.usePincode = { - value: false - } - return; - } - var opts = { - usePincode: { - enabled: $scope.usePincode.enabled - }, - }; - configService.set(opts, function(err) { - if (err) $log.debug(err); - }); - }; - $scope.recentTransactionsChange = function() { var opts = { recentTransactions: { diff --git a/src/js/controllers/lockapp.js b/src/js/controllers/lock.js similarity index 62% rename from src/js/controllers/lockapp.js rename to src/js/controllers/lock.js index 95b1c0727..2073ac76e 100644 --- a/src/js/controllers/lockapp.js +++ b/src/js/controllers/lock.js @@ -1,28 +1,28 @@ 'use strict'; -angular.module('copayApp.controllers').controller('lockappController', function($state, $scope, $timeout, $log, configService, popupService, gettextCatalog, appConfigService) { +angular.module('copayApp.controllers').controller('lockController', function($state, $scope, $timeout, $log, configService, popupService, gettextCatalog, appConfigService, fingerprintService) { $scope.$on("$ionicView.beforeEnter", function(event) { var config = configService.getSync(); $scope.fingerprintAvailable = fingerprintService.isAvailable(); - $scope.usePincode = { - enabled: config.lockapp ? config.lockapp.pincode.enabled : false + $scope.usePin = { + enabled: config.lock && config.lock.method == 'pin' ? true : false }; $scope.useFingerprint = { - enabled: config.lockapp ? config.lockapp.fingerprint.enabled : false + enabled: config.lock && config.lock.method == 'fingerprint' ? true : false }; }); - $scope.usePincodeChange = function() { - $state.go('tabs.lockapp.pincode', { + $scope.usePinChange = function() { + $state.go('tabs.lock.pin', { fromSettings: true, - locking: $scope.usePincode.enabled + locking: $scope.usePin.enabled }); }; $scope.useFingerprintChange = function() { - if ($scope.usePincode.enabled) { + if ($scope.usePin.enabled) { var message = gettextCatalog.getString('{{appName}} is protected by Pin Code. Are you sure you want to disable it?', { appName: appConfigService.nameCase }); @@ -44,21 +44,16 @@ angular.module('copayApp.controllers').controller('lockappController', function( saveConfig(); function saveConfig() { - $scope.usePincode = { + $scope.usePin = { enabled: false }; $timeout(function() { $scope.$apply(); }); var opts = { - lockapp: { - pincode: { - enabled: false, - value: '' - }, - fingerprint: { - enabled: $scope.useFingerprint.enabled - } + lock: { + method: $scope.useFingerprint.enabled ? 'fingerprint' : '', + value: '', } }; diff --git a/src/js/controllers/deadview.js b/src/js/controllers/lockedView.js similarity index 73% rename from src/js/controllers/deadview.js rename to src/js/controllers/lockedView.js index c16faddd8..0842c5cf6 100644 --- a/src/js/controllers/deadview.js +++ b/src/js/controllers/lockedView.js @@ -1,6 +1,6 @@ 'use strict'; -angular.module('copayApp.controllers').controller('deadviewController', function($state, $scope, $ionicHistory, fingerprintService, appConfigService, gettextCatalog) { +angular.module('copayApp.controllers').controller('lockedViewController', function($state, $scope, $ionicHistory, fingerprintService, appConfigService, gettextCatalog) { $scope.$on("$ionicView.beforeEnter", function(event) { $scope.title = appConfigService.nameCase + ' ' + gettextCatalog.getString('is locked'); $scope.appName = appConfigService.name; diff --git a/src/js/controllers/pin.js b/src/js/controllers/pin.js new file mode 100644 index 000000000..411683e3e --- /dev/null +++ b/src/js/controllers/pin.js @@ -0,0 +1,98 @@ +'use strict'; + +angular.module('copayApp.controllers').controller('pinController', function($state, $stateParams, $ionicHistory, $timeout, $scope, $log, configService, appConfigService) { + var PIN = 'pin'; + + $scope.$on("$ionicView.beforeEnter", function(event) { + $scope.currentPin = $scope.confirmPin = ''; + $scope.fromSettings = $stateParams.fromSettings == 'true' ? true : false; + $scope.locking = $stateParams.locking == 'true' ? true : false; + $scope.match = false; + $scope.error = false; + $scope.appName = appConfigService.name; + }); + + $scope.getFilledClass = function(limit) { + return $scope.currentPin.length >= limit ? 'filled-' + $scope.appName : null; + }; + + $scope.delete = function() { + if ($scope.currentPin.length > 0) { + $scope.currentPin = $scope.currentPin.substring(0, $scope.currentPin.length - 1); + $scope.error = false; + $scope.updatePin(); + } + }; + + $scope.isComplete = function() { + if ($scope.currentPin.length < 4) return false; + else return true; + }; + + $scope.updatePin = function(value) { + $scope.error = false; + if (value && !$scope.isComplete()) { + $scope.currentPin = $scope.currentPin + value; + $timeout(function() { + $scope.$apply(); + }); + } + $scope.save(); + }; + + $scope.save = function() { + if (!$scope.isComplete()) return; + var config = configService.getSync(); + $scope.match = config.lock && config.lock.method == PIN && config.lock.value == $scope.currentPin ? true : false; + if (!$scope.locking) { + if ($scope.match) { + $scope.fromSettings ? saveSettings() : $scope.close(150); + $scope.error = false; + } else { + $scope.confirmPin = $scope.currentPin = ''; + $scope.error = true; + } + } else { + processCodes(); + } + }; + + function processCodes() { + if (!$scope.confirmPin) { + $scope.confirmPin = $scope.currentPin; + $timeout(function() { + $scope.currentPin = ''; + }, 200); + } else { + if ($scope.confirmPin == $scope.currentPin) + saveSettings(PIN, $scope.confirmPin); + else { + $scope.confirmPin = $scope.currentPin = ''; + $scope.error = true; + } + } + $timeout(function() { + $scope.$apply(); + }); + }; + + function saveSettings(method, value) { + var opts = { + lock: { + method: method || '', + value: value || '', + } + }; + + configService.set(opts, function(err) { + if (err) $log.debug(err); + $scope.close(); + }); + }; + + $scope.close = function(delay) { + $timeout(function() { + $ionicHistory.viewHistory().backView ? $ionicHistory.goBack() : $state.go('tabs.home'); + }, delay || 1); + }; +}); diff --git a/src/js/controllers/pincode.js b/src/js/controllers/pincode.js deleted file mode 100644 index 74efd43ee..000000000 --- a/src/js/controllers/pincode.js +++ /dev/null @@ -1,94 +0,0 @@ -'use strict'; - -angular.module('copayApp.controllers').controller('pincodeController', function($state, $stateParams, $ionicHistory, $timeout, $scope, $log, configService, appConfigService) { - - $scope.$on("$ionicView.beforeEnter", function(event) { - $scope.currentPincode = $scope.newPincode = ''; - $scope.fromSettings = $stateParams.fromSettings == 'true' ? true : false; - $scope.locking = $stateParams.locking == 'true' ? true : false; - $scope.match = false; - $scope.appName = appConfigService.name; - }); - - $scope.getFilledClass = function(limit) { - return $scope.currentPincode.length >= limit ? 'filled-' + $scope.appName : null; - }; - - $scope.delete = function() { - if ($scope.currentPincode.length > 0) { - $scope.currentPincode = $scope.currentPincode.substring(0, $scope.currentPincode.length - 1); - $scope.updatePinCode(); - } - }; - - $scope.isComplete = function() { - if ($scope.currentPincode.length < 4) return false; - else return true; - }; - - $scope.updatePinCode = function(value) { - if (value && !$scope.isComplete()) { - $scope.currentPincode = $scope.currentPincode + value; - } - $timeout(function() { - $scope.$apply(); - }); - if (!$scope.locking && $scope.isComplete()) { - $scope.save(); - } - }; - - $scope.save = function() { - if (!$scope.isComplete()) return; - var config = configService.getSync(); - $scope.match = config.lockapp.pincode.value == $scope.currentPincode ? true : false; - $timeout(function() { - $scope.$apply(); - }); - if (!$scope.locking) { - if ($scope.match) { - $scope.fromSettings ? saveSettings($scope.locking, '') : $scope.close(150); - } - } else { - checkCodes(); - } - }; - - function checkCodes() { - if (!$scope.newPincode) { - $scope.newPincode = $scope.currentPincode; - $scope.currentPincode = ''; - $timeout(function() { - $scope.$apply(); - }); - } else { - if ($scope.newPincode == $scope.currentPincode) - saveSettings($scope.locking, $scope.newPincode); - } - }; - - function saveSettings(enabled, value) { - var opts = { - lockapp: { - pincode: { - enabled: enabled, - value: value - }, - fingerprint: { - enabled: false - } - } - }; - - configService.set(opts, function(err) { - if (err) $log.debug(err); - $scope.close(); - }); - }; - - $scope.close = function(delay) { - $timeout(function() { - $ionicHistory.viewHistory().backView ? $ionicHistory.goBack() : $state.go('tabs.home'); - }, delay || 1); - }; -}); diff --git a/src/js/routes.js b/src/js/routes.js index d0953da02..6b6f4625d 100644 --- a/src/js/routes.js +++ b/src/js/routes.js @@ -121,26 +121,26 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr /* * - * Pin code + * Pin * */ - .state('pincode', { - url: '/pincode/', - controller: 'pincodeController', - templateUrl: 'views/pincode.html', + .state('pin', { + url: '/pin/', + controller: 'pinController', + templateUrl: 'views/pin.html', }) /* * - * Dead state - locked + * Locked * */ - .state('deadview', { - url: '/deadview/', - controller: 'deadviewController', - templateUrl: 'views/deadview.html', + .state('lockedView', { + url: '/lockedView/', + controller: 'lockedViewController', + templateUrl: 'views/lockedView.html', }) /* @@ -463,21 +463,21 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr } } }) - .state('tabs.lockapp', { - url: '/lockapp', + .state('tabs.lock', { + url: '/lock', views: { 'tab-settings@tabs': { - controller: 'lockappController', - templateUrl: 'views/lockapp.html', + controller: 'lockController', + templateUrl: 'views/lock.html', } } }) - .state('tabs.lockapp.pincode', { - url: '/pincode/:fromSettings/:locking', + .state('tabs.lock.pin', { + url: '/pin/:fromSettings/:locking', views: { 'tab-settings@tabs': { - controller: 'lockappController', - templateUrl: 'views/pincode.html', + controller: 'pinController', + templateUrl: 'views/pin.html', cache: false } } @@ -1196,24 +1196,28 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr }); $ionicPlatform.on('resume', function() { - configService.whenAvailable(function(config) { - var nextView; - var lockapp = config.lockapp; - if (platformInfo.isCordova && fingerprintService.isAvailable() && lockapp.fingerprint && lockapp.fingerprint.enabled) { - fingerprintService.check('unlockingApp', function(err) { - if (err) nextView = 'deadview'; - else nextView = $ionicHistory.currentStateName(); - goTo(nextView); - }); - } else if (platformInfo.isCordova && lockapp.pincode && lockapp.pincode.enabled) { - goTo('pincode'); - } else - goTo('tabs.home'); + if (platformInfo.isCordova || platformInfo.isDevel) { + configService.whenAvailable(function(config) { + var nextView; + var lock = config.lock; + if (lock && lock.method == 'fingerprint' && fingerprintService.isAvailable()) { + fingerprintService.check('unlockingApp', function(err) { + if (err) nextView = 'lockedView'; + else if ($ionicHistory.currentStateName() == 'lockedView') nextView = 'tabs.home'; + else nextView = $ionicHistory.currentStateName(); + goTo(nextView); + }); + } else if (lock && lock.method == 'pin') { + goTo('pin'); + } - function goTo(nextView) { - $state.go(nextView); - }; - }); + function goTo(nextView) { + $state.transitionTo(nextView).then(function() { + if (nextView == 'lockedView') $ionicHistory.clearHistory(); + }); + }; + }); + } }); $ionicPlatform.on('menubutton', function() { @@ -1256,25 +1260,27 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr disableAnimate: true, historyRoot: true }); - configService.whenAvailable(function(config) { - var lockapp = config.lockapp; + if (platformInfo.isCordova || platformInfo.isDevel) { startupService.ready(); - if ((platformInfo.isCordova || platformInfo.isDevel) && fingerprintService.isAvailable() && lockapp.fingerprint && lockapp.fingerprint.enabled) { - fingerprintService.check('unlockingApp', function(err) { - if (err) goTo('deadview'); - else goTo('tabs.home'); - }); - } else if ((platformInfo.isCordova || platformInfo.isDevel) && lockapp.pincode && lockapp.pincode.enabled) { - goTo('pincode'); - } else - goTo('tabs.home'); + configService.whenAvailable(function(config) { + var lock = config.lock; + if (fingerprintService.isAvailable() && lock && lock.method == 'fingerprint') { + fingerprintService.check('unlockingApp', function(err) { + if (err) goTo('lockedView'); + else goTo('tabs.home'); + }); + } else if (lock && lock.method == 'pin') { + goTo('pin'); + } else + goTo('tabs.home'); - function goTo(nextView) { - $state.transitionTo(nextView).then(function() { - $ionicHistory.clearHistory(); - }); - }; - }); + function goTo(nextView) { + $state.transitionTo(nextView).then(function() { + $ionicHistory.clearHistory(); + }); + }; + }); + } }); } diff --git a/src/js/services/configService.js b/src/js/services/configService.js index b4069f092..b60e1cb13 100644 --- a/src/js/services/configService.js +++ b/src/js/services/configService.js @@ -53,14 +53,9 @@ angular.module('copayApp.services').factory('configService', function(storageSer } }, - lockapp: { - pincode: { - enabled: false, - value: '', - }, - fingerprint: { - enabled: false - } + lock: { + method: '', + value: '', }, // External services diff --git a/src/sass/views/deadview.scss b/src/sass/views/lockedView.scss similarity index 98% rename from src/sass/views/deadview.scss rename to src/sass/views/lockedView.scss index 7fdc3d318..23fed7a83 100644 --- a/src/sass/views/deadview.scss +++ b/src/sass/views/lockedView.scss @@ -1,4 +1,4 @@ -#dead-view { +#locked-view { @mixin img-frame { height: 60px; width: 60px; diff --git a/src/sass/views/pincode.scss b/src/sass/views/pin.scss similarity index 99% rename from src/sass/views/pincode.scss rename to src/sass/views/pin.scss index 6974c2360..6f3733230 100644 --- a/src/sass/views/pincode.scss +++ b/src/sass/views/pin.scss @@ -1,4 +1,4 @@ -#pin-code { +#pin { background-color: #FAFAFA; .bar.bar-clear { background-color: transparent; diff --git a/src/sass/views/views.scss b/src/sass/views/views.scss index ac53386d8..bd8520c01 100644 --- a/src/sass/views/views.scss +++ b/src/sass/views/views.scss @@ -46,5 +46,5 @@ @import "includes/accountSelector"; @import "integrations/integrations"; @import "custom-amount"; -@import "pincode"; -@import "deadview"; +@import "pin"; +@import "lockedView"; diff --git a/www/views/advancedSettings.html b/www/views/advancedSettings.html index b129f1d01..74cf47341 100644 --- a/www/views/advancedSettings.html +++ b/www/views/advancedSettings.html @@ -32,7 +32,7 @@
-
+ Lock App diff --git a/www/views/lockapp.html b/www/views/lock.html similarity index 74% rename from www/views/lockapp.html rename to www/views/lock.html index 3a2381b5c..fd416ddb5 100644 --- a/www/views/lockapp.html +++ b/www/views/lock.html @@ -6,8 +6,8 @@ - - Enable Pin Code + + Enable Pin
diff --git a/www/views/deadview.html b/www/views/lockedView.html similarity index 96% rename from www/views/deadview.html rename to www/views/lockedView.html index a38d5fad4..98ca5a986 100644 --- a/www/views/deadview.html +++ b/www/views/lockedView.html @@ -1,4 +1,4 @@ - + {{title}} diff --git a/www/views/pincode.html b/www/views/pin.html similarity index 58% rename from www/views/pincode.html rename to www/views/pin.html index b6914478f..f1c4f6fa0 100644 --- a/www/views/pincode.html +++ b/www/views/pin.html @@ -1,13 +1,13 @@ - +
- Please enter your mobile unlock code - Confirm your mobile unlock code - Incorrect code, try again. + Please enter your mobile unlock code + Confirm your mobile unlock code + Incorrect code, try again.
@@ -24,43 +24,41 @@
-
+
1
-
+
2
-
+
3
-
+
4
-
+
5
-
+
6
-
+
7
-
+
8
-
+
9
-
-
-
-
+
+
0
From c29af5f658ad457e429d5acda62415487f4e22e2 Mon Sep 17 00:00:00 2001 From: JDonadio Date: Thu, 30 Mar 2017 11:31:23 -0300 Subject: [PATCH 35/83] attempts limit - remaining time --- src/js/controllers/pin.js | 97 +++++++++++++++++++++++++++++--- src/js/services/configService.js | 2 + src/sass/views/pin.scss | 5 +- www/views/pin.html | 9 ++- 4 files changed, 101 insertions(+), 12 deletions(-) diff --git a/src/js/controllers/pin.js b/src/js/controllers/pin.js index 411683e3e..9d78b9e65 100644 --- a/src/js/controllers/pin.js +++ b/src/js/controllers/pin.js @@ -1,22 +1,93 @@ 'use strict'; -angular.module('copayApp.controllers').controller('pinController', function($state, $stateParams, $ionicHistory, $timeout, $scope, $log, configService, appConfigService) { +angular.module('copayApp.controllers').controller('pinController', function($state, $interval, $stateParams, $ionicHistory, $timeout, $scope, $log, configService, appConfigService) { var PIN = 'pin'; + var ATTEPMPTS_LIMIT = 3; $scope.$on("$ionicView.beforeEnter", function(event) { $scope.currentPin = $scope.confirmPin = ''; $scope.fromSettings = $stateParams.fromSettings == 'true' ? true : false; $scope.locking = $stateParams.locking == 'true' ? true : false; - $scope.match = false; - $scope.error = false; + $scope.match = $scope.error = $scope.disableButtons = false; + $scope.currentAttempts = 0; $scope.appName = appConfigService.name; }); + $scope.$on("$ionicView.enter", function(event) { + configService.whenAvailable(function(config) { + $scope.bannedUntil = config.lock.bannedUntil || null; + if ($scope.bannedUntil) { + var now = Math.floor(Date.now() / 1000); + if (now < $scope.bannedUntil) { + $scope.error = $scope.disableButtons = true; + lockTimeControl($scope.bannedUntil); + } + } + }); + }); + + function checkAttempts() { + $scope.currentAttempts += 1; + $log.debug('Attempts to unlock:', $scope.currentAttempts); + if ($scope.currentAttempts === 3) { + $scope.currentAttempts = 0; + var limitTime = Math.floor(Date.now() / 1000) + 5 * 60; + var config = configService.getSync(); + var opts = { + lock: { + method: PIN, + value: config.lock.value, + bannedUntil: limitTime, + attempts: config.lock.attempts + 1, + } + }; + + configService.set(opts, function(err) { + if (err) $log.debug(err); + lockTimeControl(limitTime); + }); + } + }; + + function lockTimeControl(limitTime) { + $scope.limitTimeExpired = false; + setExpirationTime(); + + var countDown = $interval(function() { + setExpirationTime(); + }, 1000); + + function setExpirationTime() { + var now = Math.floor(Date.now() / 1000); + if (now > limitTime) { + $scope.limitTimeExpired = true; + if (countDown) reset(); + } else { + $scope.disableButtons = true; + var totalSecs = limitTime - now; + var m = Math.floor(totalSecs / 60); + var s = totalSecs % 60; + $scope.expires = ('0' + m).slice(-2) + ":" + ('0' + s).slice(-2); + } + }; + + function reset() { + $scope.expires = $scope.error = $scope.disableButtons = null; + $scope.currentPin = $scope.confirmPin = ''; + $interval.cancel(countDown); + $timeout(function() { + $scope.$apply(); + }); + return; + }; + }; + $scope.getFilledClass = function(limit) { return $scope.currentPin.length >= limit ? 'filled-' + $scope.appName : null; }; $scope.delete = function() { + if ($scope.disableButtons) return; if ($scope.currentPin.length > 0) { $scope.currentPin = $scope.currentPin.substring(0, $scope.currentPin.length - 1); $scope.error = false; @@ -30,6 +101,7 @@ angular.module('copayApp.controllers').controller('pinController', function($sta }; $scope.updatePin = function(value) { + if ($scope.disableButtons) return; $scope.error = false; if (value && !$scope.isComplete()) { $scope.currentPin = $scope.currentPin + value; @@ -46,11 +118,17 @@ angular.module('copayApp.controllers').controller('pinController', function($sta $scope.match = config.lock && config.lock.method == PIN && config.lock.value == $scope.currentPin ? true : false; if (!$scope.locking) { if ($scope.match) { - $scope.fromSettings ? saveSettings() : $scope.close(150); - $scope.error = false; + if ($scope.fromSettings) saveSettings(); + else { + saveSettings(PIN, $scope.currentPin); + $scope.error = false; + } } else { - $scope.confirmPin = $scope.currentPin = ''; - $scope.error = true; + $timeout(function() { + $scope.confirmPin = $scope.currentPin = ''; + $scope.error = true; + }, 200); + checkAttempts(); } } else { processCodes(); @@ -59,8 +137,8 @@ angular.module('copayApp.controllers').controller('pinController', function($sta function processCodes() { if (!$scope.confirmPin) { - $scope.confirmPin = $scope.currentPin; $timeout(function() { + $scope.confirmPin = $scope.currentPin; $scope.currentPin = ''; }, 200); } else { @@ -77,10 +155,13 @@ angular.module('copayApp.controllers').controller('pinController', function($sta }; function saveSettings(method, value) { + var config = configService.getSync(); var opts = { lock: { method: method || '', value: value || '', + bannedUntil: null, + attempts: config.lock.attempts + 1, } }; diff --git a/src/js/services/configService.js b/src/js/services/configService.js index b60e1cb13..3d979af7f 100644 --- a/src/js/services/configService.js +++ b/src/js/services/configService.js @@ -56,6 +56,8 @@ angular.module('copayApp.services').factory('configService', function(storageSer lock: { method: '', value: '', + bannedUntil: null, + attempts: null, }, // External services diff --git a/src/sass/views/pin.scss b/src/sass/views/pin.scss index 6f3733230..3d695f185 100644 --- a/src/sass/views/pin.scss +++ b/src/sass/views/pin.scss @@ -25,9 +25,11 @@ .block-text { align-items: center; background-color: #F1F1F1; - text-align: center; height: 30%; border-bottom: 1px solid #c5c5c5; + .message { + margin: auto; + } span { width: 60%; margin: 10% auto; @@ -88,5 +90,6 @@ } .error { color: #f13333; + max-width: 70%; } } diff --git a/www/views/pin.html b/www/views/pin.html index f1c4f6fa0..613bd3a66 100644 --- a/www/views/pin.html +++ b/www/views/pin.html @@ -5,9 +5,12 @@
- Please enter your mobile unlock code - Confirm your mobile unlock code - Incorrect code, try again. +
Please enter your unlock PIN
+
Confirm your unlock PIN
+
+
Incorrect PIN, try again.
+ +
From 25a5e44b216fb9466098d72f912843c6a02990f2 Mon Sep 17 00:00:00 2001 From: JDonadio Date: Thu, 30 Mar 2017 12:38:23 -0300 Subject: [PATCH 36/83] move to tab-settings --- src/js/controllers/advancedSettings.js | 4 +--- src/js/controllers/tab-settings.js | 5 +++++ www/views/advancedSettings.html | 9 --------- www/views/tab-settings.html | 10 ++++++++++ 4 files changed, 16 insertions(+), 12 deletions(-) diff --git a/src/js/controllers/advancedSettings.js b/src/js/controllers/advancedSettings.js index 1617ef9fe..5b213b053 100644 --- a/src/js/controllers/advancedSettings.js +++ b/src/js/controllers/advancedSettings.js @@ -1,6 +1,6 @@ 'use strict'; -angular.module('copayApp.controllers').controller('advancedSettingsController', function($scope, $log, configService, platformInfo) { +angular.module('copayApp.controllers').controller('advancedSettingsController', function($scope, $log, configService) { var updateConfig = function() { var config = configService.getSync(); @@ -50,8 +50,6 @@ angular.module('copayApp.controllers').controller('advancedSettingsController', }; $scope.$on("$ionicView.beforeEnter", function(event, data) { - $scope.isCordova = platformInfo.isCordova; - $scope.isDevel = platformInfo.isDevel; updateConfig(); }); diff --git a/src/js/controllers/tab-settings.js b/src/js/controllers/tab-settings.js index ca350bc51..00a58359b 100644 --- a/src/js/controllers/tab-settings.js +++ b/src/js/controllers/tab-settings.js @@ -51,7 +51,12 @@ angular.module('copayApp.controllers').controller('tabSettingsController', funct $scope.$on("$ionicView.beforeEnter", function(event, data) { $scope.isCordova = platformInfo.isCordova; + $scope.isDevel = platformInfo.isDevel; $scope.appName = appConfigService.nameCase; + configService.whenAvailable(function(config) { + $scope.locked = config.lock.method == 'fingerprint' || config.lock.value || false; + $scope.method = config.lock.method != '' ? config.lock.method.charAt(0).toUpperCase() + config.lock.method.slice(1) : gettextCatalog.getString('Disabled'); + }); }); $scope.$on("$ionicView.enter", function(event, data) { diff --git a/www/views/advancedSettings.html b/www/views/advancedSettings.html index 74cf47341..7181505f8 100644 --- a/www/views/advancedSettings.html +++ b/www/views/advancedSettings.html @@ -28,15 +28,6 @@ Hide Next Steps Card - -
diff --git a/www/views/tab-settings.html b/www/views/tab-settings.html index b12ab2b5d..e0bbe0e0e 100644 --- a/www/views/tab-settings.html +++ b/www/views/tab-settings.html @@ -89,6 +89,16 @@ + + + + {{'Lock App' | translate}} + + {{method}} + + + +
{{'Wallets & Integrations' | translate}}
Date: Thu, 30 Mar 2017 17:45:57 -0300 Subject: [PATCH 37/83] backup control --- src/js/controllers/lock.js | 35 ++++++++++++++++++++++++++++++----- www/views/lock.html | 12 ++++++++---- 2 files changed, 38 insertions(+), 9 deletions(-) diff --git a/src/js/controllers/lock.js b/src/js/controllers/lock.js index 2073ac76e..4046fd8f3 100644 --- a/src/js/controllers/lock.js +++ b/src/js/controllers/lock.js @@ -1,6 +1,6 @@ 'use strict'; -angular.module('copayApp.controllers').controller('lockController', function($state, $scope, $timeout, $log, configService, popupService, gettextCatalog, appConfigService, fingerprintService) { +angular.module('copayApp.controllers').controller('lockController', function($state, $scope, $timeout, $log, configService, popupService, gettextCatalog, appConfigService, fingerprintService, profileService, lodash) { $scope.$on("$ionicView.beforeEnter", function(event) { var config = configService.getSync(); @@ -12,21 +12,46 @@ angular.module('copayApp.controllers').controller('lockController', function($st $scope.useFingerprint = { enabled: config.lock && config.lock.method == 'fingerprint' ? true : false }; + + processWallets(); }); + function processWallets() { + var wallets = profileService.getWallets(); + var singleLivenetWallet = wallets.length == 1 && wallets[0].network == 'livenet' && wallets[0].needsBackup; + var atLeastOneLivenetWallet = lodash.any(wallets, function(w) { + return w.network == 'livenet' && w.needsBackup; + }); + + if (singleLivenetWallet) { + $scope.errorMsg = gettextCatalog.getString('Backup your wallet before using this function'); + } else if (atLeastOneLivenetWallet) { + $scope.errorMsg = gettextCatalog.getString('Backup all livenet wallets before using this function'); + } else $scope.errorMsg = null; + + $timeout(function() { + $scope.$apply(); + }); + }; + $scope.usePinChange = function() { - $state.go('tabs.lock.pin', { + $scope.usePin.enabled = !$scope.usePin.enabled; + $state.transitionTo('tabs.lock.pin', { fromSettings: true, - locking: $scope.usePin.enabled + locking: !$scope.usePin.enabled + }).then(function() { + $timeout(function() { + $scope.usePin.enabled = !$scope.usePin.enabled; + }, 1000); }); }; $scope.useFingerprintChange = function() { if ($scope.usePin.enabled) { - var message = gettextCatalog.getString('{{appName}} is protected by Pin Code. Are you sure you want to disable it?', { + var message = gettextCatalog.getString('{{appName}} is protected by Pin. Are you sure you want to disable it?', { appName: appConfigService.nameCase }); - var okText = gettextCatalog.getString('Yes'); + var okText = gettextCatalog.getString('Continue'); var cancelText = gettextCatalog.getString('Cancel'); popupService.showConfirm(null, message, okText, cancelText, function(ok) { if (!ok) { diff --git a/www/views/lock.html b/www/views/lock.html index fd416ddb5..344889926 100644 --- a/www/views/lock.html +++ b/www/views/lock.html @@ -6,14 +6,18 @@ - - Enable Pin + + Enable Pin
- - Enable Fingerprint + + Enable Fingerprint
+ +
+ {{errorMsg}} +
From b6f80138805889f07c9ceaaf019c57e923e3951b Mon Sep 17 00:00:00 2001 From: JDonadio Date: Tue, 4 Apr 2017 15:14:42 -0300 Subject: [PATCH 38/83] use radio buttons - refactor --- src/js/controllers/lock.js | 137 ++++++++++++++++++++++--------------- www/views/lock.html | 14 ++-- 2 files changed, 86 insertions(+), 65 deletions(-) diff --git a/src/js/controllers/lock.js b/src/js/controllers/lock.js index 4046fd8f3..8932ce8df 100644 --- a/src/js/controllers/lock.js +++ b/src/js/controllers/lock.js @@ -1,18 +1,38 @@ 'use strict'; angular.module('copayApp.controllers').controller('lockController', function($state, $scope, $timeout, $log, configService, popupService, gettextCatalog, appConfigService, fingerprintService, profileService, lodash) { + var NONE = 'none'; + var PIN = 'pin'; + var FINGERPRINT = 'fingerprint'; $scope.$on("$ionicView.beforeEnter", function(event) { var config = configService.getSync(); - $scope.fingerprintAvailable = fingerprintService.isAvailable(); + $scope.locking = config.lock.method != PIN; - $scope.usePin = { - enabled: config.lock && config.lock.method == 'pin' ? true : false - }; - $scope.useFingerprint = { - enabled: config.lock && config.lock.method == 'fingerprint' ? true : false - }; + $scope.options = [ + { + method: NONE, + label: gettextCatalog.getString('Disabled'), + value: config.lock.method == '', + }, + { + method: PIN, + label: gettextCatalog.getString('Enable PIN'), + value: config.lock.method == PIN, + needsBackup: null, + }, + ]; + if (fingerprintService.isAvailable()) { + $scope.options.push({ + method: FINGERPRINT, + label: gettextCatalog.getString('Enable Fingerprint'), + value: config.lock.method == FINGERPRINT, + needsBackup: null, + }); + } + + $scope.currentOption = lodash.find($scope.options, 'value'); processWallets(); }); @@ -25,66 +45,73 @@ angular.module('copayApp.controllers').controller('lockController', function($st if (singleLivenetWallet) { $scope.errorMsg = gettextCatalog.getString('Backup your wallet before using this function'); + disableOptsUntilBackup(); } else if (atLeastOneLivenetWallet) { $scope.errorMsg = gettextCatalog.getString('Backup all livenet wallets before using this function'); - } else $scope.errorMsg = null; + disableOptsUntilBackup(); + } else { + enableOptsAfterBackup(); + $scope.errorMsg = null; + } + + function enableOptsAfterBackup() { + $scope.options[1].needsBackup = false; + if ($scope.options[2]) $scope.options[2].needsBackup = false; + }; + + function disableOptsUntilBackup() { + $scope.options[1].needsBackup = true; + if ($scope.options[2]) $scope.options[2].needsBackup = true; + }; $timeout(function() { $scope.$apply(); }); }; - $scope.usePinChange = function() { - $scope.usePin.enabled = !$scope.usePin.enabled; - $state.transitionTo('tabs.lock.pin', { - fromSettings: true, - locking: !$scope.usePin.enabled - }).then(function() { - $timeout(function() { - $scope.usePin.enabled = !$scope.usePin.enabled; - }, 1000); + $scope.select = function(method) { + if (method == NONE) + saveConfig(); + else if (method == FINGERPRINT) { + var config = configService.getSync(); + if (config.lock.method == PIN) { + askForDisablePin(function(disablePin) { + if (disablePin) saveConfig(FINGERPRINT); + }); + } else saveConfig(FINGERPRINT); + } else if (method == PIN) { + $state.transitionTo('tabs.lock.pin', { + fromSettings: true, + locking: $scope.locking + }); + } + $timeout(function() { + $scope.$apply(); }); }; - $scope.useFingerprintChange = function() { - if ($scope.usePin.enabled) { - var message = gettextCatalog.getString('{{appName}} is protected by Pin. Are you sure you want to disable it?', { - appName: appConfigService.nameCase - }); - var okText = gettextCatalog.getString('Continue'); - var cancelText = gettextCatalog.getString('Cancel'); - popupService.showConfirm(null, message, okText, cancelText, function(ok) { - if (!ok) { - $scope.useFingerprint = { - enabled: false - }; - $timeout(function() { - $scope.$apply(); - }); - return; - } - saveConfig(); - }); - } else - saveConfig(); + function askForDisablePin(cb) { + var message = gettextCatalog.getString('{{appName}} is protected by Pin. Are you sure you want to disable it?', { + appName: appConfigService.nameCase + }); + var okText = gettextCatalog.getString('Continue'); + var cancelText = gettextCatalog.getString('Cancel'); + popupService.showConfirm(null, message, okText, cancelText, function(ok) { + if (!ok) return cb(false); + return cb(true); + }); + }; - function saveConfig() { - $scope.usePin = { - enabled: false - }; - $timeout(function() { - $scope.$apply(); - }); - var opts = { - lock: { - method: $scope.useFingerprint.enabled ? 'fingerprint' : '', - value: '', - } - }; - - configService.set(opts, function(err) { - if (err) $log.debug(err); - }); + function saveConfig(method) { + var opts = { + lock: { + method: method || '', + value: '', + } }; + + configService.set(opts, function(err) { + if (err) $log.debug(err); + }); }; }); diff --git a/www/views/lock.html b/www/views/lock.html index 344889926..d0e49e15e 100644 --- a/www/views/lock.html +++ b/www/views/lock.html @@ -6,17 +6,11 @@ - - Enable Pin - + + {{opt.label}} + -
- - Enable Fingerprint - -
- -
+
{{errorMsg}}
From 5b1c84b5f7cb22983209f5c7df4a6c45ee8ff1c2 Mon Sep 17 00:00:00 2001 From: JDonadio Date: Tue, 4 Apr 2017 16:47:36 -0300 Subject: [PATCH 39/83] refresh selected option --- src/js/controllers/lock.js | 7 ++++++- src/js/controllers/tab-settings.js | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/js/controllers/lock.js b/src/js/controllers/lock.js index 8932ce8df..3f64c700f 100644 --- a/src/js/controllers/lock.js +++ b/src/js/controllers/lock.js @@ -5,7 +5,7 @@ angular.module('copayApp.controllers').controller('lockController', function($st var PIN = 'pin'; var FINGERPRINT = 'fingerprint'; - $scope.$on("$ionicView.beforeEnter", function(event) { + function init() { var config = configService.getSync(); $scope.locking = config.lock.method != PIN; @@ -34,6 +34,10 @@ angular.module('copayApp.controllers').controller('lockController', function($st $scope.currentOption = lodash.find($scope.options, 'value'); processWallets(); + }; + + $scope.$on("$ionicView.beforeEnter", function(event) { + init(); }); function processWallets() { @@ -77,6 +81,7 @@ angular.module('copayApp.controllers').controller('lockController', function($st if (config.lock.method == PIN) { askForDisablePin(function(disablePin) { if (disablePin) saveConfig(FINGERPRINT); + else init(); }); } else saveConfig(FINGERPRINT); } else if (method == PIN) { diff --git a/src/js/controllers/tab-settings.js b/src/js/controllers/tab-settings.js index 00a58359b..80152ca61 100644 --- a/src/js/controllers/tab-settings.js +++ b/src/js/controllers/tab-settings.js @@ -54,8 +54,8 @@ angular.module('copayApp.controllers').controller('tabSettingsController', funct $scope.isDevel = platformInfo.isDevel; $scope.appName = appConfigService.nameCase; configService.whenAvailable(function(config) { - $scope.locked = config.lock.method == 'fingerprint' || config.lock.value || false; - $scope.method = config.lock.method != '' ? config.lock.method.charAt(0).toUpperCase() + config.lock.method.slice(1) : gettextCatalog.getString('Disabled'); + $scope.locked = config.lock && config.lock.method != '' ? true : false; + $scope.method = config.lock && config.lock.method != '' ? config.lock.method.charAt(0).toUpperCase() + config.lock.method.slice(1) : gettextCatalog.getString('Disabled'); }); }); From b040204841dbb55006996da951560dbac43cf17f Mon Sep 17 00:00:00 2001 From: JDonadio Date: Tue, 4 Apr 2017 17:21:03 -0300 Subject: [PATCH 40/83] update messages --- www/views/pin.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/www/views/pin.html b/www/views/pin.html index 613bd3a66..34816f2a2 100644 --- a/www/views/pin.html +++ b/www/views/pin.html @@ -5,11 +5,11 @@
-
Please enter your unlock PIN
-
Confirm your unlock PIN
+
Please enter your PIN
+
Confirm your PIN
Incorrect PIN, try again.
- +
From 618ce1468835a884d42bd9baeeeac0e7e69ea04e Mon Sep 17 00:00:00 2001 From: JDonadio Date: Tue, 4 Apr 2017 18:06:11 -0300 Subject: [PATCH 41/83] fix typo and constants --- src/js/controllers/lock.js | 27 ++++++++++++--------------- src/js/controllers/pin.js | 16 ++++++++-------- 2 files changed, 20 insertions(+), 23 deletions(-) diff --git a/src/js/controllers/lock.js b/src/js/controllers/lock.js index 3f64c700f..13c9fccb7 100644 --- a/src/js/controllers/lock.js +++ b/src/js/controllers/lock.js @@ -1,33 +1,30 @@ 'use strict'; angular.module('copayApp.controllers').controller('lockController', function($state, $scope, $timeout, $log, configService, popupService, gettextCatalog, appConfigService, fingerprintService, profileService, lodash) { - var NONE = 'none'; - var PIN = 'pin'; - var FINGERPRINT = 'fingerprint'; function init() { var config = configService.getSync(); - $scope.locking = config.lock.method != PIN; + $scope.locking = config.lock.method != 'pin'; $scope.options = [ { - method: NONE, + method: 'none', label: gettextCatalog.getString('Disabled'), value: config.lock.method == '', }, { - method: PIN, + method: 'pin', label: gettextCatalog.getString('Enable PIN'), - value: config.lock.method == PIN, + value: config.lock.method == 'pin', needsBackup: null, }, ]; if (fingerprintService.isAvailable()) { $scope.options.push({ - method: FINGERPRINT, + method: 'fingerprint', label: gettextCatalog.getString('Enable Fingerprint'), - value: config.lock.method == FINGERPRINT, + value: config.lock.method == 'fingerprint', needsBackup: null, }); } @@ -74,17 +71,17 @@ angular.module('copayApp.controllers').controller('lockController', function($st }; $scope.select = function(method) { - if (method == NONE) + if (method == 'none') saveConfig(); - else if (method == FINGERPRINT) { + else if (method == 'fingerprint') { var config = configService.getSync(); - if (config.lock.method == PIN) { + if (config.lock.method == 'pin') { askForDisablePin(function(disablePin) { - if (disablePin) saveConfig(FINGERPRINT); + if (disablePin) saveConfig('fingerprint'); else init(); }); - } else saveConfig(FINGERPRINT); - } else if (method == PIN) { + } else saveConfig('fingerprint'); + } else if (method == 'pin') { $state.transitionTo('tabs.lock.pin', { fromSettings: true, locking: $scope.locking diff --git a/src/js/controllers/pin.js b/src/js/controllers/pin.js index 9d78b9e65..94dd15d40 100644 --- a/src/js/controllers/pin.js +++ b/src/js/controllers/pin.js @@ -1,8 +1,8 @@ 'use strict'; angular.module('copayApp.controllers').controller('pinController', function($state, $interval, $stateParams, $ionicHistory, $timeout, $scope, $log, configService, appConfigService) { - var PIN = 'pin'; - var ATTEPMPTS_LIMIT = 3; + var ATTEMPT_LIMIT = 3; + var ATTEMPT_LOCK_OUT_TIME = 5 * 60; $scope.$on("$ionicView.beforeEnter", function(event) { $scope.currentPin = $scope.confirmPin = ''; @@ -29,13 +29,13 @@ angular.module('copayApp.controllers').controller('pinController', function($sta function checkAttempts() { $scope.currentAttempts += 1; $log.debug('Attempts to unlock:', $scope.currentAttempts); - if ($scope.currentAttempts === 3) { + if ($scope.currentAttempts === ATTEMPT_LIMIT) { $scope.currentAttempts = 0; - var limitTime = Math.floor(Date.now() / 1000) + 5 * 60; + var limitTime = Math.floor(Date.now() / 1000) + ATTEMPT_LOCK_OUT_TIME; var config = configService.getSync(); var opts = { lock: { - method: PIN, + method: 'pin', value: config.lock.value, bannedUntil: limitTime, attempts: config.lock.attempts + 1, @@ -115,12 +115,12 @@ angular.module('copayApp.controllers').controller('pinController', function($sta $scope.save = function() { if (!$scope.isComplete()) return; var config = configService.getSync(); - $scope.match = config.lock && config.lock.method == PIN && config.lock.value == $scope.currentPin ? true : false; + $scope.match = config.lock && config.lock.method == 'pin' && config.lock.value == $scope.currentPin ? true : false; if (!$scope.locking) { if ($scope.match) { if ($scope.fromSettings) saveSettings(); else { - saveSettings(PIN, $scope.currentPin); + saveSettings('pin', $scope.currentPin); $scope.error = false; } } else { @@ -143,7 +143,7 @@ angular.module('copayApp.controllers').controller('pinController', function($sta }, 200); } else { if ($scope.confirmPin == $scope.currentPin) - saveSettings(PIN, $scope.confirmPin); + saveSettings('pin', $scope.confirmPin); else { $scope.confirmPin = $scope.currentPin = ''; $scope.error = true; From 3da0d499c8859e3dfb9257fe980be7abae2fc29d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Baz=C3=A1n?= Date: Wed, 5 Apr 2017 10:39:00 -0300 Subject: [PATCH 42/83] temporary fix for the tabs confusion --- www/views/walletDetails.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/www/views/walletDetails.html b/www/views/walletDetails.html index 2adee1478..ff3fcf464 100644 --- a/www/views/walletDetails.html +++ b/www/views/walletDetails.html @@ -1,4 +1,4 @@ - + {{wallet.name}} @@ -103,7 +103,7 @@
From 2724911a050f520af2baacee3d71f5af43e50b36 Mon Sep 17 00:00:00 2001 From: JDonadio Date: Wed, 5 Apr 2017 14:38:06 -0300 Subject: [PATCH 43/83] fix params and errors handling --- src/js/services/incomingData.js | 10 ++--- src/js/services/payproService.js | 64 +++++++++++++------------------- 2 files changed, 31 insertions(+), 43 deletions(-) diff --git a/src/js/services/incomingData.js b/src/js/services/incomingData.js index 0c730ed79..c9d633eb8 100644 --- a/src/js/services/incomingData.js +++ b/src/js/services/incomingData.js @@ -1,6 +1,6 @@ 'use strict'; -angular.module('copayApp.services').factory('incomingData', function($log, $state, $timeout, $ionicHistory, bitcore, $rootScope, payproService, scannerService, appConfigService) { +angular.module('copayApp.services').factory('incomingData', function($log, $state, $timeout, $ionicHistory, bitcore, $rootScope, payproService, scannerService, appConfigService, popupService, gettextCatalog) { var root = {}; @@ -93,10 +93,10 @@ angular.module('copayApp.services').factory('incomingData', function($log, $stat if (parsed.r) { payproService.getPayProDetails(parsed.r, function(err, details) { - if (err && addr && amount) { - goSend(addr, amount, message); - } - handlePayPro(details); + if (err) { + if (addr && amount) goSend(addr, amount, message); + else popupService.showAlert(gettextCatalog.getString('Error'), err); + } else handlePayPro(details); }); } else { goSend(addr, amount, message); diff --git a/src/js/services/payproService.js b/src/js/services/payproService.js index ba5adb4b9..96ed90441 100644 --- a/src/js/services/payproService.js +++ b/src/js/services/payproService.js @@ -1,51 +1,39 @@ 'use strict'; angular.module('copayApp.services').factory('payproService', -function($window, profileService, platformInfo, popupService, gettextCatalog, ongoingProcess, $log) { + function(profileService, platformInfo, gettextCatalog, ongoingProcess, $log) { - var ret = {}; + var ret = {}; - ret.getPayProDetails = function(uri, cb, disableLoader) { - if (!cb) cb = function() {}; + ret.getPayProDetails = function(uri, cb, disableLoader) { + if (!cb) cb = function() {}; - var wallet = profileService.getWallets({ - onlyComplete: true - })[0]; + var wallet = profileService.getWallets({ + onlyComplete: true + })[0]; - if (!wallet) return cb(); + if (!wallet) return cb(); - if (platformInfo.isChromeApp) { - popupService.showAlert(gettextCatalog.getString('Payment Protocol not supported on Chrome App')); - return cb(true); - } - - $log.debug('Fetch PayPro Request...', uri); - - if(!disableLoader) { - ongoingProcess.set('fetchingPayPro', true); - } - - wallet.fetchPayPro({ - payProUrl: uri, - }, function(err, paypro) { - - if(!disableLoader) { - ongoingProcess.set('fetchingPayPro', false); + if (platformInfo.isChromeApp) { + return cb(gettextCatalog.getString('Payment Protocol not supported on Chrome App')); } - if (err) { - return cb(true); - } + $log.debug('Fetch PayPro Request...', uri); - if (!paypro.verified) { - $log.warn('Failed to verify payment protocol signatures'); - popupService.showAlert(gettextCatalog.getString('Payment Protocol Invalid')); - return cb(true); - } - cb(null, paypro); + if (!disableLoader) ongoingProcess.set('fetchingPayPro', true); - }); - }; + wallet.fetchPayPro({ + payProUrl: uri, + }, function(err, paypro) { + if (!disableLoader) ongoingProcess.set('fetchingPayPro', false); + if (err) return cb(err); + else if (!paypro.verified) { + $log.warn('Failed to verify payment protocol signatures'); + return cb(gettextCatalog.getString('Payment Protocol Invalid')); + } + return cb(null, paypro); + }); + }; - return ret; -}); + return ret; + }); From c7ed4f831aa4c6d5032bf423c6a3da019f447388 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Baz=C3=A1n?= Date: Thu, 6 Apr 2017 17:18:57 -0300 Subject: [PATCH 44/83] fixing desktop redirect from starting to home view --- src/js/routes.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/js/routes.js b/src/js/routes.js index 6b6f4625d..2ed1d50bf 100644 --- a/src/js/routes.js +++ b/src/js/routes.js @@ -1273,17 +1273,16 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr goTo('pin'); } else goTo('tabs.home'); + }); + } else goTo('tabs.home'); - function goTo(nextView) { - $state.transitionTo(nextView).then(function() { - $ionicHistory.clearHistory(); - }); - }; + function goTo(nextView) { + $state.transitionTo(nextView).then(function() { + $ionicHistory.clearHistory(); }); } }); - } - + }; // After everything have been loaded, initialize handler URL $timeout(function() { openURLService.init(); From d25e28f20a5c3820782c618230d7d1577aa3bb41 Mon Sep 17 00:00:00 2001 From: JDonadio Date: Fri, 7 Apr 2017 10:46:54 -0300 Subject: [PATCH 45/83] fix resume event navigation --- src/js/routes.js | 38 +++++++++++++++++--------------------- www/views/lockedView.html | 6 +++--- 2 files changed, 20 insertions(+), 24 deletions(-) diff --git a/src/js/routes.js b/src/js/routes.js index 2ed1d50bf..45cbc9249 100644 --- a/src/js/routes.js +++ b/src/js/routes.js @@ -1196,28 +1196,24 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr }); $ionicPlatform.on('resume', function() { - if (platformInfo.isCordova || platformInfo.isDevel) { - configService.whenAvailable(function(config) { - var nextView; - var lock = config.lock; - if (lock && lock.method == 'fingerprint' && fingerprintService.isAvailable()) { - fingerprintService.check('unlockingApp', function(err) { - if (err) nextView = 'lockedView'; - else if ($ionicHistory.currentStateName() == 'lockedView') nextView = 'tabs.home'; - else nextView = $ionicHistory.currentStateName(); - goTo(nextView); - }); - } else if (lock && lock.method == 'pin') { - goTo('pin'); - } + configService.whenAvailable(function(config) { + var nextView; + var lock = config.lock; + if (lock && lock.method == 'fingerprint' && fingerprintService.isAvailable()) { + fingerprintService.check('unlockingApp', function(err) { + if (err) goTo('lockedView'); + else if ($ionicHistory.currentStateName() == 'lockedView') goTo('tabs.home'); + }); + } else if (lock && lock.method == 'pin') { + goTo('pin'); + } - function goTo(nextView) { - $state.transitionTo(nextView).then(function() { - if (nextView == 'lockedView') $ionicHistory.clearHistory(); - }); - }; - }); - } + function goTo(nextView) { + $state.transitionTo(nextView).then(function() { + if (nextView == 'lockedView') $ionicHistory.clearHistory(); + }); + }; + }); }); $ionicPlatform.on('menubutton', function() { diff --git a/www/views/lockedView.html b/www/views/lockedView.html index 98ca5a986..0c86ea7f6 100644 --- a/www/views/lockedView.html +++ b/www/views/lockedView.html @@ -4,13 +4,13 @@ -
+
-
+
-
+
One-touch Sign In
Please place your fingertip on the scanner to verify your identity
From acd91e01e69a8731127089fc63e60440a30875de Mon Sep 17 00:00:00 2001 From: Matias Alejo Garcia Date: Mon, 10 Apr 2017 13:37:57 -0300 Subject: [PATCH 46/83] better gift-card-err --- src/js/controllers/buyAmazon.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/js/controllers/buyAmazon.js b/src/js/controllers/buyAmazon.js index a281ed342..48c502869 100644 --- a/src/js/controllers/buyAmazon.js +++ b/src/js/controllers/buyAmazon.js @@ -145,7 +145,13 @@ angular.module('copayApp.controllers').controller('buyAmazonController', functio amazonService.createBitPayInvoice(dataSrc, function(err, dataInvoice) { if (err) { ongoingProcess.set('buyingGiftCard', false, statusChangeHandler); - showError('Error creating BitPay invoice', err); + + if (err && err.message && err.message.match(/suspended/i)) { + showError('Service not available', 'Amazon Gift Card Service is not available at this moment. Please try back later.'); + } else { + showError('Could not access Gift Card Service', err); + }; + return; } From 0c69dfb06184cfb61c82d9f08868c057212facfe Mon Sep 17 00:00:00 2001 From: Andy Phillipson Date: Mon, 5 Dec 2016 17:33:46 -0500 Subject: [PATCH 47/83] Initial Intel TEE integration. --- app-template/package-template.json | 2 +- src/js/controllers/create.js | 39 ++-- src/js/controllers/import.js | 20 +- src/js/controllers/join.js | 14 +- src/js/controllers/preferences.js | 3 - src/js/controllers/preferencesExternal.js | 24 +++ src/js/controllers/preferencesInformation.js | 8 + src/js/controllers/tab-receive.js | 16 ++ src/js/routes.js | 9 + src/js/services/hwWallet.js | 51 +++-- src/js/services/intelTEE.js | 191 +++++++++++++++++++ src/js/services/ledger.js | 36 ++-- src/js/services/platformInfo.js | 1 + src/js/services/profileService.js | 1 + src/js/services/trezor.js | 24 ++- src/js/services/walletService.js | 48 ++++- www/img/icon-inteltee-white.svg | 28 +++ www/views/includes/walletInfo.html | 8 +- www/views/preferences.html | 6 - www/views/preferencesExternal.html | 14 ++ www/views/preferencesInformation.html | 7 + www/views/tab-create-shared.html | 2 +- www/views/tab-import-hardware.html | 2 +- www/views/tab-receive.html | 13 ++ 24 files changed, 492 insertions(+), 75 deletions(-) create mode 100644 src/js/controllers/preferencesExternal.js create mode 100644 src/js/services/intelTEE.js create mode 100644 www/img/icon-inteltee-white.svg create mode 100644 www/views/preferencesExternal.html diff --git a/app-template/package-template.json b/app-template/package-template.json index c6b567f25..054526a24 100644 --- a/app-template/package-template.json +++ b/app-template/package-template.json @@ -56,7 +56,7 @@ "bezier-easing": "^2.0.3", "bhttp": "^1.2.1", "bitauth": "https://github.com/gabrielbazan7/bitauth.git#copay", - "bitcore-wallet-client": "5.1.2", + "bitcore-wallet-client": "git://github.com/isocolsky/bitcore-wallet-client#369eaede49cd64836015fb9b8a502092ee84dc7c", "bower": "^1.7.9", "cordova-android": "5.1.1", "cordova-custom-config": "^3.0.5", diff --git a/src/js/controllers/create.js b/src/js/controllers/create.js index 78561a45a..6316fd4f8 100644 --- a/src/js/controllers/create.js +++ b/src/js/controllers/create.js @@ -1,7 +1,7 @@ 'use strict'; angular.module('copayApp.controllers').controller('createController', - function($scope, $rootScope, $timeout, $log, lodash, $state, $ionicScrollDelegate, $ionicHistory, profileService, configService, gettextCatalog, ledger, trezor, platformInfo, derivationPathHelper, ongoingProcess, walletService, storageService, popupService, appConfigService) { + function($scope, $rootScope, $timeout, $log, lodash, $state, $ionicScrollDelegate, $ionicHistory, profileService, configService, gettextCatalog, ledger, trezor, intelTEE, platformInfo, derivationPathHelper, ongoingProcess, walletService, storageService, popupService, appConfigService) { var isChromeApp = platformInfo.isChromeApp; var isCordova = platformInfo.isCordova; @@ -68,6 +68,9 @@ angular.module('copayApp.controllers').controller('createController', id: 'new', label: gettextCatalog.getString('Random'), }, { + id: walletService.externalSource.intelTEE.id, + label: gettextCatalog(walletService.externalSource.intelTEE.name), + }, { id: 'set', label: gettextCatalog.getString('Specify Recovery Phrase...'), }]; @@ -81,16 +84,16 @@ angular.module('copayApp.controllers').controller('createController', */ if (appConfigService.name == 'copay') { - if (n > 1 && isChromeApp) { + if (n > 1 && isChromeApp) seedOptions.push({ - id: 'ledger', - label: 'Ledger Hardware Wallet', + id: walletService.externalSource.ledger.id, + label: walletService.externalSource.ledger.longName, }); - } + if (isChromeApp || isDevel) { seedOptions.push({ - id: 'trezor', - label: 'Trezor Hardware Wallet', + id: walletService.externalSource.trezor.id, + label: walletService.externalSource.trezor.longName, }); } } @@ -151,22 +154,36 @@ angular.module('copayApp.controllers').controller('createController', return; } - if ($scope.seedSource.id == 'ledger' || $scope.seedSource.id == 'trezor') { + if ($scope.seedSource.id == walletService.externalSource.ledger.id || $scope.seedSource.id == walletService.externalSource.trezor.id || self.seedSourceId == walletService.externalSource.intelTEE.id) { var account = $scope.formData.account; if (!account || account < 1) { popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Invalid account number')); return; } - if ($scope.seedSource.id == 'trezor') + if ($scope.seedSource.id == walletService.externalSource.trezor.id || self.seedSource.id == walletService.externalSource.intelTEE.id) account = account - 1; opts.account = account; ongoingProcess.set('connecting' + $scope.seedSource.id, true); - var src = $scope.seedSource.id == 'ledger' ? ledger : trezor; + var src; + switch (self.seedSourceId) { + case walletService.externalSource.ledger.id: + src = legder; + break; + case walletService.externalSource.trezor.id: + src = trezor; + break; + case walletService.externalSource.intelTEE.id: + src = intelTEE; + break; + default: + this.error = gettextCatalog('Invalid seed source id: ' + self.seedSourceId); + return; + } - src.getInfoForNewWallet(opts.n > 1, account, function(err, lopts) { + src.getInfoForNewWallet(opts, function(err, lopts) { ongoingProcess.set('connecting' + $scope.seedSource.id, false); if (err) { popupService.showAlert(gettextCatalog.getString('Error'), err); diff --git a/src/js/controllers/import.js b/src/js/controllers/import.js index 3b1c96771..4964058ef 100644 --- a/src/js/controllers/import.js +++ b/src/js/controllers/import.js @@ -3,6 +3,8 @@ angular.module('copayApp.controllers').controller('importController', function($scope, $timeout, $log, $state, $stateParams, $ionicHistory, $ionicScrollDelegate, profileService, configService, sjcl, ledger, trezor, derivationPathHelper, platformInfo, bwcService, ongoingProcess, walletService, popupService, gettextCatalog, appConfigService) { + var isChromeApp = platformInfo.isChromeApp; + var isDevel = platformInfo.isDevel; var reader = new FileReader(); var defaults = configService.getDefaults(); var errors = bwcService.getErrors(); @@ -25,15 +27,15 @@ angular.module('copayApp.controllers').controller('importController', if ($scope.isChromeApp) { $scope.seedOptions.push({ - id: 'ledger', - label: 'Ledger Hardware Wallet', + id: walletService.externalSource.ledger.id, + label: walletService.externalSource.ledger.longName, }); } if ($scope.isChromeApp || $scope.isDevel) { $scope.seedOptions.push({ - id: 'trezor', - label: 'Trezor Hardware Wallet', + id: walletService.externalSource.trezor.id, + label: walletService.externalSource.ledger.longName, }); $scope.formData.seedSource = $scope.seedOptions[0]; } @@ -267,7 +269,7 @@ angular.module('copayApp.controllers').controller('importController', return; } - lopts.externalSource = 'trezor'; + lopts.externalSource = walletService.externalSource.trezor.id; lopts.bwsurl = $scope.formData.bwsurl; ongoingProcess.set('importingWallet', true); $log.debug('Import opts', lopts); @@ -293,7 +295,7 @@ angular.module('copayApp.controllers').controller('importController', var account = $scope.formData.account; - if ($scope.formData.seedSource.id == 'trezor') { + if ($scope.formData.seedSource.id == walletService.externalSource.trezor.id) { if (account < 1) { popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Invalid account number')); return; @@ -302,11 +304,11 @@ angular.module('copayApp.controllers').controller('importController', } switch ($scope.formData.seedSource.id) { - case ('ledger'): + case (walletService.externalSource.ledger.id): ongoingProcess.set('connectingledger', true); $scope.importLedger(account); break; - case ('trezor'): + case (walletService.externalSource.trezor.id): ongoingProcess.set('connectingtrezor', true); $scope.importTrezor(account, $scope.formData.isMultisig); break; @@ -323,7 +325,7 @@ angular.module('copayApp.controllers').controller('importController', return; } - lopts.externalSource = 'ledger'; + lopts.externalSource = lopts.externalSource = walletService.externalSource.ledger.id; lopts.bwsurl = $scope.formData.bwsurl; ongoingProcess.set('importingWallet', true); $log.debug('Import opts', lopts); diff --git a/src/js/controllers/join.js b/src/js/controllers/join.js index 74abe3228..3bbf4813b 100644 --- a/src/js/controllers/join.js +++ b/src/js/controllers/join.js @@ -66,15 +66,15 @@ angular.module('copayApp.controllers').controller('joinController', if (appConfigService.name == 'copay') { if (isChromeApp) { self.seedOptions.push({ - id: 'ledger', - label: 'Ledger Hardware Wallet', + id: walletService.externalSource.ledger.id, + label: walletService.externalSource.ledger.longName, }); } if (isChromeApp || isDevel) { self.seedOptions.push({ - id: 'trezor', - label: 'Trezor Hardware Wallet', + id: walletService.externalSource.trezor.id, + label: walletService.externalSource.trezor.longName, }); } } @@ -130,19 +130,19 @@ angular.module('copayApp.controllers').controller('joinController', return; } - if (self.seedSourceId == 'ledger' || self.seedSourceId == 'trezor') { + if (self.seedSourceId == walletService.externalSource.ledger.id || self.seedSourceId == walletService.externalSource.trezor.id) { var account = $scope.account; if (!account || account < 1) { popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Invalid account number')); return; } - if (self.seedSourceId == 'trezor') + if (self.seedSourceId == walletService.externalSource.trezor.id) account = account - 1; opts.account = account; ongoingProcess.set('connecting' + self.seedSourceId, true); - var src = self.seedSourceId == 'ledger' ? ledger : trezor; + var src = self.seedSourceId == walletService.externalSource.ledger.id ? ledger : trezor; src.getInfoForNewWallet(true, account, function(err, lopts) { ongoingProcess.set('connecting' + self.seedSourceId, false); diff --git a/src/js/controllers/preferences.js b/src/js/controllers/preferences.js index 8b1a8dde0..90ff53f29 100644 --- a/src/js/controllers/preferences.js +++ b/src/js/controllers/preferences.js @@ -89,9 +89,6 @@ angular.module('copayApp.controllers').controller('preferencesController', value: $scope.wallet.balanceHidden }; - if (wallet.isPrivKeyExternal) - $scope.externalSource = wallet.getPrivKeyExternalSourceName() == 'ledger' ? 'Ledger' : 'Trezor'; - $scope.touchIdAvailable = fingerprintService.isAvailable(); $scope.touchIdEnabled = { value: config.touchIdFor ? config.touchIdFor[walletId] : null diff --git a/src/js/controllers/preferencesExternal.js b/src/js/controllers/preferencesExternal.js new file mode 100644 index 000000000..9be05b92f --- /dev/null +++ b/src/js/controllers/preferencesExternal.js @@ -0,0 +1,24 @@ +'use strict'; + +angular.module('copayApp.controllers').controller('preferencesExternalController', function($scope, lodash, profileService, walletService) { + var wallet = profileService.getWallet($stateParams.walletId); + + $scope.externalSource = lodash.find(walletService.externalSource, function(source) { + return source.id == wallet.getPrivKeyExternalSourceName(); + }).name; + + $scope.showMneumonicFromHardwarePopup = function() { + var title = gettextCatalog.getString('Warning!'); + var message = gettextCatalog.getString('Are you being watched? Anyone with your recovery phrase can access or spend your bitcoin.'); + popupService.showConfirm(title, message, null, null, function(res) { + if (res) { + walletService.showMneumonicFromHardware(wallet, function(err) { + if (err) { + popupService.showAlert(gettextCatalog.getString('Error'), err.message || err); + } + }); + } + }); + }; + +}); \ No newline at end of file diff --git a/src/js/controllers/preferencesInformation.js b/src/js/controllers/preferencesInformation.js index 70ba5484e..21dc3db46 100644 --- a/src/js/controllers/preferencesInformation.js +++ b/src/js/controllers/preferencesInformation.js @@ -44,5 +44,13 @@ angular.module('copayApp.controllers').controller('preferencesInformation', $scope.M = c.m; $scope.N = c.n; $scope.pubKeys = lodash.pluck(c.publicKeyRing, 'xPubKey'); + $scope.externalSource = null; + + if (wallet.isPrivKeyExternal()) { + $scope.externalSource = lodash.find(walletService.externalSource, function(source) { + return source.id == wallet.getPrivKeyExternalSourceName(); + }).name; + } }); + }); diff --git a/src/js/controllers/tab-receive.js b/src/js/controllers/tab-receive.js index 4073e08f9..b8b1a37d2 100644 --- a/src/js/controllers/tab-receive.js +++ b/src/js/controllers/tab-receive.js @@ -145,6 +145,22 @@ angular.module('copayApp.controllers').controller('tabReceiveController', functi }); }; + $scope.shouldShowReceiveAddressFromHardware = function() { + var wallet = $scope.wallet; + if (wallet.isPrivKeyExternal() && wallet.credentials.hwInfo) { + return (wallet.credentials.hwInfo.name == walletService.externalSource.intelTEE.id); + } else { + return false; + } + }; + + $scope.showReceiveAddressFromHardware = function() { + var wallet = $scope.wallet; + if (wallet.isPrivKeyExternal() && wallet.credentials.hwInfo) { + walletService.showReceiveAddressFromHardware(wallet, $scope.addr, function(){}); + } + }; + $scope.$on("$ionicView.beforeEnter", function(event, data) { $scope.wallets = profileService.getWallets(); diff --git a/src/js/routes.js b/src/js/routes.js index 45cbc9249..2e14190c0 100644 --- a/src/js/routes.js +++ b/src/js/routes.js @@ -579,6 +579,15 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr } } }) + .state('tabs.preferences.preferencesExternal', { + url: '/preferencesExternal', + views: { + 'tab-settings@tabs': { + controller: 'preferencesExternalController', + templateUrl: 'views/preferencesExternal.html' + } + } + }) .state('tabs.preferences.delete', { url: '/delete', views: { diff --git a/src/js/services/hwWallet.js b/src/js/services/hwWallet.js index 1c9314164..f3553bf37 100644 --- a/src/js/services/hwWallet.js +++ b/src/js/services/hwWallet.js @@ -6,9 +6,11 @@ angular.module('copayApp.services') // Ledger magic number to get xPub without user confirmation root.ENTROPY_INDEX_PATH = "0xb11e/"; + root.M = 'm/'; root.UNISIG_ROOTPATH = 44; root.MULTISIG_ROOTPATH = 48; root.LIVENET_PATH = 0; + root.TESTNET_PATH = 1; root._err = function(data) { var msg = data.error || data.message || 'unknown'; @@ -17,26 +19,49 @@ angular.module('copayApp.services') root.getRootPath = function(device, isMultisig, account) { - if (!isMultisig) return root.UNISIG_ROOTPATH; - - // Compat - if (device == 'ledger' && account == 0) return root.UNISIG_ROOTPATH; - - return root.MULTISIG_ROOTPATH; + var path; + if (isMultisig) { + path = root.MULTISIG_ROOTPATH; + } else { + if (device == 'ledger' && account > 0) { + path = root.MULTISIG_ROOTPATH; + } else { + path = root.UNISIG_ROOTPATH; + } + } + if (device == 'intelTEE') { + path = root.M + path; + } + return path; }; - root.getAddressPath = function(device, isMultisig, account) { - return root.getRootPath(device, isMultisig, account) + "'/" + root.LIVENET_PATH + "'/" + account + "'"; - } + root.getAddressPath = function(device, isMultisig, account, network) { + network = network || 'livenet'; + var networkPath = root.LIVENET_PATH; + if (network == 'testnet') { + networkPath = root.TESTNET_PATH; + } + return root.getRootPath(device, isMultisig, account) + "'/" + networkPath + "'/" + account + "'"; + }; root.getEntropyPath = function(device, isMultisig, account) { - var path; + var path = root.ENTROPY_INDEX_PATH; + if (isMultisig) { + path = path + "48'/" + } else { + path = path + "44'/" + } // Old ledger wallet compat - if (device == 'ledger' && account == 0) - return root.ENTROPY_INDEX_PATH + "0'"; + if (device == 'ledger' && account == 0) { + return path + "0'/"; + } - return root.ENTROPY_INDEX_PATH + root.getRootPath(device, isMultisig, account) + "'/" + account + "'"; + if (device == 'intelTEE') { + path = root.M + path; + } + + return path + account + "'"; }; root.pubKeyToEntropySource = function(xPubKey) { diff --git a/src/js/services/intelTEE.js b/src/js/services/intelTEE.js new file mode 100644 index 000000000..6840d10bd --- /dev/null +++ b/src/js/services/intelTEE.js @@ -0,0 +1,191 @@ +'use strict'; + +angular.module('copayApp.services') + .factory('intelTEE', function($log, $timeout, gettext, lodash, bitcore, hwWallet, bwcService, platformInfo) { + + var root = {}; + + if (!platformInfo.isIntelTEE) { + return root; + } + + var IntelWallet = require('intelWalletCon'); + var TEE_APP_ID = '63279de1b6cb4dcf8c206716bd318092f8c206716bd31809263279de1b6cb4dc'; + + root.description = { + id: 'intelTEE', + name: 'Intel TEE', + longName: 'Intel TEE Hardware Wallet', + derivationStrategy: 'BIP44' + }; + + root.walletEnclave = new IntelWallet.Wallet(); + var walletEnclaveStatus = root.walletEnclave.initializeEnclave(); + if (walletEnclaveStatus != 0) { + $log.error('Failed to create Intel Wallet enclave'); + } + + root.getInfoForNewWallet = function(opts, callback) { + initSource(opts, function(err, opts) { + if (err) return callback(err); + + var isMultisig = opts.n > 1; + root.getEntropySource(opts.hwInfo.id, isMultisig, opts.account, function(err, entropySource) { + if (err) return callback(err); + + opts.entropySource = entropySource; + root.getXPubKey(opts.hwInfo.id, hwWallet.getAddressPath(root.description.id, isMultisig, opts.account, opts.networkName), function(data) { + if (!data.success) { + $log.warn(data.message); + return callback(data); + } + opts.extendedPublicKey = data.xpubkey; + opts.externalSource = root.description.id; + opts.derivationStrategy = root.description.derivationStrategy; + + return callback(null, opts); + }); + }); + }); + }; + + root.getXPubKey = function(teeWalletId, path, callback) { + $log.debug('TEE deriving xPub path:', path); + + // Expected to be a extended public key. + var xpubkey = root.walletEnclave.getPublicKey(teeWalletId, path); + + // Error messages returned in value. + var result = { + success: false, + message: xpubkey.ExtendedPublicKey + }; + + // Success indicated by status being equal to the tee wallet id. + if (xpubkey.Status == teeWalletId) { + result.success = true; + result.message = 'OK'; + result.xpubkey = xpubkey.ExtendedPublicKey; + } else { + $log.error('Failed to get xpubkey from TEE wallet: ' + result.message); + } + + callback(result); + }; + + root.getEntropySource = function(teeWalletId, isMultisig, account, callback) { + root.getXPubKey(teeWalletId, hwWallet.getEntropyPath(root.description.id, isMultisig, account), function(data) { + if (!data.success) + return callback(hwWallet._err(data)); + + return callback(null, hwWallet.pubKeyToEntropySource(data.xpubkey)); + }); + }; + + root.showMneumonic = function(teeWalletId, cb) { + var result = root.walletEnclave.displayWordList(teeWalletId, 'en'); + if (result != teeWalletId) { + cb(result); + } else { + cb(); + } + }; + + root.showReceiveAddress = function(teeWalletId, address, cb) { + var isMultisig = false; // TODO + var account = 0; // TODO + var basePath = hwWallet.getAddressPath(root.description.id, isMultisig, account, address.network); + var keyPath = address.path.replace('m', basePath); + + var result = root.walletEnclave.displayReceiveAddress(teeWalletId, keyPath); + if (result != teeWalletId) { + cb(result); + } else { + cb(); + } + }; + + root.signTx = function(teeWalletId, txp, callback) { + var account = 0; // TODO + var isMultisig = txp.requiredSignatures > 1; + var basePath = hwWallet.getAddressPath(root.description.id, isMultisig, account, txp.network); + + var rawTx = bwcService.Client.getRawTx(txp); + var keypaths = lodash.map(lodash.pluck(txp.inputs, 'path'), function(path) { + return path.replace('m', basePath); + }); + var publicKeys = lodash.pluck(txp.inputs, 'publicKeys'); + var changePublicKeys = txp.changeAddress.publicKeys; + publicKeys.push(changePublicKeys); + + var changeaddrpath; + if (txp.changeAddress) { + changeaddrpath = txp.changeAddress.path.replace('m', basePath); + } + + var result; + if (txp.requiredSignatures == 1) { + result = root.walletEnclave.signTransaction(teeWalletId, rawTx, changeaddrpath, keypaths); + } else { + result = root.walletEnclave.signTransaction(teeWalletId, rawTx, changeaddrpath, keypaths, publicKeys, txp.requiredSignatures, changePublicKeys, txp.requiredSignatures); + } + + if (result.Status != teeWalletId) { + return callback('TEE failed to sign transction: ' + result.Status); + } + return callback(null, result); + }; + + function initSource(opts, callback) { + var args = { + "Testnet" : (opts.networkName == 'livenet'? false : true), + "PINUnlockRequired" : false, + "PINSignatureDataRequired" : false, + "PINSignatureTransaction" : 0, + "ExportCount" : 10, + "MaxPINAttempts" : 3, + "PINTimeout" : 30 + }; + + var teeStatus = root.walletEnclave.createWallet(TEE_APP_ID, args); + switch (teeStatus) { + case "CREATE WALLET FAILURE": + case "CREATE WALLET FAILED TO INITIALIZE": + case "CREATE WALLET FAILURE BAD INPUT": + case "CREATE WALLET FAILURE case SERIALIZATION": + case "DELETE_WALLET_AUTHORIZATION_UNSUCCESSFUL": + case "LOAD_WALLET_FAILTURE": + case "IMPORT WORD LIST FAILTURE": + case "IMPORT WORD LIST FAILURE BAD INPUT": + case "IMPORT WORD NOT IN DICTIONARY": + case "INVALID PIN": + case "INVALID APPLICATION ID": + case "DISPLAY WORD LIST FAILURE": + case "DELETE WALLET NO SUCH APPLICATION ID": + case "SIGN DATA FAILURE": + case "SIGN DATA INVALID HASH": + case "SIGN DATA BUFFER TOO SMALL": + case "SIGN DATA INVALID PIN": + case "RECEIVE ADDRESS INVALID INPUT": + case "RECEIVE ADDRESS NULL": + case "RECEIVE ADDRESS BUFFER TOO SMALL": + case "PUBLIC KEY BUFFER TOO SMALL": + case "LOAD WALLET FAILURE": + case "PUBLIC KEY FAILURE": + case "PUBLIC KEY FAIL TO SERIALIZE": + case "UKNOWN ERROR CODE": + $log.error(teeStatus); + return callback(teeStatus); // TODO: translate error text for display + break; + default: + opts.hwInfo = { + name: root.description.id, + id: teeStatus + }; + $log.debug('TEE wallet created: ' + opts.hwInfo); + return callback(null, opts); + } + }; + + return root; +}); \ No newline at end of file diff --git a/src/js/services/ledger.js b/src/js/services/ledger.js index a58aa2906..3e01811b1 100644 --- a/src/js/services/ledger.js +++ b/src/js/services/ledger.js @@ -5,6 +5,12 @@ angular.module('copayApp.services') var root = {}; var LEDGER_CHROME_ID = "kkdpmhnladdopljabkgpacgpliggeeaf"; + root.description = { + id: 'ledger', + name: 'Ledger', + longName: 'Ledger Hardware Wallet' + }; + root.callbacks = {}; root.hasSession = function() { root._message({ @@ -13,7 +19,7 @@ angular.module('copayApp.services') } root.getEntropySource = function(isMultisig, account, callback) { - root.getXPubKey(hwWallet.getEntropyPath('ledger', isMultisig, account), function(data) { + root.getXPubKey(hwWallet.getEntropyPath(root.description.id, isMultisig, account), function(data) { if (!data.success) return callback(hwWallet._err(data)); @@ -30,21 +36,27 @@ angular.module('copayApp.services') }); }; - root.getInfoForNewWallet = function(isMultisig, account, callback) { - root.getEntropySource(isMultisig, account, function(err, entropySource) { + root.initSource = function(opts, callback) { + // No initialization for this hardware source. + return callback(opts); + }; + + root.getInfoForNewWallet = function(opts, callback) { + var isMultisig = opts.n > 1; + root.getEntropySource(isMultisig, opts.account, function(err, entropySource) { if (err) return callback(err); - root.getXPubKey(hwWallet.getAddressPath('ledger', isMultisig, account), function(data) { - if (!data.success) return callback(data); - - var opts = {}; - opts.entropySource = entropySource; + opts.entropySource = entropySource; + root.getXPubKey(hwWallet.getAddressPath(root.description.id, isMultisig, opts.account), function(data) { + if (!data.success) { + $log.warn(data.message); + return callback(data); + } opts.extendedPublicKey = data.xpubkey; - opts.externalSource = 'ledger'; - opts.account = account; + opts.externalSource = root.description.id; // Old ledger compat - opts.derivationStrategy = account ? 'BIP48' : 'BIP44'; + opts.derivationStrategy = opts.account ? 'BIP48' : 'BIP44'; return callback(null, opts); }); }); @@ -57,7 +69,7 @@ angular.module('copayApp.services') var tx = bwcService.getUtils().buildTx(txp); for (var i = 0; i < tx.inputs.length; i++) { redeemScripts.push(new ByteString(tx.inputs[i].redeemScript.toBuffer().toString('hex'), GP.HEX).toString()); - paths.push(hwWallet.getAddressPath('ledger', isMultisig, account) + txp.inputs[i].path.substring(1)); + paths.push(hwWallet.getAddressPath(root.description.id, isMultisig, account) + txp.inputs[i].path.substring(1)); } var splitTransaction = root._splitTransaction(new ByteString(tx.toString(), GP.HEX)); var inputs = []; diff --git a/src/js/services/platformInfo.js b/src/js/services/platformInfo.js index ee7d4c221..2a6d75aea 100644 --- a/src/js/services/platformInfo.js +++ b/src/js/services/platformInfo.js @@ -38,6 +38,7 @@ angular.module('copayApp.services').factory('platformInfo', function($window) { ret.isMobile = ret.isAndroid || ret.isIOS || ret.isWP; ret.isChromeApp = $window.chrome && chrome.runtime && chrome.runtime.id && !ret.isNW; ret.isDevel = !ret.isMobile && !ret.isChromeApp && !ret.isNW; + ret.isIntelTEE = true; return ret; }); diff --git a/src/js/services/profileService.js b/src/js/services/profileService.js index e5af8bc22..6ef9b96b0 100644 --- a/src/js/services/profileService.js +++ b/src/js/services/profileService.js @@ -347,6 +347,7 @@ angular.module('copayApp.services') account: opts.account || 0, derivationStrategy: opts.derivationStrategy || 'BIP44', }); + walletClient.credentials.hwInfo = opts.hwInfo; } catch (ex) { $log.warn("Creating wallet from Extended Public Key Arg:", ex, opts); return cb(gettextCatalog.getString('Could not create using the specified extended public key')); diff --git a/src/js/services/trezor.js b/src/js/services/trezor.js index 3a3c48215..c76860ed0 100644 --- a/src/js/services/trezor.js +++ b/src/js/services/trezor.js @@ -7,8 +7,15 @@ angular.module('copayApp.services') var SETTLE_TIME = 3000; root.callbacks = {}; + root.description = { + id: 'trezor', + name: 'Trezor', + longName: 'Trezor Hardware Wallet', + derivationStrategy: 'BIP48' + }; + root.getEntropySource = function(isMultisig, account, callback) { - root.getXPubKey(hwWallet.getEntropyPath('trezor', isMultisig, account), function(data) { + root.getXPubKey(hwWallet.getEntropyPath(root.description.id, isMultisig, account), function(data) { if (!data.success) return callback(hwWallet._err(data)); @@ -26,22 +33,25 @@ angular.module('copayApp.services') } }; + root.initSource = function(opts, callback) { + // No initialization for this hardware source. + return callback(opts); + }; - root.getInfoForNewWallet = function(isMultisig, account, callback) { - var opts = {}; - root.getEntropySource(isMultisig, account, function(err, data) { + root.getInfoForNewWallet = function(opts, callback) { + var isMultisig = opts.n > 1; + root.getEntropySource(isMultisig, opts.account, function(err, data) { if (err) return callback(err); opts.entropySource = data; $log.debug('Waiting TREZOR to settle...'); $timeout(function() { - root.getXPubKey(hwWallet.getAddressPath('trezor', isMultisig, account), function(data) { + root.getXPubKey(hwWallet.getAddressPath(root.description.id, isMultisig, opts.account), function(data) { if (!data.success) return callback(hwWallet._err(data)); opts.extendedPublicKey = data.xpubkey; - opts.externalSource = 'trezor'; - opts.account = account; + opts.externalSource = root.description.id; if (isMultisig) opts.derivationStrategy = 'BIP48'; diff --git a/src/js/services/walletService.js b/src/js/services/walletService.js index 7c3b98f07..53342286e 100644 --- a/src/js/services/walletService.js +++ b/src/js/services/walletService.js @@ -1,10 +1,16 @@ 'use strict'; -angular.module('copayApp.services').factory('walletService', function($log, $timeout, lodash, trezor, ledger, storageService, configService, rateService, uxLanguage, $filter, gettextCatalog, bwcError, $ionicPopup, fingerprintService, ongoingProcess, gettext, $rootScope, txFormatService, $ionicModal, $state, bwcService, bitcore, popupService) { +angular.module('copayApp.services').factory('walletService', function($log, $timeout, lodash, trezor, ledger, intelTEE, storageService, configService, rateService, uxLanguage, $filter, gettextCatalog, bwcError, $ionicPopup, fingerprintService, ongoingProcess, gettext, $rootScope, txFormatService, $ionicModal, $state, bwcService, bitcore, popupService) { // `wallet` is a decorated version of client. var root = {}; + root.externalSource = { + ledger: ledger.description, + trezor: trezor.description, + intelTEE: intelTEE.description + } + root.WALLET_STATUS_MAX_TRIES = 7; root.WALLET_STATUS_DELAY_BETWEEN_TRIES = 1.4 * 1000; root.SOFT_CONFIRMATION_LIMIT = 12; @@ -40,6 +46,40 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim }); }; + var _signWithIntelTEE = function(wallet, txp, cb) { + $log.info('Requesting Intel TEE to sign the transaction'); + + intelTEE.signTx(wallet.credentials.hwInfo.id, txp, function(err, result) { + if (err) return cb(err); + + $log.debug('Intel TEE response', result); + txp.signatures = result.Signatures; + return wallet.signTxProposal(txp, cb); + }); + }; + + root.showMneumonicFromHardware = function(wallet, cb) { + switch (wallet.getPrivKeyExternalSourceName()) { + case root.externalSource.intelTEE.id: + return intelTEE.showMneumonic(wallet.credentials.hwInfo.id, cb); + break; + default: + cb('Error: unrecognized external source'); + break; + } + }; + + root.showReceiveAddressFromHardware = function(wallet, address, cb) { + switch (wallet.getPrivKeyExternalSourceName()) { + case root.externalSource.intelTEE.id: + return intelTEE.showReceiveAddress(wallet.credentials.hwInfo.id, address, cb); + break; + default: + cb('Error: unrecognized external source'); + break; + } + }; + root.invalidateCache = function(wallet) { if (wallet.cachedStatus) wallet.cachedStatus.isValid = false; @@ -629,10 +669,12 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim if (wallet.isPrivKeyExternal()) { switch (wallet.getPrivKeyExternalSourceName()) { - case 'ledger': + case root.externalSource.ledger.id: return _signWithLedger(wallet, txp, cb); - case 'trezor': + case root.externalSource.trezor.id: return _signWithTrezor(wallet, txp, cb); + case root.externalSource.intelTEE.id: + return _signWithIntelTEE(wallet, txp, cb); default: var msg = 'Unsupported External Key:' + wallet.getPrivKeyExternalSourceName(); $log.error(msg); diff --git a/www/img/icon-inteltee-white.svg b/www/img/icon-inteltee-white.svg new file mode 100644 index 000000000..92f9bc4ba --- /dev/null +++ b/www/img/icon-inteltee-white.svg @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + ® + \ No newline at end of file diff --git a/www/views/includes/walletInfo.html b/www/views/includes/walletInfo.html index d4f1fbc17..7b149060e 100644 --- a/www/views/includes/walletInfo.html +++ b/www/views/includes/walletInfo.html @@ -4,7 +4,13 @@
Auditable - + + + +#{{wallet.account || 0}} diff --git a/www/views/preferences.html b/www/views/preferences.html index 5d21e1193..fda6f20d7 100644 --- a/www/views/preferences.html +++ b/www/views/preferences.html @@ -18,12 +18,6 @@ - - Hardware Wallet - - {{externalSource}} - - Color diff --git a/www/views/preferencesExternal.html b/www/views/preferencesExternal.html new file mode 100644 index 000000000..651a394e4 --- /dev/null +++ b/www/views/preferencesExternal.html @@ -0,0 +1,14 @@ + + + {{exteralSource}} + + + + +
+ +
+
+
diff --git a/www/views/preferencesInformation.html b/www/views/preferencesInformation.html index bdf2ca9df..060ae55a8 100644 --- a/www/views/preferencesInformation.html +++ b/www/views/preferencesInformation.html @@ -43,6 +43,13 @@ {{derivationStrategy}}
+ + Hardware Wallet + + {{externalSource}} + + +
Hardware Wallet diff --git a/www/views/tab-create-shared.html b/www/views/tab-create-shared.html index 3f9d25811..4b3100247 100644 --- a/www/views/tab-create-shared.html +++ b/www/views/tab-create-shared.html @@ -120,7 +120,7 @@ ng-model="formData.derivationPath"> - + Testnet diff --git a/www/views/tab-import-hardware.html b/www/views/tab-import-hardware.html index 7f750182b..07c715315 100644 --- a/www/views/tab-import-hardware.html +++ b/www/views/tab-import-hardware.html @@ -15,7 +15,7 @@ -
+ + + +
+ +
+
+ +
From 8d63fa35075dea5e5c972f96f86fcbdc6d9c0f97 Mon Sep 17 00:00:00 2001 From: Andy Phillipson Date: Thu, 16 Mar 2017 14:37:41 -0400 Subject: [PATCH 48/83] Improve detection of supported hw wallets. --- src/js/controllers/create.js | 22 +++++++++++----------- src/js/controllers/join.js | 9 +++------ src/js/services/intelTEE.js | 15 ++++++++------- src/js/services/ledger.js | 3 ++- src/js/services/platformInfo.js | 5 ++++- src/js/services/trezor.js | 3 ++- 6 files changed, 30 insertions(+), 27 deletions(-) diff --git a/src/js/controllers/create.js b/src/js/controllers/create.js index 6316fd4f8..343422369 100644 --- a/src/js/controllers/create.js +++ b/src/js/controllers/create.js @@ -1,11 +1,7 @@ 'use strict'; angular.module('copayApp.controllers').controller('createController', - function($scope, $rootScope, $timeout, $log, lodash, $state, $ionicScrollDelegate, $ionicHistory, profileService, configService, gettextCatalog, ledger, trezor, intelTEE, platformInfo, derivationPathHelper, ongoingProcess, walletService, storageService, popupService, appConfigService) { - - var isChromeApp = platformInfo.isChromeApp; - var isCordova = platformInfo.isCordova; - var isDevel = platformInfo.isDevel; + function($scope, $rootScope, $timeout, $log, lodash, $state, $ionicScrollDelegate, $ionicHistory, profileService, configService, gettextCatalog, ledger, trezor, intelTEE, derivationPathHelper, ongoingProcess, walletService, storageService, popupService, appConfigService) { /* For compressed keys, m*73 + n*34 <= 496 */ var COPAYER_PAIR_LIMITS = { @@ -67,9 +63,6 @@ angular.module('copayApp.controllers').controller('createController', var seedOptions = [{ id: 'new', label: gettextCatalog.getString('Random'), - }, { - id: walletService.externalSource.intelTEE.id, - label: gettextCatalog(walletService.externalSource.intelTEE.name), }, { id: 'set', label: gettextCatalog.getString('Specify Recovery Phrase...'), @@ -84,18 +77,25 @@ angular.module('copayApp.controllers').controller('createController', */ if (appConfigService.name == 'copay') { - if (n > 1 && isChromeApp) + if (n > 1 && walletService.externalSource.ledger.supported) seedOptions.push({ id: walletService.externalSource.ledger.id, label: walletService.externalSource.ledger.longName, }); - if (isChromeApp || isDevel) { + if (walletService.externalSource.trezor.supported) { seedOptions.push({ id: walletService.externalSource.trezor.id, label: walletService.externalSource.trezor.longName, }); } + + if (walletService.externalSource.intelTEE.supported) { + seedOptions.push({ + id: walletService.externalSource.intelTEE.id, + label: walletService.externalSource.intelTEE.longName, + }); + } } $scope.seedOptions = seedOptions; @@ -179,7 +179,7 @@ angular.module('copayApp.controllers').controller('createController', src = intelTEE; break; default: - this.error = gettextCatalog('Invalid seed source id: ' + self.seedSourceId); + this.error = gettextCatalog.getString('Invalid seed source id: ' + self.seedSourceId); return; } diff --git a/src/js/controllers/join.js b/src/js/controllers/join.js index 3bbf4813b..73f3281bf 100644 --- a/src/js/controllers/join.js +++ b/src/js/controllers/join.js @@ -1,10 +1,7 @@ 'use strict'; angular.module('copayApp.controllers').controller('joinController', - function($scope, $rootScope, $timeout, $state, $ionicHistory, $ionicScrollDelegate, profileService, configService, storageService, applicationService, gettextCatalog, lodash, ledger, trezor, platformInfo, derivationPathHelper, ongoingProcess, walletService, $log, $stateParams, popupService, appConfigService) { - - var isChromeApp = platformInfo.isChromeApp; - var isDevel = platformInfo.isDevel; + function($scope, $rootScope, $timeout, $state, $ionicHistory, $ionicScrollDelegate, profileService, configService, storageService, applicationService, gettextCatalog, lodash, ledger, trezor, derivationPathHelper, ongoingProcess, walletService, $log, $stateParams, popupService, appConfigService) { var self = this; var defaults = configService.getDefaults(); @@ -64,14 +61,14 @@ angular.module('copayApp.controllers').controller('joinController', */ if (appConfigService.name == 'copay') { - if (isChromeApp) { + if (walletService.externalSource.ledger.supported) { self.seedOptions.push({ id: walletService.externalSource.ledger.id, label: walletService.externalSource.ledger.longName, }); } - if (isChromeApp || isDevel) { + if (walletService.externalSource.trezor.supported) { self.seedOptions.push({ id: walletService.externalSource.trezor.id, label: walletService.externalSource.trezor.longName, diff --git a/src/js/services/intelTEE.js b/src/js/services/intelTEE.js index 6840d10bd..74ffd7734 100644 --- a/src/js/services/intelTEE.js +++ b/src/js/services/intelTEE.js @@ -5,20 +5,21 @@ angular.module('copayApp.services') var root = {}; - if (!platformInfo.isIntelTEE) { - return root; - } - - var IntelWallet = require('intelWalletCon'); - var TEE_APP_ID = '63279de1b6cb4dcf8c206716bd318092f8c206716bd31809263279de1b6cb4dc'; - root.description = { + supports: platformInfo.supportsIntelTEE, id: 'intelTEE', name: 'Intel TEE', longName: 'Intel TEE Hardware Wallet', derivationStrategy: 'BIP44' }; + if (!root.description.isAvailable) { + return root; + } + + var IntelWallet = require('intelWalletCon'); + var TEE_APP_ID = '63279de1b6cb4dcf8c206716bd318092f8c206716bd31809263279de1b6cb4dc'; + root.walletEnclave = new IntelWallet.Wallet(); var walletEnclaveStatus = root.walletEnclave.initializeEnclave(); if (walletEnclaveStatus != 0) { diff --git a/src/js/services/ledger.js b/src/js/services/ledger.js index 3e01811b1..d28df597f 100644 --- a/src/js/services/ledger.js +++ b/src/js/services/ledger.js @@ -1,11 +1,12 @@ 'use strict'; angular.module('copayApp.services') - .factory('ledger', function($log, bwcService, gettext, hwWallet) { + .factory('ledger', function($log, bwcService, gettext, hwWallet, platformInfo) { var root = {}; var LEDGER_CHROME_ID = "kkdpmhnladdopljabkgpacgpliggeeaf"; root.description = { + supports: platformInfo.supportsLedger, id: 'ledger', name: 'Ledger', longName: 'Ledger Hardware Wallet' diff --git a/src/js/services/platformInfo.js b/src/js/services/platformInfo.js index 2a6d75aea..459e96167 100644 --- a/src/js/services/platformInfo.js +++ b/src/js/services/platformInfo.js @@ -38,7 +38,10 @@ angular.module('copayApp.services').factory('platformInfo', function($window) { ret.isMobile = ret.isAndroid || ret.isIOS || ret.isWP; ret.isChromeApp = $window.chrome && chrome.runtime && chrome.runtime.id && !ret.isNW; ret.isDevel = !ret.isMobile && !ret.isChromeApp && !ret.isNW; - ret.isIntelTEE = true; + + ret.supportsLedger = ret.isChromeApp; + ret.supportsTrezor = ret.isChromeApp || ret.isDevel; + ret.supportsIntelTEE = false; return ret; }); diff --git a/src/js/services/trezor.js b/src/js/services/trezor.js index c76860ed0..407d94c4b 100644 --- a/src/js/services/trezor.js +++ b/src/js/services/trezor.js @@ -1,13 +1,14 @@ 'use strict'; angular.module('copayApp.services') - .factory('trezor', function($log, $timeout, lodash, bitcore, hwWallet) { + .factory('trezor', function($log, $timeout, lodash, bitcore, hwWallet, platformInfo) { var root = {}; var SETTLE_TIME = 3000; root.callbacks = {}; root.description = { + supported: platformInfo.supportsTrezor, id: 'trezor', name: 'Trezor', longName: 'Trezor Hardware Wallet', From 80d2b7bc0198ba950c3912ec50a3f7db3aafe4d8 Mon Sep 17 00:00:00 2001 From: Andy Phillipson Date: Thu, 16 Mar 2017 15:29:37 -0400 Subject: [PATCH 49/83] Detect Windows platform for TEE. --- src/js/services/platformInfo.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/js/services/platformInfo.js b/src/js/services/platformInfo.js index 459e96167..f0a0d774c 100644 --- a/src/js/services/platformInfo.js +++ b/src/js/services/platformInfo.js @@ -38,10 +38,11 @@ angular.module('copayApp.services').factory('platformInfo', function($window) { ret.isMobile = ret.isAndroid || ret.isIOS || ret.isWP; ret.isChromeApp = $window.chrome && chrome.runtime && chrome.runtime.id && !ret.isNW; ret.isDevel = !ret.isMobile && !ret.isChromeApp && !ret.isNW; + ret.isWindows = navigator.platform.indexOf('Win') > -1; ret.supportsLedger = ret.isChromeApp; ret.supportsTrezor = ret.isChromeApp || ret.isDevel; - ret.supportsIntelTEE = false; + ret.supportsIntelTEE = ret.isWindows; // TODO need to detect specific chip set for TEE support return ret; }); From 2153d9b4684a2fdf8ea00589401167c54526eee6 Mon Sep 17 00:00:00 2001 From: Andy Phillipson Date: Thu, 16 Mar 2017 15:37:10 -0400 Subject: [PATCH 50/83] Fix hw descriptions. --- src/js/services/intelTEE.js | 2 +- src/js/services/ledger.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/js/services/intelTEE.js b/src/js/services/intelTEE.js index 74ffd7734..ea75cb872 100644 --- a/src/js/services/intelTEE.js +++ b/src/js/services/intelTEE.js @@ -6,7 +6,7 @@ angular.module('copayApp.services') var root = {}; root.description = { - supports: platformInfo.supportsIntelTEE, + supported: platformInfo.supportsIntelTEE, id: 'intelTEE', name: 'Intel TEE', longName: 'Intel TEE Hardware Wallet', diff --git a/src/js/services/ledger.js b/src/js/services/ledger.js index d28df597f..df3ac4972 100644 --- a/src/js/services/ledger.js +++ b/src/js/services/ledger.js @@ -6,7 +6,7 @@ angular.module('copayApp.services') var LEDGER_CHROME_ID = "kkdpmhnladdopljabkgpacgpliggeeaf"; root.description = { - supports: platformInfo.supportsLedger, + supported: platformInfo.supportsLedger, id: 'ledger', name: 'Ledger', longName: 'Ledger Hardware Wallet' From e6d997a701b0b854dbe0177c9d05742f6653dcc2 Mon Sep 17 00:00:00 2001 From: Andy Phillipson Date: Fri, 17 Mar 2017 17:00:26 -0400 Subject: [PATCH 51/83] Provide address object to intel tee service to display address securely. --- src/js/services/walletService.js | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/js/services/walletService.js b/src/js/services/walletService.js index 53342286e..558f422a2 100644 --- a/src/js/services/walletService.js +++ b/src/js/services/walletService.js @@ -72,7 +72,10 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim root.showReceiveAddressFromHardware = function(wallet, address, cb) { switch (wallet.getPrivKeyExternalSourceName()) { case root.externalSource.intelTEE.id: - return intelTEE.showReceiveAddress(wallet.credentials.hwInfo.id, address, cb); + root.getAddressObj(wallet, address, function(err, addrObj) { + if (err) return cb(err); + return intelTEE.showReceiveAddress(wallet.credentials.hwInfo.id, addrObj, cb); + }); break; default: cb('Error: unrecognized external source'); @@ -887,6 +890,21 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim }); }; + root.getAddressObj = function(wallet, address, cb) { + wallet.getMainAddresses({ + reverse: true + }, function(err, addr) { + if (err) return cb(err); + var addrObj = lodash.find(addr, function(a) { + return a.address == address; + }); + var err = null; + if (!addrObj) { + err = 'Error: specified address not in wallet'; + } + return cb(err, addrObj); + }); + }; root.isReady = function(wallet, cb) { if (!wallet.isComplete()) From 8c00fe27aa9b32de2c593ae88682e54b71d9a81c Mon Sep 17 00:00:00 2001 From: Gabrielbazan7 Date: Fri, 17 Mar 2017 18:23:50 -0400 Subject: [PATCH 52/83] Bug fixes after rebase. Please enter the commit message for your changes. Lines starting --- src/js/controllers/create.js | 10 +++++----- src/js/controllers/preferencesExternal.js | 2 +- src/js/controllers/preferencesInformation.js | 2 +- src/js/services/intelTEE.js | 2 +- src/sass/views/tab-receive.scss | 11 +++++++++++ www/views/preferencesExternal.html | 2 +- www/views/preferencesInformation.html | 6 ------ www/views/tab-receive.html | 12 ++---------- 8 files changed, 22 insertions(+), 25 deletions(-) diff --git a/src/js/controllers/create.js b/src/js/controllers/create.js index 343422369..da3a2c9c4 100644 --- a/src/js/controllers/create.js +++ b/src/js/controllers/create.js @@ -154,23 +154,23 @@ angular.module('copayApp.controllers').controller('createController', return; } - if ($scope.seedSource.id == walletService.externalSource.ledger.id || $scope.seedSource.id == walletService.externalSource.trezor.id || self.seedSourceId == walletService.externalSource.intelTEE.id) { + if ($scope.seedSource.id == walletService.externalSource.ledger.id || $scope.seedSource.id == walletService.externalSource.trezor.id || $scope.seedSource.id == walletService.externalSource.intelTEE.id) { var account = $scope.formData.account; if (!account || account < 1) { popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Invalid account number')); return; } - if ($scope.seedSource.id == walletService.externalSource.trezor.id || self.seedSource.id == walletService.externalSource.intelTEE.id) + if ($scope.seedSource.id == walletService.externalSource.trezor.id || $scope.seedSource.id == walletService.externalSource.intelTEE.id) account = account - 1; opts.account = account; ongoingProcess.set('connecting' + $scope.seedSource.id, true); var src; - switch (self.seedSourceId) { + switch ($scope.seedSource.id) { case walletService.externalSource.ledger.id: - src = legder; + src = ledger; break; case walletService.externalSource.trezor.id: src = trezor; @@ -179,7 +179,7 @@ angular.module('copayApp.controllers').controller('createController', src = intelTEE; break; default: - this.error = gettextCatalog.getString('Invalid seed source id: ' + self.seedSourceId); + this.error = gettextCatalog.getString('Invalid seed source id: ' + $scope.seedSource.id); return; } diff --git a/src/js/controllers/preferencesExternal.js b/src/js/controllers/preferencesExternal.js index 9be05b92f..12ea10a7d 100644 --- a/src/js/controllers/preferencesExternal.js +++ b/src/js/controllers/preferencesExternal.js @@ -1,6 +1,6 @@ 'use strict'; -angular.module('copayApp.controllers').controller('preferencesExternalController', function($scope, lodash, profileService, walletService) { +angular.module('copayApp.controllers').controller('preferencesExternalController', function($scope, $stateParams, lodash, gettextCatalog, popupService, profileService, walletService) { var wallet = profileService.getWallet($stateParams.walletId); $scope.externalSource = lodash.find(walletService.externalSource, function(source) { diff --git a/src/js/controllers/preferencesInformation.js b/src/js/controllers/preferencesInformation.js index 21dc3db46..9362d883f 100644 --- a/src/js/controllers/preferencesInformation.js +++ b/src/js/controllers/preferencesInformation.js @@ -1,7 +1,7 @@ 'use strict'; angular.module('copayApp.controllers').controller('preferencesInformation', - function($scope, $log, $ionicHistory, platformInfo, lodash, profileService, configService, $stateParams, $state) { + function($scope, $log, $ionicHistory, platformInfo, lodash, profileService, configService, $stateParams, $state, walletService) { var wallet = profileService.getWallet($stateParams.walletId); $scope.wallet = wallet; diff --git a/src/js/services/intelTEE.js b/src/js/services/intelTEE.js index ea75cb872..0b5724fe2 100644 --- a/src/js/services/intelTEE.js +++ b/src/js/services/intelTEE.js @@ -13,7 +13,7 @@ angular.module('copayApp.services') derivationStrategy: 'BIP44' }; - if (!root.description.isAvailable) { + if (!root.description.supported) { return root; } diff --git a/src/sass/views/tab-receive.scss b/src/sass/views/tab-receive.scss index 2228ed07a..483f988c3 100644 --- a/src/sass/views/tab-receive.scss +++ b/src/sass/views/tab-receive.scss @@ -162,6 +162,17 @@ transform: translate(100%, -40%); } } + .overlay { + position: absolute; + width: 220px; + height: 100%; + background-color: rgba(255,255,255,0.8); + button { + width: 100%; + top: 50%; + transform: translateY(-50%); + } + } @media(max-height: 700px) { padding: 10vh 0 4vh; } diff --git a/www/views/preferencesExternal.html b/www/views/preferencesExternal.html index 651a394e4..719a0d448 100644 --- a/www/views/preferencesExternal.html +++ b/www/views/preferencesExternal.html @@ -1,6 +1,6 @@ - {{exteralSource}} + {{externalSource}} diff --git a/www/views/preferencesInformation.html b/www/views/preferencesInformation.html index 060ae55a8..3e1bcd4ff 100644 --- a/www/views/preferencesInformation.html +++ b/www/views/preferencesInformation.html @@ -50,12 +50,6 @@ -
- Hardware Wallet - - {{wallet.getPrivKeyExternalSourceName()}} - -
diff --git a/www/views/tab-receive.html b/www/views/tab-receive.html index 0683ecbe2..644af8e0f 100644 --- a/www/views/tab-receive.html +++ b/www/views/tab-receive.html @@ -53,19 +53,11 @@
- - - -
- -
- -
From 80f3b70784c04c2c39f72fe95d1e53ef71aea228 Mon Sep 17 00:00:00 2001 From: Andy Phillipson Date: Tue, 21 Mar 2017 10:09:50 -0400 Subject: [PATCH 53/83] Implement intel tee version detection. --- src/js/controllers/preferencesExternal.js | 2 +- src/js/services/intelTEE.js | 1 + src/js/services/platformInfo.js | 26 +++++++++++++++++++++-- www/views/preferencesExternal.html | 11 +++++++++- 4 files changed, 36 insertions(+), 4 deletions(-) diff --git a/src/js/controllers/preferencesExternal.js b/src/js/controllers/preferencesExternal.js index 12ea10a7d..ebc10043e 100644 --- a/src/js/controllers/preferencesExternal.js +++ b/src/js/controllers/preferencesExternal.js @@ -5,7 +5,7 @@ angular.module('copayApp.controllers').controller('preferencesExternalController $scope.externalSource = lodash.find(walletService.externalSource, function(source) { return source.id == wallet.getPrivKeyExternalSourceName(); - }).name; + }); $scope.showMneumonicFromHardwarePopup = function() { var title = gettextCatalog.getString('Warning!'); diff --git a/src/js/services/intelTEE.js b/src/js/services/intelTEE.js index 0b5724fe2..a7e459ae7 100644 --- a/src/js/services/intelTEE.js +++ b/src/js/services/intelTEE.js @@ -7,6 +7,7 @@ angular.module('copayApp.services') root.description = { supported: platformInfo.supportsIntelTEE, + version: platformInfo.versionIntelTEE, id: 'intelTEE', name: 'Intel TEE', longName: 'Intel TEE Hardware Wallet', diff --git a/src/js/services/platformInfo.js b/src/js/services/platformInfo.js index f0a0d774c..8396afa07 100644 --- a/src/js/services/platformInfo.js +++ b/src/js/services/platformInfo.js @@ -23,6 +23,27 @@ angular.module('copayApp.services').factory('platformInfo', function($window) { } }; + var getVersionIntelTee = function() { + var v = ''; + var isWindows = navigator.platform.indexOf('Win') > -1; + + if (!isNodeWebkit() || !isWindows) { + return v; + } + + try { + var IntelWallet = require('intelWalletCon'); + if (IntelWallet.getVersion) { + v = IntelWallet.getVersion(); + } else { + v = 'Alpha'; + } + if (v.length > 0) { + $log.info('Intel TEE library ' + v); + } + } catch (e) {} + return v; + }; // Detect mobile devices var ret = { @@ -38,11 +59,12 @@ angular.module('copayApp.services').factory('platformInfo', function($window) { ret.isMobile = ret.isAndroid || ret.isIOS || ret.isWP; ret.isChromeApp = $window.chrome && chrome.runtime && chrome.runtime.id && !ret.isNW; ret.isDevel = !ret.isMobile && !ret.isChromeApp && !ret.isNW; - ret.isWindows = navigator.platform.indexOf('Win') > -1; ret.supportsLedger = ret.isChromeApp; ret.supportsTrezor = ret.isChromeApp || ret.isDevel; - ret.supportsIntelTEE = ret.isWindows; // TODO need to detect specific chip set for TEE support + + ret.versionIntelTEE = getVersionIntelTee(); + ret.supportsIntelTEE = ret.versionIntelTEE.length > 0; return ret; }); diff --git a/www/views/preferencesExternal.html b/www/views/preferencesExternal.html index 719a0d448..0703932d1 100644 --- a/www/views/preferencesExternal.html +++ b/www/views/preferencesExternal.html @@ -1,10 +1,19 @@ - {{externalSource}} + {{externalSource.longName}} +
+
+ Version + + {{externalSource.version}} + +
+
+
+
+
+
+ Version + + {{externalSource.version || 'hardware disconnected'}} + +
+
+ +
+ +
From c0e90ac21ab36b1916b1bc05d543a9985abb4783 Mon Sep 17 00:00:00 2001 From: Andy Phillipson Date: Tue, 21 Mar 2017 11:48:55 -0400 Subject: [PATCH 55/83] Revert BWS version. --- app-template/package-template.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app-template/package-template.json b/app-template/package-template.json index 054526a24..c6b567f25 100644 --- a/app-template/package-template.json +++ b/app-template/package-template.json @@ -56,7 +56,7 @@ "bezier-easing": "^2.0.3", "bhttp": "^1.2.1", "bitauth": "https://github.com/gabrielbazan7/bitauth.git#copay", - "bitcore-wallet-client": "git://github.com/isocolsky/bitcore-wallet-client#369eaede49cd64836015fb9b8a502092ee84dc7c", + "bitcore-wallet-client": "5.1.2", "bower": "^1.7.9", "cordova-android": "5.1.1", "cordova-custom-config": "^3.0.5", From 413990f94c6a05a5c75be2a7cb532690b0a7b372 Mon Sep 17 00:00:00 2001 From: Andy Phillipson Date: Fri, 7 Apr 2017 10:54:30 -0400 Subject: [PATCH 56/83] Bug fixes - ledger testing --- src/js/controllers/create.js | 2 +- src/js/controllers/import.js | 2 +- src/js/controllers/join.js | 1 + src/js/controllers/preferencesExternal.js | 30 ++++++++-------- src/js/services/intelTEE.js | 11 +++--- src/js/services/ledger.js | 11 +++--- src/js/services/trezor.js | 11 +++--- www/views/includes/walletInfo.html | 13 +++---- www/views/preferencesExternal.html | 42 ++++++++++++++--------- 9 files changed, 67 insertions(+), 56 deletions(-) diff --git a/src/js/controllers/create.js b/src/js/controllers/create.js index da3a2c9c4..bbf4d992a 100644 --- a/src/js/controllers/create.js +++ b/src/js/controllers/create.js @@ -183,7 +183,7 @@ angular.module('copayApp.controllers').controller('createController', return; } - src.getInfoForNewWallet(opts, function(err, lopts) { + src.getInfoForNewWallet(opts.n > 1, account, function(err, lopts) { ongoingProcess.set('connecting' + $scope.seedSource.id, false); if (err) { popupService.showAlert(gettextCatalog.getString('Error'), err); diff --git a/src/js/controllers/import.js b/src/js/controllers/import.js index 4964058ef..e34546d9e 100644 --- a/src/js/controllers/import.js +++ b/src/js/controllers/import.js @@ -35,7 +35,7 @@ angular.module('copayApp.controllers').controller('importController', if ($scope.isChromeApp || $scope.isDevel) { $scope.seedOptions.push({ id: walletService.externalSource.trezor.id, - label: walletService.externalSource.ledger.longName, + label: walletService.externalSource.trezor.longName, }); $scope.formData.seedSource = $scope.seedOptions[0]; } diff --git a/src/js/controllers/join.js b/src/js/controllers/join.js index 73f3281bf..6800fc9fc 100644 --- a/src/js/controllers/join.js +++ b/src/js/controllers/join.js @@ -138,6 +138,7 @@ angular.module('copayApp.controllers').controller('joinController', account = account - 1; opts.account = account; + opts.isMultisig = true; ongoingProcess.set('connecting' + self.seedSourceId, true); var src = self.seedSourceId == walletService.externalSource.ledger.id ? ledger : trezor; diff --git a/src/js/controllers/preferencesExternal.js b/src/js/controllers/preferencesExternal.js index 6be633901..c44c0af6c 100644 --- a/src/js/controllers/preferencesExternal.js +++ b/src/js/controllers/preferencesExternal.js @@ -8,20 +8,22 @@ angular.module('copayApp.controllers').controller('preferencesExternalController return source.id == wallet.getPrivKeyExternalSourceName(); }); - $scope.hardwareConnected = $scope.externalSource.version.length > 0; + if ($scope.externalSource.hasEmbeddedHardware) { + $scope.hardwareConnected = $scope.externalSource.version.length > 0; - $scope.showMneumonicFromHardwarePopup = function() { - var title = gettextCatalog.getString('Warning!'); - var message = gettextCatalog.getString('Are you being watched? Anyone with your recovery phrase can access or spend your bitcoin.'); - popupService.showConfirm(title, message, null, null, function(res) { - if (res) { - walletService.showMneumonicFromHardware(wallet, function(err) { - if (err) { - popupService.showAlert(gettextCatalog.getString('Error'), err.message || err); - } - }); - } - }); - }; + $scope.showMneumonicFromHardwarePopup = function() { + var title = gettextCatalog.getString('Warning!'); + var message = gettextCatalog.getString('Are you being watched? Anyone with your recovery phrase can access or spend your bitcoin.'); + popupService.showConfirm(title, message, null, null, function(res) { + if (res) { + walletService.showMneumonicFromHardware(wallet, function(err) { + if (err) { + popupService.showAlert(gettextCatalog.getString('Error'), err.message || err); + } + }); + } + }); + }; + } }); \ No newline at end of file diff --git a/src/js/services/intelTEE.js b/src/js/services/intelTEE.js index a7e459ae7..36dbc5181 100644 --- a/src/js/services/intelTEE.js +++ b/src/js/services/intelTEE.js @@ -11,7 +11,8 @@ angular.module('copayApp.services') id: 'intelTEE', name: 'Intel TEE', longName: 'Intel TEE Hardware Wallet', - derivationStrategy: 'BIP44' + derivationStrategy: 'BIP44', + hasEmbeddedHardware: true }; if (!root.description.supported) { @@ -27,16 +28,16 @@ angular.module('copayApp.services') $log.error('Failed to create Intel Wallet enclave'); } - root.getInfoForNewWallet = function(opts, callback) { + root.getInfoForNewWallet = function(isMultisig, account, callback) { + var opts = {}; initSource(opts, function(err, opts) { if (err) return callback(err); - var isMultisig = opts.n > 1; - root.getEntropySource(opts.hwInfo.id, isMultisig, opts.account, function(err, entropySource) { + root.getEntropySource(opts.hwInfo.id, isMultisig, account, function(err, entropySource) { if (err) return callback(err); opts.entropySource = entropySource; - root.getXPubKey(opts.hwInfo.id, hwWallet.getAddressPath(root.description.id, isMultisig, opts.account, opts.networkName), function(data) { + root.getXPubKey(opts.hwInfo.id, hwWallet.getAddressPath(root.description.id, isMultisig, account, opts.networkName), function(data) { if (!data.success) { $log.warn(data.message); return callback(data); diff --git a/src/js/services/ledger.js b/src/js/services/ledger.js index df3ac4972..5336f39ce 100644 --- a/src/js/services/ledger.js +++ b/src/js/services/ledger.js @@ -9,7 +9,8 @@ angular.module('copayApp.services') supported: platformInfo.supportsLedger, id: 'ledger', name: 'Ledger', - longName: 'Ledger Hardware Wallet' + longName: 'Ledger Hardware Wallet', + hasEmbeddedHardware: false }; root.callbacks = {}; @@ -42,13 +43,13 @@ angular.module('copayApp.services') return callback(opts); }; - root.getInfoForNewWallet = function(opts, callback) { - var isMultisig = opts.n > 1; - root.getEntropySource(isMultisig, opts.account, function(err, entropySource) { + root.getInfoForNewWallet = function(isMultisig, account, callback) { + root.getEntropySource(isMultisig, account, function(err, entropySource) { if (err) return callback(err); + var opts = {}; opts.entropySource = entropySource; - root.getXPubKey(hwWallet.getAddressPath(root.description.id, isMultisig, opts.account), function(data) { + root.getXPubKey(hwWallet.getAddressPath(root.description.id, isMultisig, account), function(data) { if (!data.success) { $log.warn(data.message); return callback(data); diff --git a/src/js/services/trezor.js b/src/js/services/trezor.js index 407d94c4b..c3c406866 100644 --- a/src/js/services/trezor.js +++ b/src/js/services/trezor.js @@ -12,7 +12,8 @@ angular.module('copayApp.services') id: 'trezor', name: 'Trezor', longName: 'Trezor Hardware Wallet', - derivationStrategy: 'BIP48' + derivationStrategy: 'BIP48', + hasEmbeddedHardware: false }; root.getEntropySource = function(isMultisig, account, callback) { @@ -39,15 +40,15 @@ angular.module('copayApp.services') return callback(opts); }; - root.getInfoForNewWallet = function(opts, callback) { - var isMultisig = opts.n > 1; - root.getEntropySource(isMultisig, opts.account, function(err, data) { + root.getInfoForNewWallet = function(isMultisig, account, callback) { + var opts = {}; + root.getEntropySource(isMultisig, account, function(err, data) { if (err) return callback(err); opts.entropySource = data; $log.debug('Waiting TREZOR to settle...'); $timeout(function() { - root.getXPubKey(hwWallet.getAddressPath(root.description.id, isMultisig, opts.account), function(data) { + root.getXPubKey(hwWallet.getAddressPath(root.description.id, isMultisig, account), function(data) { if (!data.success) return callback(hwWallet._err(data)); diff --git a/www/views/includes/walletInfo.html b/www/views/includes/walletInfo.html index 7b149060e..98ec7ac02 100644 --- a/www/views/includes/walletInfo.html +++ b/www/views/includes/walletInfo.html @@ -4,16 +4,11 @@
Auditable - - - -#{{wallet.account || 0}} + - - + + + {{wallet.m}}-of-{{wallet.n}} #{{wallet.credentials.account || 0}} diff --git a/www/views/preferencesExternal.html b/www/views/preferencesExternal.html index beb4db140..bfb3562ad 100644 --- a/www/views/preferencesExternal.html +++ b/www/views/preferencesExternal.html @@ -6,26 +6,36 @@
-
- Hardware not connected.
- Check installation and retry. + +
+
+ No hardware information available. +
-
-
-
- Version - - {{externalSource.version || 'hardware disconnected'}} - +
+
+ Hardware not connected.
+ Check installation and retry. +
+ +
+
+
+ Version + + {{externalSource.version || 'hardware disconnected'}} + +
+
+ +
+
- -
- -
+ From 36cb23015af63fedd8863e45e0339cf2216677a9 Mon Sep 17 00:00:00 2001 From: Gabrielbazan7 Date: Fri, 7 Apr 2017 17:12:02 -0400 Subject: [PATCH 57/83] Bug fixes - retest intel tee. --- src/js/controllers/create.js | 11 ++++++++--- src/js/controllers/import.js | 4 ++-- src/js/controllers/join.js | 2 +- src/js/controllers/preferencesExternal.js | 2 +- src/js/services/intelTEE.js | 9 +++++---- src/js/services/ledger.js | 6 ++++-- src/js/services/trezor.js | 6 ++++-- www/views/preferencesExternal.html | 4 ++-- www/views/tab-create-personal.html | 2 +- www/views/tab-create-shared.html | 2 +- 10 files changed, 29 insertions(+), 19 deletions(-) diff --git a/src/js/controllers/create.js b/src/js/controllers/create.js index bbf4d992a..1e54684ed 100644 --- a/src/js/controllers/create.js +++ b/src/js/controllers/create.js @@ -63,9 +63,11 @@ angular.module('copayApp.controllers').controller('createController', var seedOptions = [{ id: 'new', label: gettextCatalog.getString('Random'), + supportsTestnet: true }, { id: 'set', label: gettextCatalog.getString('Specify Recovery Phrase...'), + supportsTestnet: false }]; $scope.seedSource = seedOptions[0]; @@ -81,12 +83,14 @@ angular.module('copayApp.controllers').controller('createController', seedOptions.push({ id: walletService.externalSource.ledger.id, label: walletService.externalSource.ledger.longName, + supportsTestnet: walletService.externalSource.ledger.supportsTestnet }); if (walletService.externalSource.trezor.supported) { seedOptions.push({ id: walletService.externalSource.trezor.id, label: walletService.externalSource.trezor.longName, + supportsTestnet: walletService.externalSource.trezor.supportsTestnet }); } @@ -94,6 +98,7 @@ angular.module('copayApp.controllers').controller('createController', seedOptions.push({ id: walletService.externalSource.intelTEE.id, label: walletService.externalSource.intelTEE.longName, + supportsTestnet: walletService.externalSource.intelTEE.supportsTestnet }); } } @@ -165,7 +170,7 @@ angular.module('copayApp.controllers').controller('createController', account = account - 1; opts.account = account; - ongoingProcess.set('connecting' + $scope.seedSource.id, true); + ongoingProcess.set('connecting ' + $scope.seedSource.id, true); var src; switch ($scope.seedSource.id) { @@ -183,8 +188,8 @@ angular.module('copayApp.controllers').controller('createController', return; } - src.getInfoForNewWallet(opts.n > 1, account, function(err, lopts) { - ongoingProcess.set('connecting' + $scope.seedSource.id, false); + src.getInfoForNewWallet(opts.n > 1, account, opts.networkName, function(err, lopts) { + ongoingProcess.set('connecting ' + $scope.seedSource.id, false); if (err) { popupService.showAlert(gettextCatalog.getString('Error'), err); return; diff --git a/src/js/controllers/import.js b/src/js/controllers/import.js index e34546d9e..3776671ee 100644 --- a/src/js/controllers/import.js +++ b/src/js/controllers/import.js @@ -262,7 +262,7 @@ angular.module('copayApp.controllers').controller('importController', }; $scope.importTrezor = function(account, isMultisig) { - trezor.getInfoForNewWallet(isMultisig, account, function(err, lopts) { + trezor.getInfoForNewWallet(isMultisig, account, 'livenet', function(err, lopts) { ongoingProcess.clear(); if (err) { popupService.showAlert(gettextCatalog.getString('Error'), err); @@ -318,7 +318,7 @@ angular.module('copayApp.controllers').controller('importController', }; $scope.importLedger = function(account) { - ledger.getInfoForNewWallet(true, account, function(err, lopts) { + ledger.getInfoForNewWallet(true, account, 'livenet', function(err, lopts) { ongoingProcess.clear(); if (err) { popupService.showAlert(gettextCatalog.getString('Error'), err); diff --git a/src/js/controllers/join.js b/src/js/controllers/join.js index 6800fc9fc..b2e858969 100644 --- a/src/js/controllers/join.js +++ b/src/js/controllers/join.js @@ -142,7 +142,7 @@ angular.module('copayApp.controllers').controller('joinController', ongoingProcess.set('connecting' + self.seedSourceId, true); var src = self.seedSourceId == walletService.externalSource.ledger.id ? ledger : trezor; - src.getInfoForNewWallet(true, account, function(err, lopts) { + src.getInfoForNewWallet(true, account, 'livenet', function(err, lopts) { ongoingProcess.set('connecting' + self.seedSourceId, false); if (err) { popupService.showAlert(gettextCatalog.getString('Error'), err); diff --git a/src/js/controllers/preferencesExternal.js b/src/js/controllers/preferencesExternal.js index c44c0af6c..3f7366f1f 100644 --- a/src/js/controllers/preferencesExternal.js +++ b/src/js/controllers/preferencesExternal.js @@ -8,7 +8,7 @@ angular.module('copayApp.controllers').controller('preferencesExternalController return source.id == wallet.getPrivKeyExternalSourceName(); }); - if ($scope.externalSource.hasEmbeddedHardware) { + if ($scope.externalSource.isEmbeddedHardware) { $scope.hardwareConnected = $scope.externalSource.version.length > 0; $scope.showMneumonicFromHardwarePopup = function() { diff --git a/src/js/services/intelTEE.js b/src/js/services/intelTEE.js index 36dbc5181..39859c863 100644 --- a/src/js/services/intelTEE.js +++ b/src/js/services/intelTEE.js @@ -12,7 +12,8 @@ angular.module('copayApp.services') name: 'Intel TEE', longName: 'Intel TEE Hardware Wallet', derivationStrategy: 'BIP44', - hasEmbeddedHardware: true + isEmbeddedHardware: true, + supportsTestnet: true }; if (!root.description.supported) { @@ -28,7 +29,7 @@ angular.module('copayApp.services') $log.error('Failed to create Intel Wallet enclave'); } - root.getInfoForNewWallet = function(isMultisig, account, callback) { + root.getInfoForNewWallet = function(isMultisig, account, networkName, callback) { var opts = {}; initSource(opts, function(err, opts) { if (err) return callback(err); @@ -37,7 +38,7 @@ angular.module('copayApp.services') if (err) return callback(err); opts.entropySource = entropySource; - root.getXPubKey(opts.hwInfo.id, hwWallet.getAddressPath(root.description.id, isMultisig, account, opts.networkName), function(data) { + root.getXPubKey(opts.hwInfo.id, hwWallet.getAddressPath(root.description.id, isMultisig, account, networkName), function(data) { if (!data.success) { $log.warn(data.message); return callback(data); @@ -185,7 +186,7 @@ angular.module('copayApp.services') name: root.description.id, id: teeStatus }; - $log.debug('TEE wallet created: ' + opts.hwInfo); + $log.debug('TEE wallet created: ' + opts.hwInfo.id); return callback(null, opts); } }; diff --git a/src/js/services/ledger.js b/src/js/services/ledger.js index 5336f39ce..abfe6c8f7 100644 --- a/src/js/services/ledger.js +++ b/src/js/services/ledger.js @@ -10,7 +10,8 @@ angular.module('copayApp.services') id: 'ledger', name: 'Ledger', longName: 'Ledger Hardware Wallet', - hasEmbeddedHardware: false + isEmbeddedHardware: false, + supportsTestnet: false }; root.callbacks = {}; @@ -43,7 +44,8 @@ angular.module('copayApp.services') return callback(opts); }; - root.getInfoForNewWallet = function(isMultisig, account, callback) { + root.getInfoForNewWallet = function(isMultisig, account, networkName, callback) { + // networkName not used for this hardware (always livenet) root.getEntropySource(isMultisig, account, function(err, entropySource) { if (err) return callback(err); diff --git a/src/js/services/trezor.js b/src/js/services/trezor.js index c3c406866..0411386fc 100644 --- a/src/js/services/trezor.js +++ b/src/js/services/trezor.js @@ -13,7 +13,8 @@ angular.module('copayApp.services') name: 'Trezor', longName: 'Trezor Hardware Wallet', derivationStrategy: 'BIP48', - hasEmbeddedHardware: false + isEmbeddedHardware: false, + supportsTestnet: false }; root.getEntropySource = function(isMultisig, account, callback) { @@ -40,7 +41,8 @@ angular.module('copayApp.services') return callback(opts); }; - root.getInfoForNewWallet = function(isMultisig, account, callback) { + root.getInfoForNewWallet = function(isMultisig, account, networkName, callback) { + // networkName not used for this hardware (always livenet) var opts = {}; root.getEntropySource(isMultisig, account, function(err, data) { if (err) return callback(err); diff --git a/www/views/preferencesExternal.html b/www/views/preferencesExternal.html index bfb3562ad..22ae4f276 100644 --- a/www/views/preferencesExternal.html +++ b/www/views/preferencesExternal.html @@ -7,13 +7,13 @@
-
+
No hardware information available.
-
+
Hardware not connected.
Check installation and retry. diff --git a/www/views/tab-create-personal.html b/www/views/tab-create-personal.html index 21794f56a..e532165c9 100644 --- a/www/views/tab-create-personal.html +++ b/www/views/tab-create-personal.html @@ -90,7 +90,7 @@ ng-model="formData.derivationPath"> - + Testnet diff --git a/www/views/tab-create-shared.html b/www/views/tab-create-shared.html index 4b3100247..edd6f8175 100644 --- a/www/views/tab-create-shared.html +++ b/www/views/tab-create-shared.html @@ -120,7 +120,7 @@ ng-model="formData.derivationPath"> - + Testnet From a26d27132c36022e5885546a1935005e29be6a8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Baz=C3=A1n?= Date: Fri, 7 Apr 2017 11:29:35 -0300 Subject: [PATCH 58/83] changing ionic to version 1.3.3 with the backbutton fix --- bower.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bower.json b/bower.json index 830a156c7..56a7d7904 100644 --- a/bower.json +++ b/bower.json @@ -11,7 +11,7 @@ "angular-gettext": "2.2.1", "angular-moment": "0.10.1", "angular-qrcode": "bitpay/angular-qrcode#~6.3.0", - "ionic": "1.3.1", + "ionic": "https://github.com/driftyco/ionic-v1.git", "moment": "2.10.3", "ng-lodash": "0.2.3", "qrcode-decoder-js": "*", @@ -23,6 +23,7 @@ "ngtouch": "^1.0.1" }, "resolutions": { - "angular": "1.5.3" + "angular": "1.5.3", + "ionic": "298ad4b645" } } From 005c5c3aae632688d96d5a7d251764c690d893f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Baz=C3=A1n?= Date: Thu, 13 Apr 2017 16:12:36 -0300 Subject: [PATCH 59/83] fix get fee levels function --- src/js/services/feeService.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/js/services/feeService.js b/src/js/services/feeService.js index 584bb0628..0e4deabc7 100644 --- a/src/js/services/feeService.js +++ b/src/js/services/feeService.js @@ -51,10 +51,9 @@ angular.module('copayApp.services').factory('feeService', function($log, $stateP if (errLivenet || errTestnet) { return cb(gettextCatalog.getString('Could not get dynamic fee')); } else { - for (var i = 0; i < 4; i++) { - levelsLivenet[i]['feePerKBUnit'] = txFormatService.formatAmount(levelsLivenet[i].feePerKB) + ' ' + unitName; - levelsTestnet[i]['feePerKBUnit'] = txFormatService.formatAmount(levelsTestnet[i].feePerKB) + ' ' + unitName; - } + lodash.each(lodash.union(levelsLivenet, levelsTestnet), function(level) { + level.feePerKBUnit = txFormatService.formatAmount(level.feePerKB) + ' ' + unitName; + }); } return cb(null, { From dd1209a92c8d11b77fedaa3fb25fe1c61ab5f120 Mon Sep 17 00:00:00 2001 From: Matias Alejo Garcia Date: Thu, 13 Apr 2017 16:58:42 -0300 Subject: [PATCH 60/83] handle the "invalid" status --- src/js/controllers/amazonCards.js | 13 ++++++++++-- src/js/services/amazonService.js | 4 ++++ www/views/amazonCards.html | 8 ++++---- www/views/modals/amazon-card-details.html | 24 +++++++++++++++++------ 4 files changed, 37 insertions(+), 12 deletions(-) diff --git a/src/js/controllers/amazonCards.js b/src/js/controllers/amazonCards.js index 329c620fc..1d09f51e1 100644 --- a/src/js/controllers/amazonCards.js +++ b/src/js/controllers/amazonCards.js @@ -9,6 +9,7 @@ angular.module('copayApp.controllers').controller('amazonCardsController', var updateGiftCards = function(cb) { amazonService.getPendingGiftCards(function(err, gcds) { +console.log('[amazonCards.js.11:gcds:]',gcds); //TODO if (err) { popupService.showAlert('Could not get gift cards', err); if (cb) return cb(); @@ -28,16 +29,24 @@ angular.module('copayApp.controllers').controller('amazonCardsController', updateGiftCards(function() { var index = 0; var gcds = $scope.giftCards; +console.log('[amazonCards.js.31:gcds:]',gcds); //TODO lodash.forEach(gcds, function(dataFromStorage) { - if (dataFromStorage.status == 'PENDING') { - $log.debug("creating gift card"); +console.log('[amazonCards.js.33:dataFromStorage:]',dataFromStorage); //TODO + if (dataFromStorage.status == 'PENDING' || dataFromStorage.status == 'invalid') { + $log.debug("Creating / Updating gift card"); $scope.updatingPending[dataFromStorage.invoiceId] = true; + +console.log('[amazonCards.js.38]'); //TODO amazonService.createGiftCard(dataFromStorage, function(err, giftCard) { + +console.log('[amazonCards.js.41]'); //TODO $scope.updatingPending[dataFromStorage.invoiceId] = false; if (err) { popupService.showAlert('Error creating gift card', err); return; } + +console.log('[amazonCards.js.48]', giftCard); //TODO if (giftCard.status != 'PENDING') { var newData = {}; diff --git a/src/js/services/amazonService.js b/src/js/services/amazonService.js index cfd990f1e..8c3ba581d 100644 --- a/src/js/services/amazonService.js +++ b/src/js/services/amazonService.js @@ -72,8 +72,10 @@ angular.module('copayApp.services').factory('amazonService', function($http, $lo if (opts && opts.remove) { delete(inv[gc.invoiceId]); } + inv = JSON.stringify(inv); + storageService.setAmazonGiftCards(network, inv, function(err) { homeIntegrationsService.register(homeItem); @@ -125,8 +127,10 @@ angular.module('copayApp.services').factory('amazonService', function($http, $lo "invoiceId": data.invoiceId, "accessKey": data.accessKey }; +console.log('[amazonService.js.129:dataSrc:]',dataSrc); //TODO $http(_postBitPay('/amazon-gift/redeem', dataSrc)).then(function(data) { +console.log('[amazonService.js.130:data:]',data); //TODO var status = data.data.status == 'new' ? 'PENDING' : (data.data.status == 'paid') ? 'PENDING' : data.data.status; data.data.status = status; $log.info('Amazon.com Gift Card Create/Update: ' + status); diff --git a/www/views/amazonCards.html b/www/views/amazonCards.html index a50aa1454..03a989e06 100644 --- a/www/views/amazonCards.html +++ b/www/views/amazonCards.html @@ -14,16 +14,16 @@ {{id}} -

- {{item.amount | currency : '$ ' : 2}} {{item.currency}} - - +

+ {{item.amount | currency : '$ ' : 2}} {{item.currency}}

Error Expired + Still waiting confirmation
(Use higher fees setting to faster delivery)
Pending to confirmation Canceled - {{item.date | amTimeAgo}} + {{item.date | amTimeAgo}}

diff --git a/www/views/modals/amazon-card-details.html b/www/views/modals/amazon-card-details.html index 86e58b2dd..0bd850367 100644 --- a/www/views/modals/amazon-card-details.html +++ b/www/views/modals/amazon-card-details.html @@ -11,13 +11,21 @@
Amazon.com Gift Card +
+ Gift Card Amount: + + {{card.amount | currency : '$ ' : 2}} + +
+ + +
+ Created + {{card.date | amTimeAgo}} +
+ +
-
- Gift Card Amount: - - {{card.amount | currency : '$ ' : 2}} - -
Claim code: {{card.claimCode}}
@@ -42,6 +50,10 @@ PENDING + + STILL PENDING + + FAILURE From b7165e22f3bccf50ec97e7194c715e25a08e5ce6 Mon Sep 17 00:00:00 2001 From: Matias Alejo Garcia Date: Fri, 14 Apr 2017 10:15:27 -0300 Subject: [PATCH 61/83] rm logs --- src/js/controllers/amazonCards.js | 6 ------ src/js/services/amazonService.js | 2 -- 2 files changed, 8 deletions(-) diff --git a/src/js/controllers/amazonCards.js b/src/js/controllers/amazonCards.js index 1d09f51e1..c0e42b791 100644 --- a/src/js/controllers/amazonCards.js +++ b/src/js/controllers/amazonCards.js @@ -9,7 +9,6 @@ angular.module('copayApp.controllers').controller('amazonCardsController', var updateGiftCards = function(cb) { amazonService.getPendingGiftCards(function(err, gcds) { -console.log('[amazonCards.js.11:gcds:]',gcds); //TODO if (err) { popupService.showAlert('Could not get gift cards', err); if (cb) return cb(); @@ -29,24 +28,19 @@ console.log('[amazonCards.js.11:gcds:]',gcds); //TODO updateGiftCards(function() { var index = 0; var gcds = $scope.giftCards; -console.log('[amazonCards.js.31:gcds:]',gcds); //TODO lodash.forEach(gcds, function(dataFromStorage) { -console.log('[amazonCards.js.33:dataFromStorage:]',dataFromStorage); //TODO if (dataFromStorage.status == 'PENDING' || dataFromStorage.status == 'invalid') { $log.debug("Creating / Updating gift card"); $scope.updatingPending[dataFromStorage.invoiceId] = true; -console.log('[amazonCards.js.38]'); //TODO amazonService.createGiftCard(dataFromStorage, function(err, giftCard) { -console.log('[amazonCards.js.41]'); //TODO $scope.updatingPending[dataFromStorage.invoiceId] = false; if (err) { popupService.showAlert('Error creating gift card', err); return; } -console.log('[amazonCards.js.48]', giftCard); //TODO if (giftCard.status != 'PENDING') { var newData = {}; diff --git a/src/js/services/amazonService.js b/src/js/services/amazonService.js index 8c3ba581d..c0dee597e 100644 --- a/src/js/services/amazonService.js +++ b/src/js/services/amazonService.js @@ -127,10 +127,8 @@ angular.module('copayApp.services').factory('amazonService', function($http, $lo "invoiceId": data.invoiceId, "accessKey": data.accessKey }; -console.log('[amazonService.js.129:dataSrc:]',dataSrc); //TODO $http(_postBitPay('/amazon-gift/redeem', dataSrc)).then(function(data) { -console.log('[amazonService.js.130:data:]',data); //TODO var status = data.data.status == 'new' ? 'PENDING' : (data.data.status == 'paid') ? 'PENDING' : data.data.status; data.data.status = status; $log.info('Amazon.com Gift Card Create/Update: ' + status); From bafdb6c8d0f04fe0fe9a381a5a203aba2a0c4677 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Baz=C3=A1n?= Date: Fri, 14 Apr 2017 12:40:08 -0300 Subject: [PATCH 62/83] set wallet properly when side wallets screen is activated --- src/js/controllers/tab-receive.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/js/controllers/tab-receive.js b/src/js/controllers/tab-receive.js index 4073e08f9..39b26ecf1 100644 --- a/src/js/controllers/tab-receive.js +++ b/src/js/controllers/tab-receive.js @@ -165,6 +165,10 @@ angular.module('copayApp.controllers').controller('tabReceiveController', functi return w.id == $scope.wallet.id; }); if (w) $scope.updateCurrentWallet(); + else if (screen.width > 700 && screen.height > 700) { + $scope.setWallet(0) + $scope.walletPosition(0); + } } }); From 1ab252535d012f7cd3a3cb120ed17430f07474a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Baz=C3=A1n?= Date: Fri, 14 Apr 2017 12:49:22 -0300 Subject: [PATCH 63/83] fix for no wallets --- src/js/controllers/tab-receive.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/js/controllers/tab-receive.js b/src/js/controllers/tab-receive.js index 39b26ecf1..a45a0b0f4 100644 --- a/src/js/controllers/tab-receive.js +++ b/src/js/controllers/tab-receive.js @@ -165,7 +165,7 @@ angular.module('copayApp.controllers').controller('tabReceiveController', functi return w.id == $scope.wallet.id; }); if (w) $scope.updateCurrentWallet(); - else if (screen.width > 700 && screen.height > 700) { + else if (screen.width > 700 && screen.height > 700 && $scope.wallets[0]) { $scope.setWallet(0) $scope.walletPosition(0); } From 5e7956ca6ee0b2edbcf12d06710c78210c062b2c Mon Sep 17 00:00:00 2001 From: JDonadio Date: Wed, 12 Apr 2017 12:27:51 -0300 Subject: [PATCH 64/83] add warning for low fee --- src/sass/views/includes/txp-details.scss | 11 +++++++++++ www/img/icon-warning.png | Bin 0 -> 1065 bytes www/views/tx-details.html | 4 ++++ 3 files changed, 15 insertions(+) create mode 100644 www/img/icon-warning.png diff --git a/src/sass/views/includes/txp-details.scss b/src/sass/views/includes/txp-details.scss index ab77ddcad..1ee5702a1 100644 --- a/src/sass/views/includes/txp-details.scss +++ b/src/sass/views/includes/txp-details.scss @@ -89,6 +89,17 @@ flex-grow: 1; } } + &.low-fees { + border-top: none; + display: flex; + font-size: 14px; + color: #aaa; + align-items: center; + margin-top: -20px; + i { + padding-right: 20px; + } + } } .item-divider { padding-top: 1.2rem; diff --git a/www/img/icon-warning.png b/www/img/icon-warning.png new file mode 100644 index 0000000000000000000000000000000000000000..fa33cfcdcef991bcddc957a1e00ac99a50191af5 GIT binary patch literal 1065 zcmV+^1lIeBP)N>j4+O<*wwLn}PG+IdIJ!YmGJ_KHRnOfu`ozwp8B+VEhPh`Up}RGhmK2avEvC?{15Xc0HT} ze*X%nl!3CvnNcvu8aa(JAisIFe{XDUD!4OYfQcUg9T0BK9Bbr|+Xw@pL|6@XKRN`Q z`Wo;83r%qCa;%X%v~`SuF$Nquraf z#^TY(Q=78D_*nJWeTj$O8N#*$L-_TNIG}yt^cct?mp$xV4Fi5>G8oA`*bDr594@qW z24Z1>=7>OG*Srb_Ipng3y*Fz>e*479y6=hI5$sHF=>RUC0Ayg{S?C(v zaL*aInj?o?_OO>4)S~9~81M!w&^qpgdo@_kTdyoboh8U7lR_u$LOtqUOIf zAivzx|7@~7(G$PB8JNCMcl1}Gl?P=3Sv^IH%I=5$m{5T+l zMcow&1Hhmn0{2@Mew8EZ^(#(;T7R9tbO^vF7FU)tz=!u(E(-*W>n-Zks;gPP~8b^dw7FZ!9_CJ52`UVmeKK|dj;*7{{feeFiatStr}}
+
+ + This transaction could take a long time to confirm or could be dropped due to the low fees set by the sender +
Confirmations From 0a3cc34e612fe6e54257bab0138343532ad7718e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Baz=C3=A1n?= Date: Fri, 14 Apr 2017 15:04:26 -0300 Subject: [PATCH 65/83] low fee warning on wallet details view --- src/sass/views/walletDetails.scss | 16 +++++++++++++++- www/views/walletDetails.html | 4 ++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/sass/views/walletDetails.scss b/src/sass/views/walletDetails.scss index 4b99238d5..b726710f9 100644 --- a/src/sass/views/walletDetails.scss +++ b/src/sass/views/walletDetails.scss @@ -209,6 +209,20 @@ font-size: 13px; color: $v-mid-gray; } + .low-fees { + .comment { + color: $v-mid-gray; + font-size: 12.5px; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + margin-left: 25px; + } + img { + position: absolute; + margin-top: 3px; + } + } } .wallet-details-wallet-info { @@ -238,7 +252,7 @@ a.item { .recent svg { margin-left:5px; - width:0.7em; + width:0.7em; height:0.7em; stroke: #eee; } diff --git a/www/views/walletDetails.html b/www/views/walletDetails.html index ff3fcf464..bdba64a65 100644 --- a/www/views/walletDetails.html +++ b/www/views/walletDetails.html @@ -238,6 +238,10 @@
{{btx.note.body}}
Received
+
+ + Low fees +
From 00e1d3029667c55d71815e8d359c9d26bbfc9654 Mon Sep 17 00:00:00 2001 From: Gustavo Maximiliano Cortez Date: Sun, 16 Apr 2017 20:42:48 -0300 Subject: [PATCH 66/83] Adds Unknown Merchant if merchant.name is empty --- www/views/bitpayCard.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/www/views/bitpayCard.html b/www/views/bitpayCard.html index 8044550e4..3c760f85f 100644 --- a/www/views/bitpayCard.html +++ b/www/views/bitpayCard.html @@ -76,7 +76,7 @@
- {{tx.merchant.name}} + {{tx.merchant.name || 'Unknown Merchant'}}
{{tx.merchant.city}}, {{tx.merchant.state}} From 28ef9a22dcc8aaf0cecca1a069897c18796ff9dc Mon Sep 17 00:00:00 2001 From: Gustavo Maximiliano Cortez Date: Sun, 16 Apr 2017 22:23:20 -0300 Subject: [PATCH 67/83] Enable SendMax to top up debit card --- src/js/controllers/amount.js | 22 ++++++++---------- src/js/controllers/topup.js | 27 +++++++++++++++++++++- src/js/routes.js | 3 ++- src/js/services/sendMax.js | 36 ++++++++++++++++++++++++++++++ src/js/services/txFormatService.js | 8 +++++++ 5 files changed, 81 insertions(+), 15 deletions(-) create mode 100644 src/js/services/sendMax.js diff --git a/src/js/controllers/amount.js b/src/js/controllers/amount.js index 9e808d4df..92c5c6219 100644 --- a/src/js/controllers/amount.js +++ b/src/js/controllers/amount.js @@ -22,7 +22,8 @@ angular.module('copayApp.controllers').controller('amountController', function($ $scope.currency = data.stateParams.currency; $scope.forceCurrency = data.stateParams.forceCurrency; - $scope.showMenu = $ionicHistory.backView() && $ionicHistory.backView().stateName == 'tabs.send'; + $scope.showMenu = $ionicHistory.backView() && ($ionicHistory.backView().stateName == 'tabs.send' || + $ionicHistory.backView().stateName == 'tabs.bitpayCard'); $scope.recipientType = data.stateParams.recipientType || null; $scope.toAddress = data.stateParams.toAddress; $scope.toName = data.stateParams.toName; @@ -111,15 +112,8 @@ angular.module('copayApp.controllers').controller('amountController', function($ $scope.sendMax = function() { $scope.showSendMax = false; - $state.transitionTo('tabs.send.confirm', { - recipientType: $scope.recipientType, - toAmount: null, - toAddress: $scope.toAddress, - toName: $scope.toName, - toEmail: $scope.toEmail, - toColor: $scope.toColor, - useSendMax: true, - }); + $scope.useSendMax = true; + $scope.finish(); }; $scope.toggleAlternative = function() { @@ -234,8 +228,9 @@ angular.module('copayApp.controllers').controller('amountController', function($ if ($scope.nextStep) { $state.transitionTo($scope.nextStep, { id: _cardId, - amount: _amount, - currency: $scope.showAlternativeAmount ? $scope.alternativeIsoCode : $scope.unitName + amount: $scope.useSendMax ? null : _amount, + currency: $scope.showAlternativeAmount ? $scope.alternativeIsoCode : $scope.unitName, + useSendMax: $scope.useSendMax }); } else { var amount = $scope.showAlternativeAmount ? fromFiat(_amount) : _amount; @@ -247,11 +242,12 @@ angular.module('copayApp.controllers').controller('amountController', function($ } else { $state.transitionTo('tabs.send.confirm', { recipientType: $scope.recipientType, - toAmount: (amount * unitToSatoshi).toFixed(0), + toAmount: $scope.useSendMax ? null : (amount * unitToSatoshi).toFixed(0), toAddress: $scope.toAddress, toName: $scope.toName, toEmail: $scope.toEmail, toColor: $scope.toColor, + useSendMax: $scope.useSendMax }); } } diff --git a/src/js/controllers/topup.js b/src/js/controllers/topup.js index c7894185d..1a2d2ac03 100644 --- a/src/js/controllers/topup.js +++ b/src/js/controllers/topup.js @@ -1,10 +1,11 @@ 'use strict'; -angular.module('copayApp.controllers').controller('topUpController', function($scope, $log, $state, $timeout, $ionicHistory, lodash, popupService, profileService, ongoingProcess, walletService, configService, platformInfo, bitpayService, bitpayCardService, payproService, bwcError, txFormatService) { +angular.module('copayApp.controllers').controller('topUpController', function($scope, $log, $state, $timeout, $ionicHistory, lodash, popupService, profileService, ongoingProcess, walletService, configService, platformInfo, bitpayService, bitpayCardService, payproService, bwcError, txFormatService, sendMaxService) { var amount; var currency; var cardId; + var sendMax; $scope.isCordova = platformInfo.isCordova; @@ -51,6 +52,7 @@ angular.module('copayApp.controllers').controller('topUpController', function($s $scope.$on("$ionicView.beforeEnter", function(event, data) { cardId = data.stateParams.id; + sendMax = data.stateParams.useSendMax; if (!cardId) { showErrorAndBack('No card selected'); @@ -188,6 +190,29 @@ angular.module('copayApp.controllers').controller('topUpController', function($s $scope.onWalletSelect = function(wallet) { $scope.wallet = wallet; + if (sendMax) { + ongoingProcess.set('retrievingInputs', true); + sendMaxService.getInfo($scope.wallet, function(err, values) { + ongoingProcess.set('retrievingInputs', false); + if (err) { + showErrorAndBack(err); + return; + } + var config = configService.getSync().wallet.settings; + var unitName = config.unitName; + var amountUnit = txFormatService.satToUnit(values.amount); + var parsedAmount = txFormatService.parseAmount( + amountUnit, + unitName); + + amount = parsedAmount.amount; + currency = parsedAmount.currency; + $scope.amountUnitStr = parsedAmount.amountUnitStr; + $timeout(function() { + $scope.$digest(); + }, 100); + }); + } }; $scope.goBackHome = function() { diff --git a/src/js/routes.js b/src/js/routes.js index 45cbc9249..42d2f6ccc 100644 --- a/src/js/routes.js +++ b/src/js/routes.js @@ -1103,7 +1103,8 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr }, params: { id: null, - currency: 'USD' + currency: 'USD', + useSendMax: null } }) .state('tabs.bitpayCard.amount', { diff --git a/src/js/services/sendMax.js b/src/js/services/sendMax.js new file mode 100644 index 000000000..13af6024a --- /dev/null +++ b/src/js/services/sendMax.js @@ -0,0 +1,36 @@ +'use strict'; + +angular.module('copayApp.services').service('sendMaxService', function(feeService, configService, walletService) { + + /** + * Get sendMaxInfo + * + * @param {Obj} Wallet + * @param {Callback} Function (optional) + * + */ + this.getInfo = function(wallet, cb) { + feeService.getCurrentFeeValue(wallet.credentials.network, function(err, feePerKb) { + if (err) return cb(err); + + var config = configService.getSync().wallet; + + walletService.getSendMaxInfo(wallet, { + feePerKb: feePerKb, + excludeUnconfirmedUtxos: !config.spendUnconfirmed, + returnInputs: true, + }, function(err, resp) { + if (err) return cb(err); + + return cb(null, { + sendMax: true, + amount: resp.amount, + inputs: resp.inputs, + fee: resp.fee, + feePerKb: feePerKb, + }); + }); + }); + }; + +}); diff --git a/src/js/services/txFormatService.js b/src/js/services/txFormatService.js index a28079d3f..7524bb548 100644 --- a/src/js/services/txFormatService.js +++ b/src/js/services/txFormatService.js @@ -184,5 +184,13 @@ angular.module('copayApp.services').factory('txFormatService', function($filter, }; }; + root.satToUnit = function(amount) { + var config = configService.getSync().wallet.settings; + var unitToSatoshi = config.unitToSatoshi; + var satToUnit = 1 / unitToSatoshi; + var unitDecimals = config.unitDecimals; + return parseFloat((amount * satToUnit).toFixed(unitDecimals)); + }; + return root; }); From 4f4f0b417bb7ad2f78172f1d825cb04fb4474900 Mon Sep 17 00:00:00 2001 From: Gustavo Maximiliano Cortez Date: Sun, 16 Apr 2017 22:29:17 -0300 Subject: [PATCH 68/83] Clean useSendMax variable --- src/js/controllers/amount.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/js/controllers/amount.js b/src/js/controllers/amount.js index 92c5c6219..83634db45 100644 --- a/src/js/controllers/amount.js +++ b/src/js/controllers/amount.js @@ -251,5 +251,6 @@ angular.module('copayApp.controllers').controller('amountController', function($ }); } } + $scope.useSendMax = null; }; }); From a742e538141f909cfeead672f31d00979868457e Mon Sep 17 00:00:00 2001 From: Andy Phillipson Date: Mon, 17 Apr 2017 10:55:16 -0400 Subject: [PATCH 69/83] Review and test fixes. --- src/js/controllers/import.js | 10 +++--- src/js/controllers/join.js | 37 ++++++++++++++++++----- src/js/controllers/preferencesExternal.js | 1 - www/views/import.html | 2 +- www/views/preferences.html | 2 +- www/views/preferencesInformation.html | 8 ++++- 6 files changed, 43 insertions(+), 17 deletions(-) diff --git a/src/js/controllers/import.js b/src/js/controllers/import.js index 3776671ee..c5657d5cf 100644 --- a/src/js/controllers/import.js +++ b/src/js/controllers/import.js @@ -3,15 +3,13 @@ angular.module('copayApp.controllers').controller('importController', function($scope, $timeout, $log, $state, $stateParams, $ionicHistory, $ionicScrollDelegate, profileService, configService, sjcl, ledger, trezor, derivationPathHelper, platformInfo, bwcService, ongoingProcess, walletService, popupService, gettextCatalog, appConfigService) { - var isChromeApp = platformInfo.isChromeApp; - var isDevel = platformInfo.isDevel; var reader = new FileReader(); var defaults = configService.getDefaults(); var errors = bwcService.getErrors(); $scope.init = function() { - $scope.isDevel = platformInfo.isDevel; - $scope.isChromeApp = platformInfo.isChromeApp; + $scope.supportsLedger = platformInfo.supportsLedger; + $scope.supportsTrezor = platformInfo.supportsTrezor; $scope.isCordova = platformInfo.isCordova; $scope.formData = {}; $scope.formData.bwsurl = defaults.bws.url; @@ -25,14 +23,14 @@ angular.module('copayApp.controllers').controller('importController', $scope.seedOptions = []; - if ($scope.isChromeApp) { + if ($scope.supportsLedger) { $scope.seedOptions.push({ id: walletService.externalSource.ledger.id, label: walletService.externalSource.ledger.longName, }); } - if ($scope.isChromeApp || $scope.isDevel) { + if ($scope.supportsTrezor) { $scope.seedOptions.push({ id: walletService.externalSource.trezor.id, label: walletService.externalSource.trezor.longName, diff --git a/src/js/controllers/join.js b/src/js/controllers/join.js index b2e858969..0f416f0ea 100644 --- a/src/js/controllers/join.js +++ b/src/js/controllers/join.js @@ -1,7 +1,7 @@ 'use strict'; angular.module('copayApp.controllers').controller('joinController', - function($scope, $rootScope, $timeout, $state, $ionicHistory, $ionicScrollDelegate, profileService, configService, storageService, applicationService, gettextCatalog, lodash, ledger, trezor, derivationPathHelper, ongoingProcess, walletService, $log, $stateParams, popupService, appConfigService) { + function($scope, $rootScope, $timeout, $state, $ionicHistory, $ionicScrollDelegate, profileService, configService, storageService, applicationService, gettextCatalog, lodash, ledger, trezor, intelTEE, derivationPathHelper, ongoingProcess, walletService, $log, $stateParams, popupService, appConfigService) { var self = this; var defaults = configService.getDefaults(); @@ -64,14 +64,21 @@ angular.module('copayApp.controllers').controller('joinController', if (walletService.externalSource.ledger.supported) { self.seedOptions.push({ id: walletService.externalSource.ledger.id, - label: walletService.externalSource.ledger.longName, + label: walletService.externalSource.ledger.longName }); } if (walletService.externalSource.trezor.supported) { self.seedOptions.push({ id: walletService.externalSource.trezor.id, - label: walletService.externalSource.trezor.longName, + label: walletService.externalSource.trezor.longName + }); + } + + if (walletService.externalSource.intelTEE.supported) { + seedOptions.push({ + id: walletService.externalSource.intelTEE.id, + label: walletService.externalSource.intelTEE.longName }); } } @@ -94,7 +101,7 @@ angular.module('copayApp.controllers').controller('joinController', var opts = { secret: form.secret.$modelValue, myName: form.myName.$modelValue, - bwsurl: $scope.bwsurl, + bwsurl: $scope.bwsurl } var setSeed = self.seedSourceId == 'set'; @@ -127,21 +134,37 @@ angular.module('copayApp.controllers').controller('joinController', return; } - if (self.seedSourceId == walletService.externalSource.ledger.id || self.seedSourceId == walletService.externalSource.trezor.id) { + if (self.seedSourceId == walletService.externalSource.ledger.id || self.seedSourceId == walletService.externalSource.trezor.id || self.seedSourceId == walletService.externalSource.intelTEE.id) { var account = $scope.account; if (!account || account < 1) { popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Invalid account number')); return; } - if (self.seedSourceId == walletService.externalSource.trezor.id) + if (self.seedSourceId == walletService.externalSource.trezor.id || self.seedSourceId == walletService.externalSource.intelTEE.id) account = account - 1; opts.account = account; opts.isMultisig = true; ongoingProcess.set('connecting' + self.seedSourceId, true); - var src = self.seedSourceId == walletService.externalSource.ledger.id ? ledger : trezor; + var src; + switch (self.seedSourceId) { + case walletService.externalSource.ledger.id: + src = ledger; + break; + case walletService.externalSource.trezor.id: + src = trezor; + break; + case walletService.externalSource.intelTEE.id: + src = intelTEE; + break; + default: + this.error = gettextCatalog.getString('Invalid seed source id: ' + self.seedSourceId); + return; + } + + // TODO: cannot currently join an intelTEE testnet wallet (need to detect from the secret) src.getInfoForNewWallet(true, account, 'livenet', function(err, lopts) { ongoingProcess.set('connecting' + self.seedSourceId, false); if (err) { diff --git a/src/js/controllers/preferencesExternal.js b/src/js/controllers/preferencesExternal.js index 3f7366f1f..916dc0e60 100644 --- a/src/js/controllers/preferencesExternal.js +++ b/src/js/controllers/preferencesExternal.js @@ -2,7 +2,6 @@ angular.module('copayApp.controllers').controller('preferencesExternalController', function($scope, $stateParams, lodash, gettextCatalog, popupService, profileService, walletService) { var wallet = profileService.getWallet($stateParams.walletId); - $scope.wallet = wallet; $scope.externalSource = lodash.find(walletService.externalSource, function(source) { return source.id == wallet.getPrivKeyExternalSourceName(); diff --git a/www/views/import.html b/www/views/import.html index 6baf86f06..973bd6ebb 100644 --- a/www/views/import.html +++ b/www/views/import.html @@ -16,7 +16,7 @@ File/Text
+ {'border-bottom-style': 'solid'}" ng-show="isCopay && (supportsLedger || supportsTrezor)"> Hardware wallet
diff --git a/www/views/preferences.html b/www/views/preferences.html index fda6f20d7..5c8d6f7aa 100644 --- a/www/views/preferences.html +++ b/www/views/preferences.html @@ -32,7 +32,7 @@ Hide Balance - - +
+ Hardware Wallet + + {{externalSource}} + +
+
Hardware Wallet {{externalSource}} From 4c4a14d068594dec59dc3141cfebe8b6ee8f8615 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Baz=C3=A1n?= Date: Mon, 17 Apr 2017 12:28:23 -0300 Subject: [PATCH 70/83] fix bug when changing selector too fast --- src/js/directives/directives.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/js/directives/directives.js b/src/js/directives/directives.js index ecf849b10..8e9022236 100644 --- a/src/js/directives/directives.js +++ b/src/js/directives/directives.js @@ -157,7 +157,7 @@ angular.module('copayApp.directives') scope.$emit('Wallet/Changed', scope.wallets ? scope.wallets[0] : null); }); - scope.$on("$ionicSlides.slideChangeEnd", function(event, data) { + scope.$on("$ionicSlides.slideChangeStart", function(event, data) { scope.$emit('Wallet/Changed', scope.wallets ? scope.wallets[data.slider.activeIndex] : null); }); } From aa56a61f48daf5f6aca5dfafb051dba42d62f8da Mon Sep 17 00:00:00 2001 From: Gustavo Maximiliano Cortez Date: Mon, 17 Apr 2017 15:30:44 -0300 Subject: [PATCH 71/83] New release v3.1.0 --- app-template/bitpay/appConfig.json | 4 ++-- app-template/copay/appConfig.json | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app-template/bitpay/appConfig.json b/app-template/bitpay/appConfig.json index de3102e51..a55b1f391 100644 --- a/app-template/bitpay/appConfig.json +++ b/app-template/bitpay/appConfig.json @@ -22,8 +22,8 @@ "windowsAppId": "2d1002d7-ee34-4f60-bd29-0c871ba0c195", "pushSenderId": "1036948132229", "description": "Secure Bitcoin Wallet", - "version": "3.0.7", - "androidVersion": "306000", + "version": "3.1.0", + "androidVersion": "310000", "_extraCSS": null, "_enabledExtensions": { "coinbase": true, diff --git a/app-template/copay/appConfig.json b/app-template/copay/appConfig.json index f2aa21af5..70ddb011d 100644 --- a/app-template/copay/appConfig.json +++ b/app-template/copay/appConfig.json @@ -22,8 +22,8 @@ "windowsAppId": "804636ee-b017-4cad-8719-e58ac97ffa5c", "pushSenderId": "1036948132229", "description": "A Secure Bitcoin Wallet", - "version": "3.0.7", - "androidVersion": "306000", + "version": "3.1.0", + "androidVersion": "310000", "_extraCSS": null, "_enabledExtensions": { "coinbase": true, From 38b95eba7a03c707761c67e080a8c35d246ba63f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Baz=C3=A1n?= Date: Mon, 17 Apr 2017 15:53:30 -0300 Subject: [PATCH 72/83] update pot --- i18n/po/template.pot | 365 ++++++++++++++++++++++++++++--------------- www/views/lock.html | 2 +- 2 files changed, 236 insertions(+), 131 deletions(-) diff --git a/i18n/po/template.pot b/i18n/po/template.pot index bca9887c4..f1bf056fc 100644 --- a/i18n/po/template.pot +++ b/i18n/po/template.pot @@ -10,7 +10,7 @@ msgstr "" #: www/views/includes/txp.html:27 #: www/views/modals/search.html:27 -#: www/views/walletDetails.html:269 +#: www/views/walletDetails.html:273 msgid "(possible double spend)" msgstr "" @@ -36,16 +36,16 @@ msgid "A total of {{amountBelowFeeStr}} were excluded. These funds come from UTX msgstr "" #: src/js/controllers/preferencesAbout.js:6 -#: www/views/tab-settings.html:146 +#: www/views/tab-settings.html:156 msgid "About" msgstr "" #: src/js/controllers/modals/txpDetails.js:52 -#: src/js/controllers/tx-details.js:59 +#: src/js/controllers/tx-details.js:62 msgid "Accepted" msgstr "" -#: www/views/preferencesInformation.html:59 +#: www/views/preferencesInformation.html:66 msgid "Account" msgstr "" @@ -129,7 +129,7 @@ msgstr "" msgid "Addresses With Balance" msgstr "" -#: www/views/tab-settings.html:139 +#: www/views/tab-settings.html:149 msgid "Advanced" msgstr "" @@ -197,6 +197,10 @@ msgstr "" msgid "Are you being watched?" msgstr "" +#: src/js/controllers/preferencesExternal.js:15 +msgid "Are you being watched? Anyone with your recovery phrase can access or spend your bitcoin." +msgstr "" + #: src/js/controllers/copayers.js:42 msgid "Are you sure you want to cancel and delete this wallet?" msgstr "" @@ -245,7 +249,7 @@ msgstr "" msgid "BIP32 path for address derivation" msgstr "" -#: www/views/preferences.html:45 +#: www/views/preferences.html:39 msgid "Backup" msgstr "" @@ -253,8 +257,12 @@ msgstr "" msgid "Backup Needed" msgstr "" -#: www/views/preferences.html:47 -#: www/views/tab-settings.html:110 +#: src/js/controllers/lock.js:51 +msgid "Backup all livenet wallets before using this function" +msgstr "" + +#: www/views/preferences.html:41 +#: www/views/tab-settings.html:120 msgid "Backup needed" msgstr "" @@ -267,11 +275,15 @@ msgstr "" msgid "Backup wallet" msgstr "" -#: src/js/services/profileService.js:429 +#: src/js/controllers/lock.js:48 +msgid "Backup your wallet before using this function" +msgstr "" + +#: src/js/services/profileService.js:430 msgid "Bad wallet invitation" msgstr "" -#: www/views/preferencesInformation.html:89 +#: www/views/preferencesInformation.html:96 msgid "Balance By Address" msgstr "" @@ -321,11 +333,11 @@ msgid "Broadcast Payment" msgstr "" #: src/js/controllers/modals/txpDetails.js:54 -#: src/js/controllers/tx-details.js:61 +#: src/js/controllers/tx-details.js:64 msgid "Broadcasted" msgstr "" -#: src/js/services/onGoingProcess.js:10 +#: src/js/services/onGoingProcess.js:11 msgid "Broadcasting transaction" msgstr "" @@ -341,15 +353,16 @@ msgstr "" msgid "Buy Bitcoin" msgstr "" -#: src/js/services/onGoingProcess.js:39 +#: src/js/services/onGoingProcess.js:40 msgid "Buying Bitcoin..." msgstr "" -#: src/js/services/onGoingProcess.js:11 +#: src/js/services/onGoingProcess.js:12 msgid "Calculating fee" msgstr "" #: src/js/controllers/confirm.js:494 +#: src/js/controllers/lock.js:100 #: src/js/services/popupService.js:59 #: www/views/addressbook.add.html:10 #: www/views/feedback/send.html:5 @@ -359,11 +372,11 @@ msgstr "" msgid "Cancel" msgstr "" -#: src/js/controllers/onboarding/tour.js:55 +#: src/js/controllers/onboarding/tour.js:56 msgid "Cannot Create Wallet" msgstr "" -#: src/js/services/profileService.js:425 +#: src/js/services/profileService.js:426 msgid "Cannot join the same wallet more that once" msgstr "" @@ -375,6 +388,10 @@ msgstr "" msgid "Certified by" msgstr "" +#: www/views/preferencesExternal.html:19 +msgid "Check installation and retry." +msgstr "" + #: www/views/tab-import-file.html:4 msgid "Choose a backup file from your computer" msgstr "" @@ -407,7 +424,7 @@ msgstr "" msgid "Close" msgstr "" -#: www/views/preferences.html:28 +#: www/views/preferences.html:22 msgid "Color" msgstr "" @@ -415,7 +432,7 @@ msgstr "" msgid "Commit hash" msgstr "" -#: www/views/preferences.html:59 +#: www/views/preferences.html:53 msgid "Complete the backup process to use this option" msgstr "" @@ -433,11 +450,15 @@ msgstr "" msgid "Confirm & Finish" msgstr "" -#: src/js/services/walletService.js:878 +#: www/views/pin.html:9 +msgid "Confirm your PIN" +msgstr "" + +#: src/js/services/walletService.js:938 msgid "Confirm your new spending password" msgstr "" -#: www/views/tx-details.html:88 +#: www/views/tx-details.html:92 msgid "Confirmations" msgstr "" @@ -449,11 +470,11 @@ msgstr "" msgid "Connect my BitPay Card" msgstr "" -#: src/js/services/onGoingProcess.js:12 +#: src/js/services/onGoingProcess.js:13 msgid "Connecting to Coinbase..." msgstr "" -#: src/js/services/onGoingProcess.js:13 +#: src/js/services/onGoingProcess.js:14 msgid "Connecting to Glidera..." msgstr "" @@ -465,6 +486,7 @@ msgstr "" msgid "Contacts" msgstr "" +#: src/js/controllers/lock.js:99 #: www/views/onboarding/notifications.html:9 msgid "Continue" msgstr "" @@ -489,7 +511,7 @@ msgstr "" msgid "Copayer joined" msgstr "" -#: www/views/preferencesInformation.html:81 +#: www/views/preferencesInformation.html:88 msgid "Copayer {{$index}}" msgstr "" @@ -512,7 +534,7 @@ msgstr "" msgid "Could not access the wallet at the server. Please check:" msgstr "" -#: src/js/services/profileService.js:492 +#: src/js/services/profileService.js:493 msgid "Could not access wallet" msgstr "" @@ -528,7 +550,7 @@ msgstr "" msgid "Could not build transaction" msgstr "" -#: src/js/services/walletService.js:791 +#: src/js/services/walletService.js:836 msgid "Could not create address" msgstr "" @@ -536,7 +558,7 @@ msgstr "" msgid "Could not create using the specified extended private key" msgstr "" -#: src/js/services/profileService.js:352 +#: src/js/services/profileService.js:353 msgid "Could not create using the specified extended public key" msgstr "" @@ -564,17 +586,17 @@ msgstr "" msgid "Could not get transactions" msgstr "" -#: src/js/services/profileService.js:594 -#: src/js/services/profileService.js:626 -#: src/js/services/profileService.js:649 +#: src/js/services/profileService.js:595 +#: src/js/services/profileService.js:627 +#: src/js/services/profileService.js:650 msgid "Could not import" msgstr "" -#: src/js/services/profileService.js:563 +#: src/js/services/profileService.js:564 msgid "Could not import. Check input file and spending password" msgstr "" -#: src/js/services/profileService.js:438 +#: src/js/services/profileService.js:439 msgid "Could not join wallet" msgstr "" @@ -591,7 +613,7 @@ msgstr "" msgid "Could not remove card" msgstr "" -#: src/js/services/walletService.js:712 +#: src/js/services/walletService.js:757 msgid "Could not save preferences on the server" msgstr "" @@ -646,11 +668,11 @@ msgstr "" msgid "Created by" msgstr "" -#: src/js/services/onGoingProcess.js:17 +#: src/js/services/onGoingProcess.js:18 msgid "Creating Wallet..." msgstr "" -#: src/js/services/onGoingProcess.js:16 +#: src/js/services/onGoingProcess.js:17 msgid "Creating transaction" msgstr "" @@ -684,11 +706,11 @@ msgstr "" msgid "Delete it and create a new one" msgstr "" -#: src/js/services/onGoingProcess.js:18 +#: src/js/services/onGoingProcess.js:19 msgid "Deleting Wallet..." msgstr "" -#: src/js/services/onGoingProcess.js:27 +#: src/js/services/onGoingProcess.js:28 msgid "Deleting payment proposal" msgstr "" @@ -703,6 +725,11 @@ msgstr "" msgid "Derivation Strategy" msgstr "" +#: src/js/controllers/lock.js:12 +#: src/js/controllers/tab-settings.js:58 +msgid "Disabled" +msgstr "" + #: www/views/includes/backupNeededPopup.html:10 #: www/views/onboarding/backupRequest.html:12 msgid "Do it later" @@ -746,6 +773,14 @@ msgstr "" msgid "Empty addresses limit reached. New addresses cannot be generated." msgstr "" +#: src/js/controllers/lock.js:26 +msgid "Enable Fingerprint" +msgstr "" + +#: src/js/controllers/lock.js:17 +msgid "Enable PIN" +msgstr "" + #: www/views/tab-scan.html:19 msgid "Enable camera access in your device settings to get started." msgstr "" @@ -766,8 +801,8 @@ msgstr "" msgid "Enter Amount" msgstr "" -#: src/js/services/walletService.js:892 -#: src/js/services/walletService.js:907 +#: src/js/services/walletService.js:952 +#: src/js/services/walletService.js:967 msgid "Enter Spending Password" msgstr "" @@ -775,7 +810,7 @@ msgstr "" msgid "Enter Two Factor for your BitPay account" msgstr "" -#: src/js/services/walletService.js:874 +#: src/js/services/walletService.js:934 msgid "Enter new spending password" msgstr "" @@ -802,12 +837,12 @@ msgstr "" #: src/js/controllers/confirm.js:190 #: src/js/controllers/confirm.js:196 #: src/js/controllers/copayers.js:53 -#: src/js/controllers/create.js:109 -#: src/js/controllers/create.js:137 -#: src/js/controllers/create.js:150 -#: src/js/controllers/create.js:157 -#: src/js/controllers/create.js:172 -#: src/js/controllers/create.js:190 +#: src/js/controllers/create.js:117 +#: src/js/controllers/create.js:145 +#: src/js/controllers/create.js:158 +#: src/js/controllers/create.js:165 +#: src/js/controllers/create.js:194 +#: src/js/controllers/create.js:212 #: src/js/controllers/export.js:109 #: src/js/controllers/export.js:115 #: src/js/controllers/export.js:126 @@ -835,21 +870,23 @@ msgstr "" #: src/js/controllers/import.js:54 #: src/js/controllers/import.js:67 #: src/js/controllers/import.js:88 -#: src/js/controllers/join.js:115 -#: src/js/controllers/join.js:129 -#: src/js/controllers/join.js:136 -#: src/js/controllers/join.js:150 -#: src/js/controllers/join.js:168 -#: src/js/controllers/join.js:93 +#: src/js/controllers/join.js:119 +#: src/js/controllers/join.js:133 +#: src/js/controllers/join.js:140 +#: src/js/controllers/join.js:171 +#: src/js/controllers/join.js:189 +#: src/js/controllers/join.js:97 #: src/js/controllers/modals/txpDetails.js:130 #: src/js/controllers/paperWallet.js:47 #: src/js/controllers/preferencesBitpayCard.js:20 #: src/js/controllers/preferencesBitpayServices.js:33 #: src/js/controllers/preferencesBitpayServices.js:50 #: src/js/controllers/preferencesDelete.js:37 +#: src/js/controllers/preferencesExternal.js:20 #: src/js/controllers/tab-home.js:170 #: src/js/controllers/tabsController.js:7 -#: src/js/controllers/tx-details.js:99 +#: src/js/controllers/tx-details.js:102 +#: src/js/services/incomingData.js:98 msgid "Error" msgstr "" @@ -857,7 +894,7 @@ msgstr "" msgid "Error at confirm" msgstr "" -#: src/js/services/profileService.js:395 +#: src/js/services/profileService.js:396 msgid "Error creating wallet" msgstr "" @@ -905,16 +942,16 @@ msgstr "" msgid "Export wallet" msgstr "" -#: src/js/services/walletService.js:1019 +#: src/js/services/walletService.js:1079 #: www/views/tab-export-qrCode.html:9 msgid "Exporting via QR not supported for this wallet" msgstr "" -#: www/views/preferencesInformation.html:76 +#: www/views/preferencesInformation.html:83 msgid "Extended Public Keys" msgstr "" -#: src/js/services/onGoingProcess.js:19 +#: src/js/services/onGoingProcess.js:20 msgid "Extracting Wallet Information..." msgstr "" @@ -942,11 +979,11 @@ msgstr "" msgid "Feedback could not be submitted. Please try again later." msgstr "" -#: src/js/services/onGoingProcess.js:41 +#: src/js/services/onGoingProcess.js:42 msgid "Fetching BitPay Account..." msgstr "" -#: src/js/services/onGoingProcess.js:20 +#: src/js/services/onGoingProcess.js:21 msgid "Fetching Payment Information" msgstr "" @@ -1001,11 +1038,11 @@ msgstr "" msgid "Funds will be transferred to" msgstr "" -#: src/js/services/onGoingProcess.js:21 +#: src/js/services/onGoingProcess.js:22 msgid "Generating .csv file..." msgstr "" -#: src/js/services/onGoingProcess.js:36 +#: src/js/services/onGoingProcess.js:37 msgid "Generating new address..." msgstr "" @@ -1025,7 +1062,7 @@ msgstr "" msgid "Get started by adding your first one." msgstr "" -#: src/js/services/onGoingProcess.js:22 +#: src/js/services/onGoingProcess.js:23 msgid "Getting fee levels..." msgstr "" @@ -1034,7 +1071,7 @@ msgstr "" #: src/js/controllers/preferencesLanguage.js:14 #: src/js/controllers/tab-home.js:145 #: src/js/controllers/tab-settings.js:48 -#: src/js/controllers/tx-details.js:160 +#: src/js/controllers/tx-details.js:163 msgid "Go Back" msgstr "" @@ -1050,11 +1087,15 @@ msgstr "" msgid "Got it" msgstr "" -#: www/views/preferences.html:22 #: www/views/preferencesInformation.html:47 +#: www/views/preferencesInformation.html:53 msgid "Hardware Wallet" msgstr "" +#: www/views/preferencesExternal.html:18 +msgid "Hardware not connected." +msgstr "" + #: www/views/import.html:20 msgid "Hardware wallet" msgstr "" @@ -1071,7 +1112,7 @@ msgstr "" msgid "Hide" msgstr "" -#: www/views/preferences.html:38 +#: www/views/preferences.html:32 msgid "Hide Balance" msgstr "" @@ -1146,7 +1187,7 @@ msgstr "" msgid "I've written it down" msgstr "" -#: www/views/preferences.html:56 +#: www/views/preferences.html:50 msgid "If enabled, all sensitive information (private key and recovery phrase) and actions (spending and exporting) associated with this wallet will be protected." msgstr "" @@ -1187,7 +1228,7 @@ msgstr "" msgid "Import wallet" msgstr "" -#: src/js/services/onGoingProcess.js:23 +#: src/js/services/onGoingProcess.js:24 msgid "Importing Wallet..." msgstr "" @@ -1198,7 +1239,7 @@ msgstr "" #: www/views/includes/walletItem.html:11 #: www/views/includes/walletSelector.html:18 #: www/views/tab-home.html:89 -#: www/views/tab-settings.html:107 +#: www/views/tab-settings.html:117 msgid "Incomplete" msgstr "" @@ -1206,6 +1247,10 @@ msgstr "" msgid "Incomplete wallet" msgstr "" +#: www/views/pin.html:11 +msgid "Incorrect PIN, try again." +msgstr "" + #: src/js/services/bwcError.js:113 msgid "Incorrect address network" msgstr "" @@ -1225,13 +1270,13 @@ msgid "Insufficient funds for fee" msgstr "" #: www/views/modals/search.html:70 -#: www/views/walletDetails.html:256 +#: www/views/walletDetails.html:260 msgid "Invalid" msgstr "" -#: src/js/controllers/create.js:157 +#: src/js/controllers/create.js:165 #: src/js/controllers/import.js:298 -#: src/js/controllers/join.js:136 +#: src/js/controllers/join.js:140 msgid "Invalid account number" msgstr "" @@ -1243,12 +1288,17 @@ msgstr "" msgid "Invalid data" msgstr "" -#: src/js/controllers/create.js:137 +#: src/js/controllers/create.js:145 #: src/js/controllers/import.js:232 -#: src/js/controllers/join.js:115 +#: src/js/controllers/join.js:119 msgid "Invalid derivation path" msgstr "" +#: src/js/controllers/create.js:187 +#: src/js/controllers/join.js:163 +msgid "Invalid seed source id:" +msgstr "" + #: src/js/controllers/copayers.js:74 msgid "Invitation to share a {{appName}} Wallet" msgstr "" @@ -1290,7 +1340,7 @@ msgstr "" msgid "Join shared wallet" msgstr "" -#: src/js/services/onGoingProcess.js:24 +#: src/js/services/onGoingProcess.js:25 msgid "Joining Wallet..." msgstr "" @@ -1320,10 +1370,15 @@ msgstr "" msgid "Loading addresses..." msgstr "" -#: src/js/services/onGoingProcess.js:34 +#: src/js/services/onGoingProcess.js:35 msgid "Loading transaction info..." msgstr "" +#: www/views/lock.html:3 +#: www/views/tab-settings.html:95 +msgid "Lock App" +msgstr "" + #: www/views/modals/wallet-balance.html:80 msgid "Locked" msgstr "" @@ -1336,6 +1391,10 @@ msgstr "" msgid "Locktime in effect. Please wait to remove this spend proposal" msgstr "" +#: www/views/walletDetails.html:243 +msgid "Low fees" +msgstr "" + #: www/views/paymentUri.html:13 msgid "Make a payment to" msgstr "" @@ -1349,7 +1408,7 @@ msgid "Matches:" msgstr "" #: www/views/includes/copayers.html:4 -#: www/views/preferencesInformation.html:72 +#: www/views/preferencesInformation.html:79 msgid "Me" msgstr "" @@ -1357,7 +1416,7 @@ msgstr "" msgid "Meh - it's alright" msgstr "" -#: src/js/controllers/tx-details.js:132 +#: src/js/controllers/tx-details.js:135 #: www/views/modals/paypro.html:48 #: www/views/modals/txp-details.html:95 #: www/views/tx-details.html:74 @@ -1380,18 +1439,18 @@ msgstr "" msgid "Missing private keys to sign" msgstr "" -#: www/views/preferences.html:71 +#: www/views/preferences.html:65 #: www/views/preferencesAdvanced.html:3 msgid "More Options" msgstr "" #: www/views/modals/search.html:67 #: www/views/tx-details.html:19 -#: www/views/walletDetails.html:254 +#: www/views/walletDetails.html:258 msgid "Moved" msgstr "" -#: src/js/controllers/tx-details.js:110 +#: src/js/controllers/tx-details.js:113 msgid "Moved Funds" msgstr "" @@ -1451,6 +1510,10 @@ msgstr "" msgid "No contacts yet" msgstr "" +#: www/views/preferencesExternal.html:12 +msgid "No hardware information available." +msgstr "" + #: www/views/tab-import-hardware.html:3 msgid "No hardware wallets supported on this device" msgstr "" @@ -1553,6 +1616,10 @@ msgstr "" msgid "On this screen you can see all your wallets, accounts, and assets." msgstr "" +#: www/views/lockedView.html:14 +msgid "One-touch Sign In" +msgstr "" + #: src/js/controllers/tab-settings.js:47 msgid "Open" msgstr "" @@ -1569,7 +1636,7 @@ msgstr "" msgid "Open GitHub Project" msgstr "" -#: src/js/controllers/tx-details.js:159 +#: src/js/controllers/tx-details.js:162 msgid "Open Insight" msgstr "" @@ -1644,7 +1711,7 @@ msgstr "" msgid "Payment Proposals" msgstr "" -#: src/js/services/payproService.js:42 +#: src/js/services/payproService.js:32 msgid "Payment Protocol Invalid" msgstr "" @@ -1696,7 +1763,7 @@ msgstr "" msgid "Permanently delete this wallet." msgstr "" -#: src/js/services/profileService.js:387 +#: src/js/services/profileService.js:388 msgid "Personal Wallet" msgstr "" @@ -1712,16 +1779,24 @@ msgstr "" msgid "Please enter the recovery phrase" msgstr "" -#: src/js/controllers/create.js:109 -#: src/js/controllers/join.js:93 +#: src/js/controllers/create.js:117 +#: src/js/controllers/join.js:97 msgid "Please enter the required fields" msgstr "" -#: src/js/controllers/create.js:150 -#: src/js/controllers/join.js:129 +#: src/js/controllers/create.js:158 +#: src/js/controllers/join.js:133 msgid "Please enter the wallet recovery phrase" msgstr "" +#: www/views/pin.html:8 +msgid "Please enter your PIN" +msgstr "" + +#: www/views/lockedView.html:15 +msgid "Please place your fingertip on the scanner to verify your identity" +msgstr "" + #: www/views/backup.html:46 msgid "Please tap each word in the correct order." msgstr "" @@ -1738,7 +1813,7 @@ msgstr "" msgid "Preferences" msgstr "" -#: src/js/services/onGoingProcess.js:37 +#: src/js/services/onGoingProcess.js:38 msgid "Preparing addresses..." msgstr "" @@ -1746,7 +1821,7 @@ msgstr "" msgid "Preparing backup..." msgstr "" -#: src/js/routes.js:1144 +#: src/js/routes.js:1196 msgid "Press again to exit" msgstr "" @@ -1767,7 +1842,7 @@ msgid "Proposal Accepted" msgstr "" #: src/js/controllers/modals/txpDetails.js:51 -#: src/js/controllers/tx-details.js:58 +#: src/js/controllers/tx-details.js:61 #: www/views/confirm.html:124 msgid "Proposal Created" msgstr "" @@ -1800,8 +1875,8 @@ msgstr "" msgid "Quick review!" msgstr "" -#: src/js/controllers/create.js:69 -#: src/js/controllers/join.js:53 +#: src/js/controllers/create.js:65 +#: src/js/controllers/join.js:50 msgid "Random" msgstr "" @@ -1828,12 +1903,12 @@ msgstr "" msgid "Received" msgstr "" -#: src/js/controllers/tx-details.js:109 +#: src/js/controllers/tx-details.js:112 msgid "Received Funds" msgstr "" #: www/views/tx-details.html:24 -#: www/views/walletDetails.html:262 +#: www/views/walletDetails.html:266 msgid "Receiving" msgstr "" @@ -1869,16 +1944,16 @@ msgstr "" msgid "Recreate" msgstr "" -#: src/js/services/onGoingProcess.js:25 +#: src/js/services/onGoingProcess.js:26 msgid "Recreating Wallet..." msgstr "" #: src/js/controllers/modals/txpDetails.js:53 -#: src/js/controllers/tx-details.js:60 +#: src/js/controllers/tx-details.js:63 msgid "Rejected" msgstr "" -#: src/js/services/onGoingProcess.js:26 +#: src/js/services/onGoingProcess.js:27 msgid "Rejecting payment proposal" msgstr "" @@ -1906,7 +1981,7 @@ msgstr "" msgid "Repeat the password" msgstr "" -#: www/views/preferences.html:66 +#: www/views/preferences.html:60 msgid "Request Fingerprint" msgstr "" @@ -1914,7 +1989,7 @@ msgstr "" msgid "Request Specific amount" msgstr "" -#: www/views/preferences.html:53 +#: www/views/preferences.html:47 msgid "Request Spending Password" msgstr "" @@ -1926,11 +2001,11 @@ msgstr "" msgid "Restore from backup" msgstr "" -#: src/js/services/onGoingProcess.js:28 +#: src/js/services/onGoingProcess.js:29 msgid "Retrieving inputs information" msgstr "" -#: src/js/controllers/onboarding/tour.js:59 +#: src/js/controllers/onboarding/tour.js:60 msgid "Retry" msgstr "" @@ -1959,11 +2034,15 @@ msgstr "" msgid "Scan addresses for funds" msgstr "" +#: www/views/lockedView.html:17 +msgid "Scan again" +msgstr "" + #: src/js/services/fingerprintService.js:56 msgid "Scan your fingerprint please" msgstr "" -#: src/js/services/onGoingProcess.js:29 +#: src/js/services/onGoingProcess.js:30 msgid "Scanning Wallet funds..." msgstr "" @@ -1987,7 +2066,7 @@ msgstr "" msgid "Search your currency" msgstr "" -#: www/views/preferences.html:41 +#: www/views/preferences.html:35 msgid "Security" msgstr "" @@ -2003,7 +2082,7 @@ msgstr "" msgid "Self-signed Certificate" msgstr "" -#: src/js/services/onGoingProcess.js:40 +#: src/js/services/onGoingProcess.js:41 msgid "Selling Bitcoin..." msgstr "" @@ -2052,15 +2131,15 @@ msgstr "" #: www/views/includes/txp.html:14 #: www/views/modals/txp-details.html:19 #: www/views/tx-details.html:23 -#: www/views/walletDetails.html:261 +#: www/views/walletDetails.html:265 msgid "Sending" msgstr "" -#: src/js/services/onGoingProcess.js:38 +#: src/js/services/onGoingProcess.js:39 msgid "Sending 2FA code..." msgstr "" -#: src/js/services/onGoingProcess.js:35 +#: src/js/services/onGoingProcess.js:36 msgid "Sending feedback..." msgstr "" @@ -2068,7 +2147,7 @@ msgstr "" msgid "Sending maximum amount" msgstr "" -#: src/js/services/onGoingProcess.js:30 +#: src/js/services/onGoingProcess.js:31 msgid "Sending transaction" msgstr "" @@ -2079,11 +2158,11 @@ msgstr "" #: www/views/modals/search.html:60 #: www/views/modals/tx-status.html:9 #: www/views/tx-details.html:17 -#: www/views/walletDetails.html:249 +#: www/views/walletDetails.html:253 msgid "Sent" msgstr "" -#: src/js/controllers/tx-details.js:108 +#: src/js/controllers/tx-details.js:111 msgid "Sent Funds" msgstr "" @@ -2113,7 +2192,7 @@ msgid "Settings" msgstr "" #: www/views/customAmount.html:20 -#: www/views/tab-receive.html:62 +#: www/views/tab-receive.html:67 msgid "Share" msgstr "" @@ -2139,6 +2218,14 @@ msgstr "" msgid "Shared Wallet" msgstr "" +#: www/views/preferencesExternal.html:34 +msgid "Show Recovery Phrase" +msgstr "" + +#: www/views/tab-receive.html:58 +msgid "Show address" +msgstr "" + #: www/views/join.html:45 #: www/views/tab-create-personal.html:24 #: www/views/tab-create-shared.html:54 @@ -2161,7 +2248,7 @@ msgstr "" msgid "Signatures rejected by server" msgstr "" -#: src/js/services/onGoingProcess.js:31 +#: src/js/services/onGoingProcess.js:32 msgid "Signing transaction" msgstr "" @@ -2183,8 +2270,8 @@ msgstr "" msgid "Slide" msgstr "" -#: src/js/controllers/create.js:72 -#: src/js/controllers/join.js:56 +#: src/js/controllers/create.js:69 +#: src/js/controllers/join.js:53 msgid "Specify Recovery Phrase..." msgstr "" @@ -2220,7 +2307,7 @@ msgstr "" msgid "Sweep paper wallet" msgstr "" -#: src/js/services/onGoingProcess.js:32 +#: src/js/services/onGoingProcess.js:33 msgid "Sweeping Wallet..." msgstr "" @@ -2272,7 +2359,7 @@ msgstr "" msgid "That's exciting to hear. We'd love to earn that fifth star from you – how could we improve your experience?" msgstr "" -#: src/js/services/ledger.js:136 +#: src/js/services/ledger.js:152 msgid "The Ledger Chrome application is not installed" msgstr "" @@ -2312,7 +2399,7 @@ msgstr "" msgid "The password of the recovery phrase (if set)" msgstr "" -#: src/js/services/walletService.js:984 +#: src/js/services/walletService.js:1044 msgid "The payment was created but could not be completed. Please try again from home screen" msgstr "" @@ -2392,13 +2479,17 @@ msgstr "" msgid "This recovery phrase was created with a password. To recover this wallet both the recovery phrase and password are needed." msgstr "" +#: www/views/tx-details.html:89 +msgid "This transaction could take a long time to confirm or could be dropped due to the low fees set by the sender" +msgstr "" + #: www/views/walletDetails.html:116 #: www/views/walletDetails.html:35 msgid "This wallet is not registered at the given Bitcore Wallet Service (BWS). You can recreate it from the local information." msgstr "" #: www/views/modals/txp-details.html:137 -#: www/views/tx-details.html:102 +#: www/views/tx-details.html:106 msgid "Timeline" msgstr "" @@ -2453,7 +2544,7 @@ msgstr "" msgid "Transaction created" msgstr "" -#: src/js/controllers/tx-details.js:99 +#: src/js/controllers/tx-details.js:102 msgid "Transaction not available at this time" msgstr "" @@ -2466,6 +2557,10 @@ msgstr "" msgid "Transfer to Wallet" msgstr "" +#: www/views/pin.html:12 +msgid "Try again in {{expires}}" +msgstr "" + #: www/views/bitpayCardIntro.html:18 msgid "Turn bitcoin into dollars, swipe anywhere Visa® is accepted." msgstr "" @@ -2479,7 +2574,7 @@ msgid "Uh oh..." msgstr "" #: www/views/modals/search.html:36 -#: www/views/tx-details.html:90 +#: www/views/tx-details.html:94 msgid "Unconfirmed" msgstr "" @@ -2523,11 +2618,12 @@ msgstr "" msgid "Use Unconfirmed Funds" msgstr "" -#: src/js/services/onGoingProcess.js:33 +#: src/js/services/onGoingProcess.js:34 msgid "Validating recovery phrase..." msgstr "" #: www/views/preferencesAbout.html:14 +#: www/views/preferencesExternal.html:25 msgid "Version" msgstr "" @@ -2543,7 +2639,7 @@ msgstr "" msgid "View Terms of Service" msgstr "" -#: src/js/controllers/tx-details.js:158 +#: src/js/controllers/tx-details.js:161 msgid "View Transaction on Insight" msgstr "" @@ -2551,7 +2647,7 @@ msgstr "" msgid "View Update" msgstr "" -#: www/views/tx-details.html:128 +#: www/views/tx-details.html:132 msgid "View on blockchain" msgstr "" @@ -2571,11 +2667,11 @@ msgstr "" msgid "WARNING: UNTRUSTED CERTIFICATE" msgstr "" -#: src/js/services/onGoingProcess.js:14 +#: src/js/services/onGoingProcess.js:15 msgid "Waiting for Ledger..." msgstr "" -#: src/js/services/onGoingProcess.js:15 +#: src/js/services/onGoingProcess.js:16 msgid "Waiting for Trezor..." msgstr "" @@ -2660,7 +2756,7 @@ msgstr "" msgid "Wallet already exists" msgstr "" -#: src/js/services/profileService.js:497 +#: src/js/services/profileService.js:498 msgid "Wallet already in Copay" msgstr "" @@ -2722,13 +2818,14 @@ msgstr "" msgid "Wallets" msgstr "" -#: www/views/tab-settings.html:92 +#: www/views/tab-settings.html:102 msgid "Wallets & Integrations" msgstr "" #: src/js/controllers/modals/txpDetails.js:143 #: src/js/controllers/modals/txpDetails.js:160 #: src/js/controllers/preferencesDelete.js:25 +#: src/js/controllers/preferencesExternal.js:14 #: www/views/preferencesDeleteWallet.html:11 msgid "Warning!" msgstr "" @@ -2867,7 +2964,7 @@ msgstr "" msgid "Your wallet is never saved to cloud storage or standard device backups." msgstr "" -#: src/js/services/walletService.js:875 +#: src/js/services/walletService.js:935 msgid "Your wallet key will be encrypted. The Spending Password cannot be recovered. Be sure to write it down." msgstr "" @@ -2883,7 +2980,7 @@ msgstr "" msgid "add your BitPay Visa card(s)" msgstr "" -#: www/views/tab-receive.html:70 +#: www/views/tab-receive.html:75 msgid "address not available" msgstr "" @@ -2891,11 +2988,15 @@ msgstr "" msgid "address not yet available" msgstr "" +#: src/js/controllers/lockedView.js:5 +msgid "is locked" +msgstr "" + #: www/views/includes/available-balance.html:8 msgid "locked by pending payments" msgstr "" -#: src/js/services/profileService.js:388 +#: src/js/services/profileService.js:389 msgid "me" msgstr "" @@ -2925,6 +3026,10 @@ msgstr "" msgid "{{appName}} depends on Bitcore Wallet Service (BWS) for blockchain information, networking and Copayer synchronization. The default configuration points to https://bws.bitpay.com (BitPay's public BWS instance)." msgstr "" +#: src/js/controllers/lock.js:96 +msgid "{{appName}} is protected by Pin. Are you sure you want to disable it?" +msgstr "" + #: www/views/includes/confirm-tx.html:23 msgid "{{feeRateStr}} of the transaction" msgstr "" @@ -2938,6 +3043,6 @@ msgid "{{updatingTxHistoryProgress}} transactions downloaded" msgstr "" #: www/views/copayers.html:46 -#: www/views/includes/walletInfo.html:11 +#: www/views/includes/walletInfo.html:12 msgid "{{wallet.m}}-of-{{wallet.n}}" msgstr "" diff --git a/www/views/lock.html b/www/views/lock.html index d0e49e15e..821cb7310 100644 --- a/www/views/lock.html +++ b/www/views/lock.html @@ -7,7 +7,7 @@ - {{opt.label}} + {{opt.label}}
From acb4d3d354501467cc268a840ed706edb4f85023 Mon Sep 17 00:00:00 2001 From: Gustavo Maximiliano Cortez Date: Tue, 18 Apr 2017 10:38:44 -0300 Subject: [PATCH 73/83] Top up a debit card is limited to 10000 usd --- src/js/controllers/topup.js | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/src/js/controllers/topup.js b/src/js/controllers/topup.js index 1a2d2ac03..43b1b4f43 100644 --- a/src/js/controllers/topup.js +++ b/src/js/controllers/topup.js @@ -50,6 +50,22 @@ angular.module('copayApp.controllers').controller('topUpController', function($s } }; + var checkDailyLimit = function() { + if (currency == 'USD' && amount > 10000) { + showErrorAndBack('Top up is limited to USD 10,000 per day'); + return; + } + + bitpayCardService.getRates('USD', function(err, data) { + if (err) $log.error(err); + $scope.rate = data.rate; + if (currency == 'BTC' && (amount * data.rate) > 10000) { + showErrorAndBack('Top up is limited to USD 10,000 per day'); + return; + } + }); + }; + $scope.$on("$ionicView.beforeEnter", function(event, data) { cardId = data.stateParams.id; sendMax = data.stateParams.useSendMax; @@ -81,11 +97,6 @@ angular.module('copayApp.controllers').controller('topUpController', function($s } $scope.onWalletSelect($scope.wallets[0]); // Default first wallet - bitpayCardService.getRates('USD', function(err, data) { - if (err) $log.error(err); - $scope.rate = data.rate; - }); - bitpayCardService.get({ cardId: cardId, noRefresh: true }, function(err, card) { if (err) { showErrorAndBack(err); @@ -207,11 +218,14 @@ angular.module('copayApp.controllers').controller('topUpController', function($s amount = parsedAmount.amount; currency = parsedAmount.currency; + checkDailyLimit(); $scope.amountUnitStr = parsedAmount.amountUnitStr; $timeout(function() { $scope.$digest(); }, 100); }); + } else { + checkDailyLimit(); } }; From ef0addc29d52e27743b1df2c0aef5c50d4bb05ab Mon Sep 17 00:00:00 2001 From: JDonadio Date: Tue, 18 Apr 2017 10:18:55 -0300 Subject: [PATCH 74/83] fix config.lock options by default --- src/js/controllers/lock.js | 14 +++++++------- src/js/controllers/pin.js | 4 +++- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/js/controllers/lock.js b/src/js/controllers/lock.js index 13c9fccb7..6a53bff7b 100644 --- a/src/js/controllers/lock.js +++ b/src/js/controllers/lock.js @@ -4,18 +4,18 @@ angular.module('copayApp.controllers').controller('lockController', function($st function init() { var config = configService.getSync(); - $scope.locking = config.lock.method != 'pin'; + $scope.locking = config.lock && config.lock.method == 'pin' ? false : true; $scope.options = [ { - method: 'none', + method: '', label: gettextCatalog.getString('Disabled'), - value: config.lock.method == '', + selected: config.lock && config.lock.method == '' ? true : false, }, { method: 'pin', label: gettextCatalog.getString('Enable PIN'), - value: config.lock.method == 'pin', + selected: config.lock && config.lock.method == 'pin' ? true : false, needsBackup: null, }, ]; @@ -24,12 +24,12 @@ angular.module('copayApp.controllers').controller('lockController', function($st $scope.options.push({ method: 'fingerprint', label: gettextCatalog.getString('Enable Fingerprint'), - value: config.lock.method == 'fingerprint', + selected: config.lock && config.lock.method == 'fingerprint' ? true : false, needsBackup: null, }); } - $scope.currentOption = lodash.find($scope.options, 'value'); + $scope.currentOption = lodash.find($scope.options, 'selected') || $scope.options[0]; processWallets(); }; @@ -71,7 +71,7 @@ angular.module('copayApp.controllers').controller('lockController', function($st }; $scope.select = function(method) { - if (method == 'none') + if (method == '') saveConfig(); else if (method == 'fingerprint') { var config = configService.getSync(); diff --git a/src/js/controllers/pin.js b/src/js/controllers/pin.js index 94dd15d40..ef48c0198 100644 --- a/src/js/controllers/pin.js +++ b/src/js/controllers/pin.js @@ -15,6 +15,7 @@ angular.module('copayApp.controllers').controller('pinController', function($sta $scope.$on("$ionicView.enter", function(event) { configService.whenAvailable(function(config) { + if (!config.lock) return; $scope.bannedUntil = config.lock.bannedUntil || null; if ($scope.bannedUntil) { var now = Math.floor(Date.now() / 1000); @@ -156,12 +157,13 @@ angular.module('copayApp.controllers').controller('pinController', function($sta function saveSettings(method, value) { var config = configService.getSync(); + var attempts = config.lock && config.lock.attempts ? config.lock.attempts : 0; var opts = { lock: { method: method || '', value: value || '', bannedUntil: null, - attempts: config.lock.attempts + 1, + attempts: attempts + 1, } }; From bb7186db695c2e2e876662e90c4b1481f56ee8aa Mon Sep 17 00:00:00 2001 From: Matias Alejo Garcia Date: Tue, 18 Apr 2017 11:14:05 -0300 Subject: [PATCH 75/83] refactor routes --- src/js/controllers/{lock.js => lockSetup.js} | 0 src/js/routes.js | 83 ++++++++++---------- 2 files changed, 42 insertions(+), 41 deletions(-) rename src/js/controllers/{lock.js => lockSetup.js} (100%) diff --git a/src/js/controllers/lock.js b/src/js/controllers/lockSetup.js similarity index 100% rename from src/js/controllers/lock.js rename to src/js/controllers/lockSetup.js diff --git a/src/js/routes.js b/src/js/routes.js index 7a4d400c2..99c16fbb7 100644 --- a/src/js/routes.js +++ b/src/js/routes.js @@ -463,16 +463,16 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr } } }) - .state('tabs.lock', { - url: '/lock', + .state('tabs.lockSetup', { + url: '/lockSetup', views: { 'tab-settings@tabs': { - controller: 'lockController', - templateUrl: 'views/lock.html', + controller: 'lockSetupController', + templateUrl: 'views/lockSetup.html', } } }) - .state('tabs.lock.pin', { + .state('tabs.pin', { url: '/pin/:fromSettings/:locking', views: { 'tab-settings@tabs': { @@ -1205,25 +1205,42 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr // Nothing to do }); - $ionicPlatform.on('resume', function() { - configService.whenAvailable(function(config) { - var nextView; - var lock = config.lock; - if (lock && lock.method == 'fingerprint' && fingerprintService.isAvailable()) { - fingerprintService.check('unlockingApp', function(err) { - if (err) goTo('lockedView'); - else if ($ionicHistory.currentStateName() == 'lockedView') goTo('tabs.home'); - }); - } else if (lock && lock.method == 'pin') { - goTo('pin'); - } - function goTo(nextView) { - $state.transitionTo(nextView).then(function() { - if (nextView == 'lockedView') $ionicHistory.clearHistory(); + function checkAndApplyLock(defaultView) { + + if (!platformInfo.isCordova && !platformInfo.isDevel) { + goTo('tabs.home'); + } + + function goTo(nextView) { + $state.transitionTo(nextView).then(function() { + if (nextView == 'lockedView') + $ionicHistory.clearHistory(); + }); + }; + + configService.whenAvailable(function(config) { + var lockMethod = config.lock && config.lock.method; + $log.debug('App Lock:' + (lockMethod||'no') ); + + if (lockMethod == 'fingerprint' && fingerprintService.isAvailable()) { + fingerprintService.check('unlockingApp', function(err) { + if (err) + goTo('lockedView'); + + if ($ionicHistory.currentStateName() == 'lockedView') + goTo('tabs.home'); }); - }; + } else if (lockMethod == 'pin') { + goTo('pin'); + } else if (defaultView) { + goTo(defaultView); + } }); + } + + $ionicPlatform.on('resume', function() { + checkAndApplyLock(); }); $ionicPlatform.on('menubutton', function() { @@ -1266,27 +1283,11 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr disableAnimate: true, historyRoot: true }); - if (platformInfo.isCordova || platformInfo.isDevel) { - startupService.ready(); - configService.whenAvailable(function(config) { - var lock = config.lock; - if (fingerprintService.isAvailable() && lock && lock.method == 'fingerprint') { - fingerprintService.check('unlockingApp', function(err) { - if (err) goTo('lockedView'); - else goTo('tabs.home'); - }); - } else if (lock && lock.method == 'pin') { - goTo('pin'); - } else - goTo('tabs.home'); - }); - } else goTo('tabs.home'); - function goTo(nextView) { - $state.transitionTo(nextView).then(function() { - $ionicHistory.clearHistory(); - }); - } + if (platformInfo.isCordova) + startupService.ready(); + + checkAndApplyLock('tabs.home'); }); }; // After everything have been loaded, initialize handler URL From e67737a5b14e642b151976cd23e353ccf0d0932e Mon Sep 17 00:00:00 2001 From: Gustavo Maximiliano Cortez Date: Tue, 18 Apr 2017 11:26:15 -0300 Subject: [PATCH 76/83] Removes notification screen from onboarding. Also removes unused/old notification plugin --- src/js/controllers/backController.js | 9 +--- src/js/controllers/onboarding/collectEmail.js | 24 ++------- .../controllers/onboarding/notifications.js | 53 ------------------- src/js/controllers/onboarding/tour.js | 18 ++----- src/js/routes.js | 12 +---- src/sass/variables.scss | 1 - .../onboard-push-notifications.scss | 9 ---- src/sass/views/onboarding/onboarding.scss | 5 -- 8 files changed, 11 insertions(+), 120 deletions(-) delete mode 100644 src/js/controllers/onboarding/notifications.js delete mode 100644 src/sass/views/onboarding/onboard-push-notifications.scss diff --git a/src/js/controllers/backController.js b/src/js/controllers/backController.js index f1fa38b68..510354649 100644 --- a/src/js/controllers/backController.js +++ b/src/js/controllers/backController.js @@ -1,10 +1,6 @@ 'use strict'; -angular.module('copayApp.controllers').controller('backController', function($scope, $state, $stateParams, platformInfo) { - - var isCordova = platformInfo.isCordova; - var isWP = platformInfo.isWP; - var usePushNotifications = isCordova && !isWP; +angular.module('copayApp.controllers').controller('backController', function($scope, $state, $stateParams) { $scope.importGoBack = function() { if ($stateParams.fromOnboarding) $state.go('onboarding.welcome'); @@ -12,8 +8,7 @@ angular.module('copayApp.controllers').controller('backController', function($sc }; $scope.onboardingMailSkip = function() { - if (!usePushNotifications) $state.go('onboarding.backupRequest'); - else $state.go('onboarding.notifications'); + $state.go('onboarding.backupRequest'); } }); diff --git a/src/js/controllers/onboarding/collectEmail.js b/src/js/controllers/onboarding/collectEmail.js index 7a23da915..6e3d230bd 100644 --- a/src/js/controllers/onboarding/collectEmail.js +++ b/src/js/controllers/onboarding/collectEmail.js @@ -1,6 +1,6 @@ 'use strict'; -angular.module('copayApp.controllers').controller('collectEmailController', function($scope, $state, $timeout, $stateParams, $ionicConfig, profileService, configService, walletService, platformInfo, pushNotificationsService) { +angular.module('copayApp.controllers').controller('collectEmailController', function($scope, $state, $timeout, $stateParams, $ionicConfig, profileService, configService, walletService) { $scope.$on("$ionicView.beforeLeave", function() { $ionicConfig.views.swipeBackEnabled(true); @@ -10,11 +10,6 @@ angular.module('copayApp.controllers').controller('collectEmailController', func $ionicConfig.views.swipeBackEnabled(false); }); - var isCordova = platformInfo.isCordova; - var isWP = platformInfo.isWP; - var usePushNotifications = isCordova && !isWP; - var requiresOptIn = platformInfo.isIOS; - var wallet = profileService.getWallet($stateParams.walletId); var walletId = wallet.credentials.walletId; $scope.data = {}; @@ -37,20 +32,9 @@ angular.module('copayApp.controllers').controller('collectEmailController', func }; $scope.goNextView = function() { - if (!usePushNotifications) { - $state.go('onboarding.backupRequest', { - walletId: walletId - }); - } else if (requiresOptIn) { - $state.go('onboarding.notifications', { - walletId: walletId - }); - } else { - pushNotificationsService.init(); - $state.go('onboarding.backupRequest', { - walletId: walletId - }); - } + $state.go('onboarding.backupRequest', { + walletId: walletId + }); }; $scope.confirm = function(emailForm) { diff --git a/src/js/controllers/onboarding/notifications.js b/src/js/controllers/onboarding/notifications.js deleted file mode 100644 index c4554c84b..000000000 --- a/src/js/controllers/onboarding/notifications.js +++ /dev/null @@ -1,53 +0,0 @@ -'use strict'; - -angular.module('copayApp.controllers').controller('notificationsController', function($scope, $state, $timeout, $stateParams, $ionicConfig, profileService, configService, $interval, pushNotificationsService) { - - $scope.$on("$ionicView.enter", function() { - $ionicConfig.views.swipeBackEnabled(false); - }); - - $scope.$on("$ionicView.beforeLeave", function() { - $ionicConfig.views.swipeBackEnabled(true); - }); - - $scope.walletId = $stateParams.walletId; - - $scope.allowNotif = function() { - $scope.notificationDialogOpen = true; - $timeout(function() { - pushNotificationsService.init(); - }); - $scope.notificationPromise = $interval(function() { - PushNotification.hasPermission(function(data) { - if (data.isEnabled) { - $interval.cancel($scope.notificationPromise); - $state.go('onboarding.backupRequest', { - walletId: $scope.walletId - }); - } - }); - }, 100); - } - - $scope.continue = function() { - $interval.cancel($scope.notificationPromise); - $state.go('onboarding.backupRequest', { - walletId: $scope.walletId - }); - } - - $scope.disableNotif = function() { - var opts = { - pushNotifications: { - enabled: false - } - }; - configService.set(opts, function(err) { - if (err) $log.warn(err); - $state.go('onboarding.backupRequest', { - walletId: $scope.walletId - }); - }); - }; - -}); diff --git a/src/js/controllers/onboarding/tour.js b/src/js/controllers/onboarding/tour.js index 7652366f6..0135e97fb 100644 --- a/src/js/controllers/onboarding/tour.js +++ b/src/js/controllers/onboarding/tour.js @@ -1,10 +1,6 @@ 'use strict'; angular.module('copayApp.controllers').controller('tourController', - function($scope, $state, $log, $timeout, $filter, ongoingProcess, platformInfo, profileService, rateService, popupService, gettextCatalog) { - - var isCordova = platformInfo.isCordova; - var isWP = platformInfo.isWP; - var usePushNotifications = isCordova && !isWP; + function($scope, $state, $log, $timeout, $filter, ongoingProcess, profileService, rateService, popupService, gettextCatalog) { $scope.data = { index: 0 @@ -66,15 +62,9 @@ angular.module('copayApp.controllers').controller('tourController', ongoingProcess.set('creatingWallet', false); var wallet = walletClient; var walletId = wallet.credentials.walletId; - if (!usePushNotifications) { - $state.go('onboarding.backupRequest', { - walletId: walletId - }); - } else { - $state.go('onboarding.notifications', { - walletId: walletId - }); - } + $state.go('onboarding.backupRequest', { + walletId: walletId + }); }); }, 300); }; diff --git a/src/js/routes.js b/src/js/routes.js index 7a4d400c2..0709e011d 100644 --- a/src/js/routes.js +++ b/src/js/routes.js @@ -777,15 +777,6 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr } } }) - .state('onboarding.notifications', { - url: '/notifications/:walletId', - views: { - 'onboarding': { - templateUrl: 'views/onboarding/notifications.html', - controller: 'notificationsController' - } - } - }) .state('onboarding.backupRequest', { url: '/backupRequest/:walletId', views: { @@ -1176,12 +1167,11 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr var matchWelcome = $ionicHistory.currentStateName() == 'onboarding.welcome' ? true : false; var matchCollectEmail = $ionicHistory.currentStateName() == 'onboarding.collectEmail' ? true : false; var matchBackupRequest = $ionicHistory.currentStateName() == 'onboarding.backupRequest' ? true : false; - var matchNotifications = $ionicHistory.currentStateName() == 'onboarding.notifications' ? true : false; var backedUp = $ionicHistory.backView().stateName == 'onboarding.backup' ? true : false; var noBackView = $ionicHistory.backView().stateName == 'starting' ? true : false; var matchDisclaimer = $ionicHistory.currentStateName() == 'onboarding.disclaimer' && (backedUp || noBackView) ? true : false; - var fromOnboarding = matchCollectEmail | matchBackupRequest | matchNotifications | matchWelcome | matchDisclaimer; + var fromOnboarding = matchCollectEmail | matchBackupRequest | matchWelcome | matchDisclaimer; //views with disable backbutton var matchComplete = $ionicHistory.currentStateName() == 'tabs.rate.complete' ? true : false; diff --git a/src/sass/variables.scss b/src/sass/variables.scss index 7b1b4e882..d91baa647 100644 --- a/src/sass/variables.scss +++ b/src/sass/variables.scss @@ -116,7 +116,6 @@ $v-onboarding-checkbox-on-border: $v-success-color !default; $v-onboarding-tour-phone-bg: url(../img/onboarding-tour-phone.svg) !default; $v-onboarding-tour-currency-bg: url(../img/onboarding-tour-currency-bg.svg) !default; $v-onboarding-tour-control-bg: url(../img/onboarding-tour-control.svg) !default; -$v-onboarding-push-notification-bg: url(../img/onboarding-push-notifications.svg) !default; $v-onboarding-backup-warning-bg: url(../img/backup-warning.svg) !default; $v-onboarding-button-back-color: #ffffff !default; diff --git a/src/sass/views/onboarding/onboard-push-notifications.scss b/src/sass/views/onboarding/onboard-push-notifications.scss deleted file mode 100644 index 09f939953..000000000 --- a/src/sass/views/onboarding/onboard-push-notifications.scss +++ /dev/null @@ -1,9 +0,0 @@ -#onboarding-push-notifications { - #notifications-topic { - margin-top: 3rem; - } - #cta-buttons { - @extend %cta-buttons; - padding-bottom: 1rem; - } -} diff --git a/src/sass/views/onboarding/onboarding.scss b/src/sass/views/onboarding/onboarding.scss index c7129a68a..60bf824f7 100644 --- a/src/sass/views/onboarding/onboarding.scss +++ b/src/sass/views/onboarding/onboarding.scss @@ -82,7 +82,6 @@ @import "onboard-backup-request"; @import "../backup-warning"; @import "onboard-disclaimer"; -@import "onboard-push-notifications"; %onboarding-illustration { width: 100%; @@ -124,10 +123,6 @@ @extend %onboarding-illustration; background-image: $v-onboarding-tour-control-bg; } - &-notifications { - @extend %onboarding-illustration; - background-image: $v-onboarding-push-notification-bg; - } &-backup-warning { @extend %onboarding-illustration; background-image: $v-onboarding-backup-warning-bg; From e8685630f8e65fdeef38627d6edccf06ec7fa985 Mon Sep 17 00:00:00 2001 From: Gustavo Maximiliano Cortez Date: Tue, 18 Apr 2017 11:53:53 -0300 Subject: [PATCH 77/83] Friendly error message if touch id failed --- src/js/services/fingerprintService.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/js/services/fingerprintService.js b/src/js/services/fingerprintService.js index 86488a96a..30e288a79 100644 --- a/src/js/services/fingerprintService.js +++ b/src/js/services/fingerprintService.js @@ -40,7 +40,7 @@ angular.module('copayApp.services').factory('fingerprintService', function($log, }, function(msg) { $log.debug('Finger Failed:' + JSON.stringify(msg)); - return cb(gettextCatalog.getString('Finger Scan Failed') + ': ' + msg.localizedDescription); + return cb(gettextCatalog.getString('Finger Scan Failed')); } ); } catch (e) { @@ -60,7 +60,7 @@ angular.module('copayApp.services').factory('fingerprintService', function($log, }, function(msg) { $log.debug('Touch ID Failed:' + JSON.stringify(msg)); - return cb(gettextCatalog.getString('Touch ID Failed') + ': ' + msg.localizedDescription); + return cb(gettextCatalog.getString('Touch ID Failed')); } ); } catch (e) { From 8be28e85dace3ca2bd1864e88ce21a30e938580e Mon Sep 17 00:00:00 2001 From: JDonadio Date: Tue, 18 Apr 2017 13:19:16 -0300 Subject: [PATCH 78/83] refactor --- src/js/controllers/lockSetup.js | 46 +++++++++++++------------ src/js/controllers/pin.js | 4 +-- src/js/controllers/tab-settings.js | 4 +-- src/js/routes.js | 26 +++++++------- src/js/services/configService.js | 4 +-- www/views/{lock.html => lockSetup.html} | 2 +- www/views/tab-settings.html | 2 +- 7 files changed, 45 insertions(+), 43 deletions(-) rename www/views/{lock.html => lockSetup.html} (88%) diff --git a/src/js/controllers/lockSetup.js b/src/js/controllers/lockSetup.js index 6a53bff7b..b9ad3a431 100644 --- a/src/js/controllers/lockSetup.js +++ b/src/js/controllers/lockSetup.js @@ -1,21 +1,16 @@ 'use strict'; -angular.module('copayApp.controllers').controller('lockController', function($state, $scope, $timeout, $log, configService, popupService, gettextCatalog, appConfigService, fingerprintService, profileService, lodash) { +angular.module('copayApp.controllers').controller('lockSetupController', function($state, $scope, $timeout, $log, configService, popupService, gettextCatalog, appConfigService, fingerprintService, profileService, lodash) { function init() { - var config = configService.getSync(); - $scope.locking = config.lock && config.lock.method == 'pin' ? false : true; - $scope.options = [ { - method: '', + method: null, label: gettextCatalog.getString('Disabled'), - selected: config.lock && config.lock.method == '' ? true : false, }, { method: 'pin', - label: gettextCatalog.getString('Enable PIN'), - selected: config.lock && config.lock.method == 'pin' ? true : false, + label: gettextCatalog.getString('Lock by PIN'), needsBackup: null, }, ]; @@ -23,13 +18,17 @@ angular.module('copayApp.controllers').controller('lockController', function($st if (fingerprintService.isAvailable()) { $scope.options.push({ method: 'fingerprint', - label: gettextCatalog.getString('Enable Fingerprint'), - selected: config.lock && config.lock.method == 'fingerprint' ? true : false, + label: gettextCatalog.getString('Lock by Fingerprint'), needsBackup: null, }); } - $scope.currentOption = lodash.find($scope.options, 'selected') || $scope.options[0]; + var config = configService.getSync(); + var method = config.lock && config.lock.method; + if (!method) $scope.currentOption = $scope.options[0]; + else $scope.currentOption = lodash.find($scope.options, { + 'method': method + }); processWallets(); }; @@ -70,21 +69,24 @@ angular.module('copayApp.controllers').controller('lockController', function($st }); }; - $scope.select = function(method) { - if (method == '') + $scope.select = function(selectedMethod) { + var config = configService.getSync(); + var savedMethod = config.lock && config.lock.method; + + if (!selectedMethod) saveConfig(); - else if (method == 'fingerprint') { - var config = configService.getSync(); - if (config.lock.method == 'pin') { + else if (selectedMethod == 'fingerprint') { + if (savedMethod == 'pin') { askForDisablePin(function(disablePin) { if (disablePin) saveConfig('fingerprint'); else init(); }); } else saveConfig('fingerprint'); - } else if (method == 'pin') { - $state.transitionTo('tabs.lock.pin', { + } else if (selectedMethod == 'pin') { + if (savedMethod == 'pin') return; + $state.transitionTo('tabs.pin', { fromSettings: true, - locking: $scope.locking + locking: savedMethod == 'pin' ? false : true }); } $timeout(function() { @@ -93,7 +95,7 @@ angular.module('copayApp.controllers').controller('lockController', function($st }; function askForDisablePin(cb) { - var message = gettextCatalog.getString('{{appName}} is protected by Pin. Are you sure you want to disable it?', { + var message = gettextCatalog.getString('{{appName}} startup is locked by PIN. Are you sure you want to disable it?', { appName: appConfigService.nameCase }); var okText = gettextCatalog.getString('Continue'); @@ -107,8 +109,8 @@ angular.module('copayApp.controllers').controller('lockController', function($st function saveConfig(method) { var opts = { lock: { - method: method || '', - value: '', + method: method || null, + value: null, } }; diff --git a/src/js/controllers/pin.js b/src/js/controllers/pin.js index ef48c0198..9abadb441 100644 --- a/src/js/controllers/pin.js +++ b/src/js/controllers/pin.js @@ -160,8 +160,8 @@ angular.module('copayApp.controllers').controller('pinController', function($sta var attempts = config.lock && config.lock.attempts ? config.lock.attempts : 0; var opts = { lock: { - method: method || '', - value: value || '', + method: method || null, + value: value || null, bannedUntil: null, attempts: attempts + 1, } diff --git a/src/js/controllers/tab-settings.js b/src/js/controllers/tab-settings.js index 80152ca61..843059c84 100644 --- a/src/js/controllers/tab-settings.js +++ b/src/js/controllers/tab-settings.js @@ -54,8 +54,8 @@ angular.module('copayApp.controllers').controller('tabSettingsController', funct $scope.isDevel = platformInfo.isDevel; $scope.appName = appConfigService.nameCase; configService.whenAvailable(function(config) { - $scope.locked = config.lock && config.lock.method != '' ? true : false; - $scope.method = config.lock && config.lock.method != '' ? config.lock.method.charAt(0).toUpperCase() + config.lock.method.slice(1) : gettextCatalog.getString('Disabled'); + $scope.locked = config.lock && config.lock.method; + $scope.method = $scope.locked ? config.lock.method.charAt(0).toUpperCase() + config.lock.method.slice(1) : gettextCatalog.getString('Disabled'); }); }); diff --git a/src/js/routes.js b/src/js/routes.js index 99c16fbb7..da09f3a7b 100644 --- a/src/js/routes.js +++ b/src/js/routes.js @@ -1206,41 +1206,44 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr }); - function checkAndApplyLock(defaultView) { + function checkAndApplyLock(onResume) { + var defaultView = 'tabs.home'; if (!platformInfo.isCordova && !platformInfo.isDevel) { - goTo('tabs.home'); + goTo(defaultView); } function goTo(nextView) { + nextView = nextView || defaultView; $state.transitionTo(nextView).then(function() { - if (nextView == 'lockedView') + if (nextView == 'lockedView') $ionicHistory.clearHistory(); }); }; + startupService.ready(); + configService.whenAvailable(function(config) { var lockMethod = config.lock && config.lock.method; - $log.debug('App Lock:' + (lockMethod||'no') ); + $log.debug('App Lock:' + (lockMethod || 'no')); if (lockMethod == 'fingerprint' && fingerprintService.isAvailable()) { fingerprintService.check('unlockingApp', function(err) { - if (err) + if (err) goTo('lockedView'); - - if ($ionicHistory.currentStateName() == 'lockedView') + if ($ionicHistory.currentStateName() == 'lockedView' || !onResume) goTo('tabs.home'); }); } else if (lockMethod == 'pin') { goTo('pin'); - } else if (defaultView) { + } else { goTo(defaultView); } }); } $ionicPlatform.on('resume', function() { - checkAndApplyLock(); + checkAndApplyLock(true); }); $ionicPlatform.on('menubutton', function() { @@ -1284,10 +1287,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr historyRoot: true }); - if (platformInfo.isCordova) - startupService.ready(); - - checkAndApplyLock('tabs.home'); + checkAndApplyLock(); }); }; // After everything have been loaded, initialize handler URL diff --git a/src/js/services/configService.js b/src/js/services/configService.js index 3d979af7f..2b92e58ff 100644 --- a/src/js/services/configService.js +++ b/src/js/services/configService.js @@ -54,8 +54,8 @@ angular.module('copayApp.services').factory('configService', function(storageSer }, lock: { - method: '', - value: '', + method: null, + value: null, bannedUntil: null, attempts: null, }, diff --git a/www/views/lock.html b/www/views/lockSetup.html similarity index 88% rename from www/views/lock.html rename to www/views/lockSetup.html index 821cb7310..1bab91b8b 100644 --- a/www/views/lock.html +++ b/www/views/lockSetup.html @@ -1,6 +1,6 @@ - {{'Lock App' | translate}} + {{'Startup Lock' | translate}} diff --git a/www/views/tab-settings.html b/www/views/tab-settings.html index e0bbe0e0e..cfc054614 100644 --- a/www/views/tab-settings.html +++ b/www/views/tab-settings.html @@ -89,7 +89,7 @@ - + {{'Lock App' | translate}} From 9f41a8b79a62a0d41481a39a617478f60adcdeef Mon Sep 17 00:00:00 2001 From: Matias Alejo Garcia Date: Tue, 18 Apr 2017 16:42:17 -0300 Subject: [PATCH 79/83] logs --- src/js/routes.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/js/routes.js b/src/js/routes.js index da09f3a7b..5b03f365f 100644 --- a/src/js/routes.js +++ b/src/js/routes.js @@ -1209,10 +1209,12 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr function checkAndApplyLock(onResume) { var defaultView = 'tabs.home'; +console.log('[routes.js.1211]'); //TODO if (!platformInfo.isCordova && !platformInfo.isDevel) { goTo(defaultView); } +console.log('[routes.js.1216]'); //TODO function goTo(nextView) { nextView = nextView || defaultView; $state.transitionTo(nextView).then(function() { @@ -1287,6 +1289,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr historyRoot: true }); +console.log('[routes.js.1289]'); //TODO checkAndApplyLock(); }); }; From 43f04d429625257745c352b4d79b69ba09088b0b Mon Sep 17 00:00:00 2001 From: Matias Alejo Garcia Date: Tue, 18 Apr 2017 17:19:11 -0300 Subject: [PATCH 80/83] fix starting --- src/js/controllers/pin.js | 7 ++++++- src/js/routes.js | 3 --- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/js/controllers/pin.js b/src/js/controllers/pin.js index 9abadb441..3156320fd 100644 --- a/src/js/controllers/pin.js +++ b/src/js/controllers/pin.js @@ -175,7 +175,12 @@ angular.module('copayApp.controllers').controller('pinController', function($sta $scope.close = function(delay) { $timeout(function() { - $ionicHistory.viewHistory().backView ? $ionicHistory.goBack() : $state.go('tabs.home'); + var shouldReturn = $ionicHistory.viewHistory().backView && $ionicHistory.viewHistory().backView.stateName != 'starting'; + + if (shouldReturn) + $ionicHistory.goBack() + else + $state.go('tabs.home'); }, delay || 1); }; }); diff --git a/src/js/routes.js b/src/js/routes.js index 5b03f365f..da09f3a7b 100644 --- a/src/js/routes.js +++ b/src/js/routes.js @@ -1209,12 +1209,10 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr function checkAndApplyLock(onResume) { var defaultView = 'tabs.home'; -console.log('[routes.js.1211]'); //TODO if (!platformInfo.isCordova && !platformInfo.isDevel) { goTo(defaultView); } -console.log('[routes.js.1216]'); //TODO function goTo(nextView) { nextView = nextView || defaultView; $state.transitionTo(nextView).then(function() { @@ -1289,7 +1287,6 @@ console.log('[routes.js.1216]'); //TODO historyRoot: true }); -console.log('[routes.js.1289]'); //TODO checkAndApplyLock(); }); }; From fdae97ce63a776ac60a8095275f1d5c73e4f0645 Mon Sep 17 00:00:00 2001 From: JDonadio Date: Tue, 18 Apr 2017 17:25:01 -0300 Subject: [PATCH 81/83] check for unlock time --- src/js/routes.js | 10 +++++++++- src/js/services/openURL.js | 8 +++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/js/routes.js b/src/js/routes.js index da09f3a7b..ce7f5485d 100644 --- a/src/js/routes.js +++ b/src/js/routes.js @@ -1213,6 +1213,14 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr goTo(defaultView); } + if (onResume) { + var now = Math.floor(Date.now() / 1000); + if (now < openURLService.unlockUntil) { + $log.debug('Skip startup locking'); + return; + } + } + function goTo(nextView) { nextView = nextView || defaultView; $state.transitionTo(nextView).then(function() { @@ -1293,7 +1301,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr // After everything have been loaded, initialize handler URL $timeout(function() { openURLService.init(); - }, 1000); + }); }); }); diff --git a/src/js/services/openURL.js b/src/js/services/openURL.js index 7c1af7417..8e6a768cf 100644 --- a/src/js/services/openURL.js +++ b/src/js/services/openURL.js @@ -1,9 +1,15 @@ 'use strict'; angular.module('copayApp.services').factory('openURLService', function($rootScope, $ionicHistory, $document, $log, $state, platformInfo, lodash, profileService, incomingData, appConfigService) { + var DELAY_UNLOCK_TIME = 2 * 60; var root = {}; + root.unlockUntil = null; + var handleOpenURL = function(args) { + root.unlockUntil = Math.floor(Date.now() / 1000) + DELAY_UNLOCK_TIME; + $log.debug('Set unlock time until: ' + root.unlockUntil); + $log.info('Handling Open URL: ' + JSON.stringify(args)); // Stop it from caching the first view as one to return when the app opens $ionicHistory.nextViewOptions({ @@ -103,5 +109,5 @@ angular.module('copayApp.services').factory('openURLService', function($rootScop }); }; -return root; + return root; }); From 6c380c5187f2b62b2e033b1956dfc6bcd330a4e1 Mon Sep 17 00:00:00 2001 From: Gustavo Maximiliano Cortez Date: Wed, 19 Apr 2017 14:53:36 -0300 Subject: [PATCH 82/83] Fix unlockUntil --- src/js/routes.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/js/routes.js b/src/js/routes.js index 1a3b795ee..9e6a82016 100644 --- a/src/js/routes.js +++ b/src/js/routes.js @@ -1206,6 +1206,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr if (onResume) { var now = Math.floor(Date.now() / 1000); if (now < openURLService.unlockUntil) { + openURLService.unlockUntil = null; $log.debug('Skip startup locking'); return; } From 8e4b7e4964f8b15494f407c8ed4ae8148f9b724f Mon Sep 17 00:00:00 2001 From: Gustavo Maximiliano Cortez Date: Wed, 19 Apr 2017 15:39:34 -0300 Subject: [PATCH 83/83] New release v3.1.1 --- app-template/bitpay/appConfig.json | 4 ++-- app-template/copay/appConfig.json | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app-template/bitpay/appConfig.json b/app-template/bitpay/appConfig.json index a55b1f391..7b1aa089b 100644 --- a/app-template/bitpay/appConfig.json +++ b/app-template/bitpay/appConfig.json @@ -22,8 +22,8 @@ "windowsAppId": "2d1002d7-ee34-4f60-bd29-0c871ba0c195", "pushSenderId": "1036948132229", "description": "Secure Bitcoin Wallet", - "version": "3.1.0", - "androidVersion": "310000", + "version": "3.1.1", + "androidVersion": "311000", "_extraCSS": null, "_enabledExtensions": { "coinbase": true, diff --git a/app-template/copay/appConfig.json b/app-template/copay/appConfig.json index 70ddb011d..8c7de8828 100644 --- a/app-template/copay/appConfig.json +++ b/app-template/copay/appConfig.json @@ -22,8 +22,8 @@ "windowsAppId": "804636ee-b017-4cad-8719-e58ac97ffa5c", "pushSenderId": "1036948132229", "description": "A Secure Bitcoin Wallet", - "version": "3.1.0", - "androidVersion": "310000", + "version": "3.1.1", + "androidVersion": "311000", "_extraCSS": null, "_enabledExtensions": { "coinbase": true,