Merge commit '9a3e0fdb06' into wallet/task/324

This commit is contained in:
Brendon Duncan 2018-05-21 09:22:56 -07:00
commit 7cc73405c4
12 changed files with 103 additions and 41 deletions

View file

@ -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'
}
}

View file

@ -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();

View file

@ -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');
}
}
});

View file

@ -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);
};
});

View file

@ -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');
}
}
});

View file

@ -277,8 +277,6 @@ angular.module('copayApp.controllers').controller('tabHomeController',
var txIdList = [];
var notificationsBeforeCheck = notifications.length;
for (var i=0; i<notifications.length; i++) {
var txId = notifications[i].txid;
if (txIdList.includes(txId)) {
@ -289,15 +287,7 @@ angular.module('copayApp.controllers').controller('tabHomeController',
}
}
var notificationsAfterCheck = notifications.length;
var removedNotifications = notificationsBeforeCheck - notificationsAfterCheck;
if (notificationsBeforeCheck != notificationsAfterCheck) {
total = total - removedNotifications;
}
$scope.notifications = notifications;
$scope.notificationsN = total;
$timeout(function() {
$ionicScrollDelegate.resize();
$scope.$apply();

View file

@ -410,8 +410,7 @@ angular.module('copayApp.controllers').controller('walletDetailsController', fun
$scope.$on("$ionicView.afterLeave", function(event, data) {
$interval.cancel(refreshInterval);
if ($window.StatusBar) {
var statusBarColor = appConfigService.name == 'copay' ? '#192c3a' : '#1e3186';
$window.StatusBar.backgroundColorByHexString(statusBarColor);
$window.StatusBar.backgroundColorByHexString('#000000');
}
});

View file

@ -1251,6 +1251,10 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
if (screen.width < 768 && platformInfo.isCordova)
screen.lockOrientation('portrait');
if (ionic.Platform.isAndroid() && StatusBar) {
StatusBar.backgroundColorByHexString('#000000');
}
if (window.cordova && window.cordova.plugins && window.cordova.plugins.Keyboard && !platformInfo.isWP) {
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(false);
cordova.plugins.Keyboard.disableScroll(true);

View file

@ -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;

View file

@ -18,11 +18,11 @@
<div class="send-amount-tool-input amount">
<div class="primary-amount"
ng-class="{long: amountModel.amount.length > 5, 'very-long': amountModel.amount.length > 10}">
<span class="primary-amount-display">{{ amountModel.amount || 0 }}</span><span class="unit">{{unit}}</span>
<span class="primary-amount-display text-selectable">{{ amountModel.amount || 0 }}</span><span class="unit">{{unit}}</span>
</div>
<span ng-show="globalResult">{{globalResult}} {{unit}}</span>
<div class="alternative-amount">
<span>{{alternativeAmount || '0.00'}} {{alternativeUnit}}</span>
<span class="text-selectable">{{alternativeAmount || '0.00'}}</span> <span>{{alternativeUnit}}</span>
</div>
<div class="switch-currencies" ng-click="changeUnit()"><img src="img/icon-convert.svg"></div>
</div>

View file

@ -4,7 +4,7 @@
Close
</button>
<div class="title" translate>
Search Transactions
Search Transactions ({{wallet.coin}})
</div>
</ion-header-bar>
@ -18,6 +18,18 @@
</div>
<div class="list">
<div class="wallet-details__list" ng-show="filteredTxHistory.length === 0 && search != ''">
<div class="text-gray text-center p10t">
{{'No results found'|translate}}
</div>
<div class="p10t text-center">
<button class="button button-small button-primary" ng-click="searchOnBlockchain(search)" translate>
<span ng-if="searchTermIsTxId">{{'Show Transaction on Blockchain'|translate}}</span>
<span ng-if="searchTermIsAddress">{{'Show Address on Blockchain'|translate}}</span>
<span ng-if="!searchTermIsAddress && !searchTermIsTxId">{{'Search on Blockchain'|translate}}</span>
</button>
</div>
</div>
<div class="wallet-details__list" ng-show="txHistory[0]">
<div ng-repeat="btx in txHistorySearchResults track by $index" ng-click="openTx(btx)">
<span ng-include="'views/includes/walletHistory.html'"></span>

View file

@ -49,7 +49,6 @@
<a class="item item-icon-right item-heading" ui-sref="tabs.activity">
<span translate>Recent Transactions</span>
<i class="icon bp-arrow-right"></i>
<span class="badge badge-assertive m5t m10r" ng-show="notificationsN>3"> {{notificationsN}}</span>
</a>
<a class="item item-sub activity" ng-repeat="notification in notifications" ng-click="openNotificationModal(notification)">
<span ng-include="'views/includes/walletActivity.html'"></span>