From 50287bba2fd66468ce92620fe55cca6014fd1db1 Mon Sep 17 00:00:00 2001 From: Javier Date: Tue, 11 Oct 2016 16:46:06 -0300 Subject: [PATCH 01/11] fix edit memo --- src/js/controllers/modals/txDetails.js | 29 +++++++++++++------------- src/js/services/walletService.js | 6 ++++++ www/views/walletDetails.html | 2 +- 3 files changed, 22 insertions(+), 15 deletions(-) diff --git a/src/js/controllers/modals/txDetails.js b/src/js/controllers/modals/txDetails.js index a77a95b26..3186a7f4b 100644 --- a/src/js/controllers/modals/txDetails.js +++ b/src/js/controllers/modals/txDetails.js @@ -27,16 +27,23 @@ angular.module('copayApp.controllers').controller('txDetailsController', functio }; function updateMemo() { - wallet.getTxNote({ - txid: $scope.btx.txid - }, function(err, note) { + walletService.getTxNote(wallet, $scope.btx.txid, function(err, note) { if (err || !note) { $log.debug(gettextCatalog.getString('Could not fetch transaction note')); return; } - $scope.note = note; - $timeout(function() { - $scope.$apply(); + $scope.btx.note = note; + + walletService.getTx(wallet, $scope.btx.txid, function(err, tx) { + if (err) { + $log.error(err); + return; + } + + tx.note = note; + $timeout(function() { + $scope.$apply(); + }); }); }); }; @@ -91,19 +98,13 @@ angular.module('copayApp.controllers').controller('txDetailsController', functio body: text }; - wallet.editTxNote(args, function(err) { + walletService.editTxNote(wallet, args, function(err, res) { if (err) { $log.debug('Could not save tx comment'); return; } // This is only to refresh the current screen data - $scope.btx.note = null; - if (args.body) { - $scope.btx.note = {}; - $scope.btx.note.body = text; - $scope.btx.note.editedByName = wallet.credentials.copayerName; - $scope.btx.note.editedOn = Math.floor(Date.now() / 1000); - } + updateMemo(); $scope.btx.searcheableString = null; $timeout(function() { $scope.$apply(); diff --git a/src/js/services/walletService.js b/src/js/services/walletService.js index 84bfea06a..173ed6bec 100644 --- a/src/js/services/walletService.js +++ b/src/js/services/walletService.js @@ -512,6 +512,12 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim }); }; + root.editTxNote = function(wallet, args, cb) { + wallet.editTxNote(args, function(err, res) { + return cb(err, res); + }); + }; + root.getTxp = function(wallet, txpid, cb) { wallet.getTx(txpid, function(err, txp) { if (err) return cb(err); diff --git a/www/views/walletDetails.html b/www/views/walletDetails.html index 135287375..595f4b250 100644 --- a/www/views/walletDetails.html +++ b/www/views/walletDetails.html @@ -124,7 +124,7 @@
-
+
+ From 8d9b937806fa85f954206b2a333a25a014bf907d Mon Sep 17 00:00:00 2001 From: Javier Date: Wed, 12 Oct 2016 10:19:27 -0300 Subject: [PATCH 02/11] improve error message --- src/js/controllers/modals/txDetails.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/js/controllers/modals/txDetails.js b/src/js/controllers/modals/txDetails.js index 3186a7f4b..adb7ddda6 100644 --- a/src/js/controllers/modals/txDetails.js +++ b/src/js/controllers/modals/txDetails.js @@ -28,10 +28,13 @@ angular.module('copayApp.controllers').controller('txDetailsController', functio function updateMemo() { walletService.getTxNote(wallet, $scope.btx.txid, function(err, note) { - if (err || !note) { - $log.debug(gettextCatalog.getString('Could not fetch transaction note')); + if (err) { + $log.warn('Could not fetch transaction note ' + err); return; } + + if (!note) return; + $scope.btx.note = note; walletService.getTx(wallet, $scope.btx.txid, function(err, tx) { @@ -100,7 +103,7 @@ angular.module('copayApp.controllers').controller('txDetailsController', functio walletService.editTxNote(wallet, args, function(err, res) { if (err) { - $log.debug('Could not save tx comment'); + $log.debug('Could not save tx comment ' + err); return; } // This is only to refresh the current screen data From 78aa0442c14a7bfa51de843524b11424cdd4e41c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Baz=C3=A1n?= Date: Wed, 12 Oct 2016 10:24:15 -0300 Subject: [PATCH 03/11] disable language auto detection --- src/js/services/uxLanguage.js | 2 ++ www/views/preferencesAbout.html | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/js/services/uxLanguage.js b/src/js/services/uxLanguage.js index 92f527f73..2f9e76043 100644 --- a/src/js/services/uxLanguage.js +++ b/src/js/services/uxLanguage.js @@ -42,6 +42,8 @@ angular.module('copayApp.services') root._detect = function(cb) { + return cb('en'); //disable auto detection for release; + var userLang, androidLang; if (navigator && navigator.globalization) { diff --git a/www/views/preferencesAbout.html b/www/views/preferencesAbout.html index 7c66822e9..d9dcbf127 100644 --- a/www/views/preferencesAbout.html +++ b/www/views/preferencesAbout.html @@ -30,11 +30,11 @@ Terms of Use - + Session log From db4a6069e9c8230b1764ae760b97a81dcca86684 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Baz=C3=A1n?= Date: Wed, 12 Oct 2016 10:53:27 -0300 Subject: [PATCH 04/11] fix confirmation popup --- src/js/controllers/confirm.js | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/src/js/controllers/confirm.js b/src/js/controllers/confirm.js index 77cd8b4c9..eb12cd094 100644 --- a/src/js/controllers/confirm.js +++ b/src/js/controllers/confirm.js @@ -308,17 +308,20 @@ angular.module('copayApp.controllers').controller('confirmController', function( var cancelText = gettextCatalog.getString('Cancel'); if (!spendingPassEnabled && !touchIdEnabled) { - if (isCordova && bigAmount) { - popupService.showConfirm(null, message, okText, cancelText, function(ok) { - if (!ok) { - $scope.sendStatus = ''; - $timeout(function() { - $scope.$apply(); - }); - return; - } - publishAndSign(wallet, txp, onSendStatusChange); - }); + if (isCordova) { + if (bigAmount) { + popupService.showConfirm(null, message, okText, cancelText, function(ok) { + if (!ok) { + $scope.sendStatus = ''; + $timeout(function() { + $scope.$apply(); + }); + return; + } + publishAndSign(wallet, txp, onSendStatusChange); + }); + } + else publishAndSign(wallet, txp, onSendStatusChange); } else { popupService.showConfirm(null, message, okText, cancelText, function(ok) { From 06cfcafd031e6033a7b1ba12322476db2299c337 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Baz=C3=A1n?= Date: Wed, 12 Oct 2016 11:04:05 -0300 Subject: [PATCH 05/11] fixes --- src/js/controllers/confirm.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/js/controllers/confirm.js b/src/js/controllers/confirm.js index eb12cd094..d8dc250c0 100644 --- a/src/js/controllers/confirm.js +++ b/src/js/controllers/confirm.js @@ -297,7 +297,7 @@ angular.module('copayApp.controllers').controller('confirmController', function( var config = configService.getSync(); var spendingPassEnabled = walletService.isEncrypted(wallet); - var touchIdEnabled = config.touchIdFor && !config.touchIdFor[wallet.id]; + var touchIdEnabled = config.touchIdFor && config.touchIdFor[wallet.id]; var isCordova = $scope.isCordova; var bigAmount = parseFloat(txFormatService.formatToUSD(txp.amount)) > 20; var message = gettextCatalog.getString('Sending {{amountStr}} from your {{name}} wallet', { From 634e151ae5bed7464082edbac3a6289081ae2b80 Mon Sep 17 00:00:00 2001 From: Javier Date: Wed, 12 Oct 2016 11:04:29 -0300 Subject: [PATCH 06/11] update bwc version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 40253d2d0..413a04a81 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ "angular": "1.4.6", "angular-mocks": "1.4.10", "bhttp": "^1.2.1", - "bitcore-wallet-client": "4.2.1", + "bitcore-wallet-client": "4.3.1", "bower": "^1.7.9", "chai": "^3.5.0", "cordova": "5.4.1", From 20b2f2d6dca454ebeee94b1f910b5f56d38e8aae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Baz=C3=A1n?= Date: Tue, 11 Oct 2016 17:10:00 -0300 Subject: [PATCH 07/11] force to use ionic prompt to hide password --- src/js/services/popupService.js | 2 +- src/js/services/walletService.js | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/js/services/popupService.js b/src/js/services/popupService.js index 9045c7b2b..6771d0e58 100644 --- a/src/js/services/popupService.js +++ b/src/js/services/popupService.js @@ -118,7 +118,7 @@ angular.module('copayApp.services').service('popupService', function($log, $ioni this.showPrompt = function(title, message, opts, cb) { $log.warn(title + ": " + message); - if (isCordova) + if (isCordova && !opts.force) _cordovaPrompt(title, message, opts, cb); else _ionicPrompt(title, message, opts, cb); diff --git a/src/js/services/walletService.js b/src/js/services/walletService.js index 0b0de6491..470d9c731 100644 --- a/src/js/services/walletService.js +++ b/src/js/services/walletService.js @@ -821,7 +821,8 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim // An alert dialog var askPassword = function(name, title, cb) { var opts = { - inputType: 'password' + inputType: 'password', + force: true }; popupService.showPrompt(title, name, opts, function(res) { if (!res) return cb(); @@ -961,7 +962,7 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim $rootScope.$emit('Local/TxAction', wallet.id); var type = root.getViewStatus(wallet, broadcastedTxp); - if(!customStatusHandler) { + if (!customStatusHandler) { root.openStatusModal(type, broadcastedTxp, function() {}); } @@ -972,7 +973,7 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim var type = root.getViewStatus(wallet, signedTxp); - if(!customStatusHandler) { + if (!customStatusHandler) { root.openStatusModal(type, signedTxp, function() {}); } From 99274519d671cdc8dd1741331c0c71a352470f59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Baz=C3=A1n?= Date: Wed, 12 Oct 2016 11:06:42 -0300 Subject: [PATCH 08/11] change option name --- src/js/services/popupService.js | 2 +- src/js/services/walletService.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/js/services/popupService.js b/src/js/services/popupService.js index 6771d0e58..486039a3b 100644 --- a/src/js/services/popupService.js +++ b/src/js/services/popupService.js @@ -118,7 +118,7 @@ angular.module('copayApp.services').service('popupService', function($log, $ioni this.showPrompt = function(title, message, opts, cb) { $log.warn(title + ": " + message); - if (isCordova && !opts.force) + if (isCordova && !opts.forceHTMLPrompt) _cordovaPrompt(title, message, opts, cb); else _ionicPrompt(title, message, opts, cb); diff --git a/src/js/services/walletService.js b/src/js/services/walletService.js index 470d9c731..27ce99500 100644 --- a/src/js/services/walletService.js +++ b/src/js/services/walletService.js @@ -822,7 +822,7 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim var askPassword = function(name, title, cb) { var opts = { inputType: 'password', - force: true + forceHTMLPrompt: true }; popupService.showPrompt(title, name, opts, function(res) { if (!res) return cb(); From 9427952fc75e94d2dfe74019a7b1578784e98eb6 Mon Sep 17 00:00:00 2001 From: Gustavo Maximiliano Cortez Date: Wed, 12 Oct 2016 11:40:14 -0300 Subject: [PATCH 09/11] Not handle external link --- src/js/services/externalLinkService.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/js/services/externalLinkService.js b/src/js/services/externalLinkService.js index aa1951fd6..fd2cc1d87 100644 --- a/src/js/services/externalLinkService.js +++ b/src/js/services/externalLinkService.js @@ -1,8 +1,19 @@ 'use strict'; -angular.module('copayApp.services').service('externalLinkService', function(platformInfo, nodeWebkitService) { +angular.module('copayApp.services').service('externalLinkService', function($window, $timeout, platformInfo, nodeWebkitService) { this.open = function(url, target) { + var old = $window.handleOpenURL; + + $window.handleOpenURL = function(url) { + // Ignore external URLs + $log.debug('Skip: ' + url); + }; + + $timeout(function() { + $window.handleOpenURL = old; + }, 500); + if (platformInfo.isNW) { nodeWebkitService.openExternalLink(url); } else { From b5208e4186c300ef43c479fbcdb28a6232bf6b8a Mon Sep 17 00:00:00 2001 From: Gustavo Maximiliano Cortez Date: Wed, 12 Oct 2016 11:49:11 -0300 Subject: [PATCH 10/11] Not handle external link --- src/js/services/externalLinkService.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/js/services/externalLinkService.js b/src/js/services/externalLinkService.js index fd2cc1d87..190206dfd 100644 --- a/src/js/services/externalLinkService.js +++ b/src/js/services/externalLinkService.js @@ -1,6 +1,6 @@ 'use strict'; -angular.module('copayApp.services').service('externalLinkService', function($window, $timeout, platformInfo, nodeWebkitService) { +angular.module('copayApp.services').service('externalLinkService', function($window, $timeout, $log, platformInfo, nodeWebkitService) { this.open = function(url, target) { var old = $window.handleOpenURL; From 2ef44c146ac4e8831ba8f6a74e3341f4487203d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Baz=C3=A1n?= Date: Wed, 12 Oct 2016 12:09:09 -0300 Subject: [PATCH 11/11] fix send tip --- src/js/controllers/tab-send.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/js/controllers/tab-send.js b/src/js/controllers/tab-send.js index 9636fa305..8c74feb78 100644 --- a/src/js/controllers/tab-send.js +++ b/src/js/controllers/tab-send.js @@ -106,7 +106,7 @@ angular.module('copayApp.controllers').controller('tabSendController', function( var updateHasFunds = function() { - $scope.hasFunds = null; + $scope.hasFunds = true; var wallets = profileService.getWallets({ onlyComplete: true, @@ -114,6 +114,9 @@ angular.module('copayApp.controllers').controller('tabSendController', function( if (!wallets || !wallets.length) { $scope.hasFunds = false; + $timeout(function() { + $scope.$apply(); + }); } var index = 0; @@ -124,13 +127,16 @@ angular.module('copayApp.controllers').controller('tabSendController', function( $log.error(err); return; } - - if (status.availableBalanceSat) { + if (status.availableBalanceSat && status.availableBalanceSat > 0) { $scope.hasFunds = true; } + else $scope.hasFunds = false; if (index == wallets.length) { $scope.hasFunds = $scope.hasFunds || false; } + $timeout(function() { + $scope.$apply(); + }) }); }); };