diff --git a/src/android/build-extras.gradle b/src/android/build-extras.gradle index ff317a4df..dcc6df0ad 100644 --- a/src/android/build-extras.gradle +++ b/src/android/build-extras.gradle @@ -1,20 +1,21 @@ configurations.all { - resolutionStrategy { - force "com.google.android.gms:play-services-auth:11.8.0" - force "com.google.android.gms:play-services-identity:11.8.0" - force "com.google.android.gms:play-services-ads:11.8.0" - force "com.google.android.gms:play-services-base:11.8.0" - force "com.google.android.gms:play-services-gcm:11.8.0" - force "com.google.android.gms:play-services-analytics:11.8.0" - force "com.google.android.gms:play-services-location:11.8.0" - force "com.google.android.gms:play-services-basement:11.8.0" - force "com.google.android.gms:play-services-tagmanager:11.8.0" - force 'com.google.firebase:firebase-core:11.8.0' - force 'com.google.firebase:firebase-crash:11.8.0' - force 'com.google.firebase:firebase-auth:11.8.0' - force 'com.google.firebase:firebase-common:11.8.0' - force 'com.google.firebase:firebase-config:11.8.0' - force 'com.google.firebase:firebase-perf:11.8.0' - force 'com.google.firebase:firebase-messaging:11.8.0' - } + resolutionStrategy { + force "com.android.support:support-v4:26.1.0" + force "com.google.android.gms:play-services-auth:11.8.0" + force "com.google.android.gms:play-services-identity:11.8.0" + force "com.google.android.gms:play-services-ads:11.8.0" + force "com.google.android.gms:play-services-base:11.8.0" + force "com.google.android.gms:play-services-gcm:11.8.0" + force "com.google.android.gms:play-services-analytics:11.8.0" + force "com.google.android.gms:play-services-location:11.8.0" + force "com.google.android.gms:play-services-basement:11.8.0" + force "com.google.android.gms:play-services-tagmanager:11.8.0" + force 'com.google.firebase:firebase-core:11.8.0' + force 'com.google.firebase:firebase-crash:11.8.0' + force 'com.google.firebase:firebase-auth:11.8.0' + force 'com.google.firebase:firebase-common:11.8.0' + force 'com.google.firebase:firebase-config:11.8.0' + force 'com.google.firebase:firebase-perf:11.8.0' + force 'com.google.firebase:firebase-messaging:11.8.0' + } } \ No newline at end of file diff --git a/src/js/controllers/amount.js b/src/js/controllers/amount.js index 2d0a5aa28..ce09a4137 100644 --- a/src/js/controllers/amount.js +++ b/src/js/controllers/amount.js @@ -307,12 +307,18 @@ angular.module('copayApp.controllers').controller('amountController', function($ } if ($scope.amountModel.amount && $scope.amountModel.amount.length >= LENGTH_EXPRESSION_LIMIT) return; - if (($scope.amountModel.amount.indexOf('.') > -1 || $scope.amountModel.amount == '') && digit == '.') return; + if ($scope.amountModel.amount.indexOf('.') > -1 && digit == '.') return; if ($scope.amountModel.amount == '0' && digit == '0') return; if (availableUnits[unitIndex].isFiat && $scope.amountModel.amount.indexOf('.') > -1 && $scope.amountModel.amount[$scope.amountModel.amount.indexOf('.') + 2]) return; - if ($scope.amountModel.amount == '0' && digit != '.') { $scope.amountModel.amount = ''} - + if ($scope.amountModel.amount == '0' && digit != '.') { + $scope.amountModel.amount = ''; + } + + if ($scope.amountModel.amount == '' && digit == '.') { + $scope.amountModel.amount = '0'; + } + $scope.amountModel.amount = ($scope.amountModel.amount + digit).replace('..', '.'); checkFontSize(); $scope.processAmount(); 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/modals/search.js b/src/js/controllers/modals/search.js index 3d5ae366e..55d51bfcc 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, externalLinkService, bitcoinCashJsService) { var HISTORY_SHOW_LIMIT = 10; var currentTxHistoryPage = 0; @@ -21,6 +21,8 @@ angular.module('copayApp.controllers').controller('searchController', function($ function filter(search) { $scope.filteredTxHistory = []; + $scope.searchTermIsAddress = false; + $scope.searchTermIsTxId = false; function computeSearchableString(tx) { var addrbook = ''; @@ -29,6 +31,19 @@ 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 ($scope.wallet.coin === 'bch') { + + /** + * 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) { + var addr = bitcoinCashJsService.translateAddresses(output.address); + addressTo += addr.legacy + addr.bitpay + 'bitcoincash:' + addr.cashaddr + }); + } + var txid = tx.txid ? tx.txid : ''; return ((tx.amountStr + message + addressTo + addrbook + searchableDate + comment + txid).toString()).toLowerCase(); } @@ -50,8 +65,19 @@ angular.module('copayApp.controllers').controller('searchController', function($ return lodash.includes(tx.searcheableString, search.toLowerCase()); }); + if (search) { + if ((search.indexOf('bitcoincash:') === 0 || search[0] === 'C' || search[0] === 'H' || search[0] === 'p' || search[0] === 'q') && search.replace('bitcoincash:', '').length === 42) { // CashAddr + $scope.searchTermIsAddress = true; + } else if ((search[0] === "1" || search[0] === "3" || search.substring(0, 3) === "bc1") && search.length >= 26 && search.length <= 35) { // Legacy Addresses + $scope.searchTermIsAddress = true; + } else if (search.length === 64) { + $scope.searchTermIsTxId = true; + } + } + if ($scope.filteredTxHistory.length > HISTORY_SHOW_LIMIT) $scope.txHistoryShowMore = true; else $scope.txHistoryShowMore = false; + return $scope.filteredTxHistory; }; @@ -77,4 +103,14 @@ angular.module('copayApp.controllers').controller('searchController', function($ $scope.txHistoryShowMore = $scope.filteredTxHistory.length > $scope.txHistorySearchResults.length; }; + $scope.searchOnBlockchain = function(searchTerm) { + const url = 'https://explorer.bitcoin.com/'+$scope.wallet.coin+'/search/' + searchTerm; + const optIn = true; + const title = null; + const message = gettextCatalog.getString('Search on Explorer.Bitcoin.com'); + const okText = gettextCatalog.getString('Open Explorer'); + const cancelText = gettextCatalog.getString('Go Back'); + externalLinkService.open(url, optIn, title, message, okText, cancelText); + }; + }); 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'); + } } }); diff --git a/src/js/controllers/tab-home.js b/src/js/controllers/tab-home.js index dee94f4b1..40e391708 100644 --- a/src/js/controllers/tab-home.js +++ b/src/js/controllers/tab-home.js @@ -277,8 +277,6 @@ angular.module('copayApp.controllers').controller('tabHomeController', var txIdList = []; - var notificationsBeforeCheck = notifications.length; - for (var i=0; i
- {{ amountModel.amount || 0 }}{{unit}} + {{ amountModel.amount || 0 }}{{unit}}
{{globalResult}} {{unit}}
- {{alternativeAmount || '0.00'}} {{alternativeUnit}} + {{alternativeAmount || '0.00'}} {{alternativeUnit}}
diff --git a/www/views/modals/search.html b/www/views/modals/search.html index ad82409de..877173e73 100644 --- a/www/views/modals/search.html +++ b/www/views/modals/search.html @@ -4,7 +4,7 @@ Close
- Search Transactions + Search Transactions ({{wallet.coin}})
@@ -18,6 +18,18 @@
+
+
+ {{'No results found'|translate}} +
+
+ +
+
diff --git a/www/views/tab-home.html b/www/views/tab-home.html index 3effee3a6..41534a340 100644 --- a/www/views/tab-home.html +++ b/www/views/tab-home.html @@ -49,7 +49,6 @@ Recent Transactions - {{notificationsN}}