From 8324b18b81da311b04faae4cbd2793715ad63388 Mon Sep 17 00:00:00 2001 From: Sebastiaan Pasma Date: Mon, 14 May 2018 13:12:41 +0200 Subject: [PATCH 1/9] Improvement - 205 - Desktop clients should open websites in a browser, not an app webview. (OSX/Win/Linux) --- src/js/controllers/communityController.js | 6 +++++- src/js/controllers/nextStepsController.js | 8 ++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/js/controllers/communityController.js b/src/js/controllers/communityController.js index 537270b8f..d9f952666 100644 --- a/src/js/controllers/communityController.js +++ b/src/js/controllers/communityController.js @@ -29,7 +29,11 @@ angular.module('copayApp.controllers').controller('communityController', functio } $scope.open = function(url) { - window.open(url, '_system'); + if (platformInfo.isNW) { + require('nw.gui').Shell.openExternal( url ); + } else { + window.open(url, '_system'); + } } }); diff --git a/src/js/controllers/nextStepsController.js b/src/js/controllers/nextStepsController.js index 48ce15a5f..ad2cbaf20 100644 --- a/src/js/controllers/nextStepsController.js +++ b/src/js/controllers/nextStepsController.js @@ -1,6 +1,6 @@ 'use strict'; -angular.module('copayApp.controllers').controller('nextStepsController', function($scope, nextStepsService, $ionicScrollDelegate, $timeout, configService) { +angular.module('copayApp.controllers').controller('nextStepsController', function($scope, nextStepsService, $ionicScrollDelegate, $timeout, platformInfo, configService) { $scope.hide = false; @@ -22,6 +22,10 @@ angular.module('copayApp.controllers').controller('nextStepsController', functio }; $scope.open = function(url) { - window.open(url, '_system'); + if (platformInfo.isNW) { + require('nw.gui').Shell.openExternal( url ); + } else { + window.open(url, '_system'); + } } }); From 814e818380ccb33ef8bfe15c2f893389941a3ba6 Mon Sep 17 00:00:00 2001 From: Sebastiaan Pasma Date: Mon, 14 May 2018 16:01:09 +0200 Subject: [PATCH 2/9] Improvement - 320 - Remove red notification bubble from "Recent Transactions" module --- src/js/controllers/tab-home.js | 10 ---------- www/views/tab-home.html | 1 - 2 files changed, 11 deletions(-) diff --git a/src/js/controllers/tab-home.js b/src/js/controllers/tab-home.js index 28736972f..84fc40b06 100644 --- a/src/js/controllers/tab-home.js +++ b/src/js/controllers/tab-home.js @@ -281,8 +281,6 @@ angular.module('copayApp.controllers').controller('tabHomeController', var txIdList = []; - var notificationsBeforeCheck = notifications.length; - for (var i=0; i Recent Transactions - {{notificationsN}} From 6caa7c74b5e1b69be02aca2835ebcbe760fb0e4b Mon Sep 17 00:00:00 2001 From: Brendon Duncan Date: Tue, 15 May 2018 17:07:50 +1200 Subject: [PATCH 3/9] Improvement - 324 - Remove "Bitcoin Core Wallet" toggle entirely. --- src/js/controllers/advancedSettings.js | 15 ------------ src/js/controllers/tab-home.js | 11 +-------- src/js/controllers/tab-send.js | 1 - src/js/directives/walletSelector.js | 17 +------------ src/js/services/configService.js | 4 ---- src/js/services/profileService.js | 33 -------------------------- src/js/services/storageService.js | 9 +------ www/views/advancedSettings.html | 9 ------- www/views/includes/walletSelector.html | 3 +-- www/views/tab-home.html | 8 ++----- www/views/tab-send.html | 3 +-- 11 files changed, 7 insertions(+), 106 deletions(-) diff --git a/src/js/controllers/advancedSettings.js b/src/js/controllers/advancedSettings.js index 9355dd730..42fa10855 100644 --- a/src/js/controllers/advancedSettings.js +++ b/src/js/controllers/advancedSettings.js @@ -13,10 +13,6 @@ angular.module('copayApp.controllers').controller('advancedSettingsController', $scope.hideNextSteps = { value: config.hideNextSteps.enabled }; - $scope.displayBitcoinCoreEnabled = { - value: config.displayBitcoinCore.enabled - }; - }; $scope.spendUnconfirmedChange = function() { @@ -52,17 +48,6 @@ angular.module('copayApp.controllers').controller('advancedSettingsController', }); }; - $scope.displayBitcoinCoreChange = function() { - var opts = { - displayBitcoinCore: { - enabled: $scope.displayBitcoinCoreEnabled.value - } - }; - configService.set(opts, function(err) { - if (err) $log.debug(err); - }); - }; - $scope.$on("$ionicView.beforeEnter", function(event, data) { $scope.isWindowsPhoneApp = platformInfo.isCordova && platformInfo.isWP; updateConfig(); diff --git a/src/js/controllers/tab-home.js b/src/js/controllers/tab-home.js index 28736972f..dee94f4b1 100644 --- a/src/js/controllers/tab-home.js +++ b/src/js/controllers/tab-home.js @@ -83,9 +83,7 @@ angular.module('copayApp.controllers').controller('tabHomeController', $scope.$on("$ionicView.enter", function(event, data) { $ionicNavBarDelegate.showBar(true); - updateAllWallets(function() { - profileService.initBitcoinCoreDisplay(); - }); + updateAllWallets(); addressbookService.list(function(err, ab) { if (err) $log.error(err); @@ -126,8 +124,6 @@ angular.module('copayApp.controllers').controller('tabHomeController', $scope.nextStepsItems = nextStepsService.get(); } - $scope.displayBitcoinCore = config.displayBitcoinCore.enabled; - $scope.showServices = true; pushNotificationsService.init(); firebaseEventsService.init(); @@ -326,9 +322,4 @@ angular.module('copayApp.controllers').controller('tabHomeController', updateAllWallets(); }; - $rootScope.$on('Local/SettingsUpdated', function(e, walletId) { - configService.whenAvailable(function(config) { - $scope.displayBitcoinCore = config.displayBitcoinCore.enabled; - }); - }); }); diff --git a/src/js/controllers/tab-send.js b/src/js/controllers/tab-send.js index 377cb9a49..65077995f 100644 --- a/src/js/controllers/tab-send.js +++ b/src/js/controllers/tab-send.js @@ -81,7 +81,6 @@ angular.module('copayApp.controllers').controller('tabSendController', function( coin: v.coin, network: v.network, balanceString: v.cachedBalance, - displayWallet: v.coin == 'btc' ? config.displayBitcoinCore.enabled : true, getAddress: function(cb) { walletService.getAddress(v, false, cb); }, diff --git a/src/js/directives/walletSelector.js b/src/js/directives/walletSelector.js index 578d298ce..256a2c20d 100644 --- a/src/js/directives/walletSelector.js +++ b/src/js/directives/walletSelector.js @@ -11,11 +11,9 @@ angular.module('copayApp.directives') show: '=walletSelectorShow', wallets: '=walletSelectorWallets', selectedWallet: '=walletSelectorSelectedWallet', - onSelect: '=walletSelectorOnSelect', - alwaysDisplayBitcoinCore: '=walletSelectorAlwaysDisplayBitcoinCore' + onSelect: '=walletSelectorOnSelect' }, link: function(scope, element, attrs) { - scope.displayWallet = true; scope.hide = function() { scope.show = false; }; @@ -28,19 +26,6 @@ angular.module('copayApp.directives') scope.$watch('wallets', function(newValue, oldValue) { scope.wallets = newValue; }); - scope.initDisplayBitcoinCoreConfig = function() { - configService.whenAvailable(function(config) { - scope.displayBitcoinCore = config.displayBitcoinCore.enabled; - scope.initWalletDisplay(); - }); - }; - scope.initWalletDisplay = function() { - scope.displayWallet = scope.alwaysDisplayBitcoinCore ? true : scope.displayBitcoinCore; - }; - scope.initDisplayBitcoinCoreConfig(); - $rootScope.$on('Local/SettingsUpdated', function(e, walletId) { - scope.initDisplayBitcoinCoreConfig(); - }); } }; }); diff --git a/src/js/services/configService.js b/src/js/services/configService.js index fcf496775..1e46da03a 100644 --- a/src/js/services/configService.js +++ b/src/js/services/configService.js @@ -85,10 +85,6 @@ angular.module('copayApp.services').factory('configService', function(storageSer enabled: true, }, - displayBitcoinCore: { - enabled: false, - }, - hideNextSteps: { enabled: isWindowsPhoneApp ? true : false, }, diff --git a/src/js/services/profileService.js b/src/js/services/profileService.js index 09ba746f4..068c3b2ae 100644 --- a/src/js/services/profileService.js +++ b/src/js/services/profileService.js @@ -1037,39 +1037,6 @@ angular.module('copayApp.services') return cb(null, txps, n); }; - // Displays Bitcoin Core Wallets if BTC balance is more than 0 - root.initBitcoinCoreDisplay = function() { - storageService.checkIfFlagIsSet('displayBitcoinCoreFlag') - .then(function(result) { - // Perform checks for flags which are even set to true once more, set the new flag value to 1 - if (result === false || result === true) { - root.checkBtcBalanceAndInitDisplay(1); - } - }); - }; - - root.checkBtcBalanceAndInitDisplay = function(flagValue) { - var walletsBtc = root.getWallets({coin: 'btc'}); - if (walletsBtc.length > 0) { - // Do not trust cachedBalance as it is added asynchronously. Using a new promise-based function. - root.getWalletsBalance(walletsBtc) - .then(function(totalBalance) { - var enableDisplayBitcoinCore = totalBalance > 0 ? true : false; - - var opts = { - displayBitcoinCore: { - enabled: enableDisplayBitcoinCore - } - }; - configService.set(opts, function(err) { - if (err) $log.debug(err); - }); - - storageService.activateDisplayBitcoinCoreFlag(flagValue); - }); - } - } - // Calculate wallets total balance (Promise). Attempts to fix asynchronous issue with cachedBalance not being available when it's needed root.getWalletsBalance = function(wallets) { return new Promise(function(resolve, reject) { diff --git a/src/js/services/storageService.js b/src/js/services/storageService.js index c2f8077be..3d1ecfeef 100644 --- a/src/js/services/storageService.js +++ b/src/js/services/storageService.js @@ -645,13 +645,6 @@ angular.module('copayApp.services') }); }); } - - root.activateDisplayBitcoinCoreFlag = function(value) { - var flag = { - initialized: value - }; - storage.set('displayBitcoinCoreFlag', flag, function() { }); - } - + return root; }); diff --git a/www/views/advancedSettings.html b/www/views/advancedSettings.html index 2b46e5375..253c35c8f 100644 --- a/www/views/advancedSettings.html +++ b/www/views/advancedSettings.html @@ -29,15 +29,6 @@ Hide Next Steps Card - -
- - - Bitcoin Core Wallet - -
- If enabled, Bitcoin Core (BTC) wallet(s) will be displayed on the Home screen. If disabled, BTC wallets will be not be deleted, only hidden. -
diff --git a/www/views/includes/walletSelector.html b/www/views/includes/walletSelector.html index bcb7b3f90..a53d1c7f1 100644 --- a/www/views/includes/walletSelector.html +++ b/www/views/includes/walletSelector.html @@ -37,14 +37,13 @@
-
- Your Bitcoin Cash (BCH) Wallet is ready! -
-
- A Bitcoin Core (BTC) wallet can be displayed from Settings Advanced + Your Bitcoin Wallets are ready!
@@ -73,8 +70,7 @@ -
+
Bitcoin Core (BTC) diff --git a/www/views/tab-send.html b/www/views/tab-send.html index 2f33a863e..838c04299 100644 --- a/www/views/tab-send.html +++ b/www/views/tab-send.html @@ -75,8 +75,7 @@ + ng-click="goToAmount(item)"> {{item.name}}

From b65da992c7c289ae3f4f02b2a9c1bcbaf4ea56eb Mon Sep 17 00:00:00 2001 From: Sebastiaan Pasma Date: Tue, 15 May 2018 09:58:05 +0200 Subject: [PATCH 4/9] Improvement - 321 - "Search transactions" doesn't work with BCH prefix --- src/js/controllers/modals/search.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/js/controllers/modals/search.js b/src/js/controllers/modals/search.js index 3d5ae366e..375e69aec 100644 --- a/src/js/controllers/modals/search.js +++ b/src/js/controllers/modals/search.js @@ -29,6 +29,7 @@ angular.module('copayApp.controllers').controller('searchController', function($ var message = tx.message ? tx.message : ''; var comment = tx.note ? tx.note.body : ''; var addressTo = tx.addressTo ? tx.addressTo : ''; + if (tx.amountUnitStr === 'BCH' && addressTo) addressTo = 'bitcoincash:'+addressTo; var txid = tx.txid ? tx.txid : ''; return ((tx.amountStr + message + addressTo + addrbook + searchableDate + comment + txid).toString()).toLowerCase(); } From 31f50ad0cb594c3239c78d2c12b6fb0ff174c073 Mon Sep 17 00:00:00 2001 From: Sebastiaan Pasma Date: Wed, 16 May 2018 13:50:25 +0200 Subject: [PATCH 5/9] Fixes for CashAddr, includes validation of address, adds cashaddr to search string next to legacy address --- src/js/controllers/modals/search.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/js/controllers/modals/search.js b/src/js/controllers/modals/search.js index 375e69aec..58ef3fa24 100644 --- a/src/js/controllers/modals/search.js +++ b/src/js/controllers/modals/search.js @@ -1,6 +1,6 @@ 'use strict'; -angular.module('copayApp.controllers').controller('searchController', function($scope, $interval, $timeout, $filter, $log, $ionicModal, $ionicPopover, $state, $stateParams, $ionicScrollDelegate, bwcError, profileService, lodash, configService, gettext, gettextCatalog, platformInfo, walletService) { +angular.module('copayApp.controllers').controller('searchController', function($scope, $interval, $timeout, $filter, $log, $ionicModal, $ionicPopover, $state, $stateParams, $ionicScrollDelegate, bwcError, profileService, lodash, configService, gettext, gettextCatalog, platformInfo, walletService, bitcoinCashJsService) { var HISTORY_SHOW_LIMIT = 10; var currentTxHistoryPage = 0; @@ -29,7 +29,16 @@ angular.module('copayApp.controllers').controller('searchController', function($ var message = tx.message ? tx.message : ''; var comment = tx.note ? tx.note.body : ''; var addressTo = tx.addressTo ? tx.addressTo : ''; - if (tx.amountUnitStr === 'BCH' && addressTo) addressTo = 'bitcoincash:'+addressTo; + + if ($scope.wallet.coin === 'bch' && addressTo) { + try { + var addr = bitcoinCashJsService.readAddress(addressTo); + if (addr !== null) addressTo = addressTo + ' bitcoincash:'+addr.cashaddr; + } catch (e) { + $log.debug(addressTo+' not a valid address.. continuing..'); + } + } + var txid = tx.txid ? tx.txid : ''; return ((tx.amountStr + message + addressTo + addrbook + searchableDate + comment + txid).toString()).toLowerCase(); } From aa8668b82e4cc79a0373d663d1c7ed77a98fc612 Mon Sep 17 00:00:00 2001 From: Sebastiaan Pasma Date: Wed, 16 May 2018 15:24:25 +0200 Subject: [PATCH 6/9] Improvement - 338 - Allow users to copy the amounts in the Send-screen --- src/sass/views/amount.scss | 7 +++++++ www/views/amount.html | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/sass/views/amount.scss b/src/sass/views/amount.scss index 26169f206..3000ea696 100644 --- a/src/sass/views/amount.scss +++ b/src/sass/views/amount.scss @@ -252,6 +252,13 @@ position: relative; padding: 10px 30px; + .text-selectable { + -webkit-user-select: text; + -moz-user-select: text; + -ms-user-select: text; + user-select: text; + } + .primary-amount { input, .unit, .primary-amount-display { font-size: 1.8em; diff --git a/www/views/amount.html b/www/views/amount.html index 3d581f886..af4e9d55c 100644 --- a/www/views/amount.html +++ b/www/views/amount.html @@ -18,11 +18,11 @@

- {{ amountModel.amount || 0 }}{{unit}} + {{ amountModel.amount || 0 }}{{unit}}
{{globalResult}} {{unit}}
- {{alternativeAmount || '0.00'}} {{alternativeUnit}} + {{alternativeAmount || '0.00'}} {{alternativeUnit}}
From cdb9b54b5884057e194636bf1150ccedb4e527f3 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Dominguez Date: Thu, 17 May 2018 19:30:06 +0900 Subject: [PATCH 7/9] Fix - 321 - Add the three addresses (legacy+bitpay+bch) in the searchable string --- src/js/controllers/modals/search.js | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/src/js/controllers/modals/search.js b/src/js/controllers/modals/search.js index 58ef3fa24..2187b4353 100644 --- a/src/js/controllers/modals/search.js +++ b/src/js/controllers/modals/search.js @@ -30,13 +30,25 @@ angular.module('copayApp.controllers').controller('searchController', function($ var comment = tx.note ? tx.note.body : ''; var addressTo = tx.addressTo ? tx.addressTo : ''; - if ($scope.wallet.coin === 'bch' && addressTo) { - try { - var addr = bitcoinCashJsService.readAddress(addressTo); - if (addr !== null) addressTo = addressTo + ' bitcoincash:'+addr.cashaddr; - } catch (e) { - $log.debug(addressTo+' not a valid address.. continuing..'); - } + if ($scope.wallet.coin === 'bch') { + + /** + * One tx in JSON + * {"txid":"97ed105ea5042a328b68da43439b4..","action":"received","amount":730216,"fees":392,"time":1525661853,"confirmations":1459,"feePerKb":1074,"outputs":[{"amount":730216,"address":"19zA4aP1sAavtHF2wJcMpi..","message":null}],"message":null,"creatorName":"","hasUnconfirmedInputs":false,"amountStr":"0.00730216 BCH","alternativeAmountStr":"7.95 EUR","feeStr":"0.00000392 BCH","amountValueStr":"0.00730216","amountUnitStr":"BCH","safeConfirmed":"6+","lowAmount":false} + * These two lines should be removed.. because tx.addressTo does not exist. + * The address is in tx.outputs[..].address, cf. the JSON + */ + var addr = bitcoinCashJsService.translateAddresses(addressTo); + addressTo = addr.legacy + addr.bitpay + 'bitcoincash:' + addr.cashaddr + + /** + * For each address (normally only one) + * I translate the legacy address and add in the searchable string the 3 kind of addresses + */ + lodash.each(tx.outputs, function(output) { + var addr = bitcoinCashJsService.translateAddresses(output.address); + addressTo += addr.legacy + addr.bitpay + 'bitcoincash:' + addr.cashaddr + }); } var txid = tx.txid ? tx.txid : ''; From f7e090cd20cedec77b76de020960fb08b206478e Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Dominguez Date: Thu, 17 May 2018 19:37:18 +0900 Subject: [PATCH 8/9] Fix - 321 - Forgot a condition to check the translation --- src/js/controllers/modals/search.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/js/controllers/modals/search.js b/src/js/controllers/modals/search.js index 2187b4353..b6b0c3163 100644 --- a/src/js/controllers/modals/search.js +++ b/src/js/controllers/modals/search.js @@ -38,8 +38,10 @@ angular.module('copayApp.controllers').controller('searchController', function($ * These two lines should be removed.. because tx.addressTo does not exist. * The address is in tx.outputs[..].address, cf. the JSON */ - var addr = bitcoinCashJsService.translateAddresses(addressTo); - addressTo = addr.legacy + addr.bitpay + 'bitcoincash:' + addr.cashaddr + if (addressTo) { + var addr = bitcoinCashJsService.translateAddresses(addressTo); + addressTo = addr.legacy + addr.bitpay + 'bitcoincash:' + addr.cashaddr + } /** * For each address (normally only one) From 01b1c6753fc17b2412bc110a8a29150ff2cc21a6 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Dominguez Date: Thu, 17 May 2018 20:16:41 +0900 Subject: [PATCH 9/9] Fix - 321 - Keep only the fetching in the outputs --- src/js/controllers/modals/search.js | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/src/js/controllers/modals/search.js b/src/js/controllers/modals/search.js index b6b0c3163..cd5399a02 100644 --- a/src/js/controllers/modals/search.js +++ b/src/js/controllers/modals/search.js @@ -33,18 +33,7 @@ angular.module('copayApp.controllers').controller('searchController', function($ if ($scope.wallet.coin === 'bch') { /** - * One tx in JSON - * {"txid":"97ed105ea5042a328b68da43439b4..","action":"received","amount":730216,"fees":392,"time":1525661853,"confirmations":1459,"feePerKb":1074,"outputs":[{"amount":730216,"address":"19zA4aP1sAavtHF2wJcMpi..","message":null}],"message":null,"creatorName":"","hasUnconfirmedInputs":false,"amountStr":"0.00730216 BCH","alternativeAmountStr":"7.95 EUR","feeStr":"0.00000392 BCH","amountValueStr":"0.00730216","amountUnitStr":"BCH","safeConfirmed":"6+","lowAmount":false} - * These two lines should be removed.. because tx.addressTo does not exist. - * The address is in tx.outputs[..].address, cf. the JSON - */ - if (addressTo) { - var addr = bitcoinCashJsService.translateAddresses(addressTo); - addressTo = addr.legacy + addr.bitpay + 'bitcoincash:' + addr.cashaddr - } - - /** - * For each address (normally only one) + * For each address * I translate the legacy address and add in the searchable string the 3 kind of addresses */ lodash.each(tx.outputs, function(output) {