be able to add contacts with a chosen currency and display it properly in the send tab
This commit is contained in:
parent
4fa86cb178
commit
f4b90ae2dd
3 changed files with 21 additions and 14 deletions
|
|
@ -1,13 +1,20 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('copayApp.controllers').controller('addressbookAddController', function($scope, $state, $stateParams, $timeout, $ionicHistory, gettextCatalog, addressbookService, popupService) {
|
angular.module('copayApp.controllers').controller('addressbookAddController', function($scope, $state, $stateParams, $timeout, $ionicHistory, gettextCatalog, addressbookService, popupService, configService) {
|
||||||
|
|
||||||
|
var config = configService.getSync();
|
||||||
|
var defaults = configService.getDefaults();
|
||||||
|
|
||||||
|
$scope.bitcoinAlias = (config.bitcoinAlias || defaults.bitcoinAlias).toUpperCase();
|
||||||
|
$scope.bitcoinCashAlias = (config.bitcoinCashAlias || defaults.bitcoinCashAlias).toUpperCase();
|
||||||
|
|
||||||
$scope.fromSendTab = $stateParams.fromSendTab;
|
$scope.fromSendTab = $stateParams.fromSendTab;
|
||||||
|
|
||||||
$scope.addressbookEntry = {
|
$scope.addressbookEntry = {
|
||||||
'address': $stateParams.addressbookEntry || '',
|
'address': $stateParams.addressbookEntry || '',
|
||||||
'name': '',
|
'name': '',
|
||||||
'email': ''
|
'email': '',
|
||||||
|
'coin': 'btc'
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.onQrCodeScannedAddressBook = function(data, addressbookForm) {
|
$scope.onQrCodeScannedAddressBook = function(data, addressbookForm) {
|
||||||
|
|
|
||||||
|
|
@ -87,15 +87,7 @@ angular.module('copayApp.controllers').controller('tabSendController', function(
|
||||||
originalList = originalList.concat(walletList);
|
originalList = originalList.concat(walletList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var getCoin = function(address) {
|
|
||||||
var cashAddress = bitcoreCash.Address.isValid(address, 'livenet');
|
|
||||||
if (cashAddress) {
|
|
||||||
return 'bch';
|
|
||||||
}
|
|
||||||
return 'btc';
|
|
||||||
};
|
|
||||||
|
|
||||||
var updateContactsList = function(cb) {
|
var updateContactsList = function(cb) {
|
||||||
var config = configService.getSync();
|
var config = configService.getSync();
|
||||||
var defaults = configService.getDefaults();
|
var defaults = configService.getDefaults();
|
||||||
|
|
@ -107,14 +99,13 @@ angular.module('copayApp.controllers').controller('tabSendController', function(
|
||||||
|
|
||||||
var completeContacts = [];
|
var completeContacts = [];
|
||||||
lodash.each(ab, function(v, k) {
|
lodash.each(ab, function(v, k) {
|
||||||
var c = getCoin(k);
|
|
||||||
completeContacts.push({
|
completeContacts.push({
|
||||||
name: lodash.isObject(v) ? v.name : v,
|
name: lodash.isObject(v) ? v.name : v,
|
||||||
address: k,
|
address: k,
|
||||||
email: lodash.isObject(v) ? v.email : null,
|
email: lodash.isObject(v) ? v.email : null,
|
||||||
recipientType: 'contact',
|
recipientType: 'contact',
|
||||||
coin: c,
|
coin: v.coin,
|
||||||
displayCoin: (c == 'bch'
|
displayCoin: (v.coin == 'bch'
|
||||||
? (config.bitcoinCashAlias || defaults.bitcoinCashAlias)
|
? (config.bitcoinCashAlias || defaults.bitcoinCashAlias)
|
||||||
: (config.bitcoinAlias || defaults.bitcoinAlias)).toUpperCase(),
|
: (config.bitcoinAlias || defaults.bitcoinAlias)).toUpperCase(),
|
||||||
getAddress: function(cb) {
|
getAddress: function(cb) {
|
||||||
|
|
|
||||||
|
|
@ -50,6 +50,15 @@
|
||||||
<qr-scanner on-scan="onQrCodeScannedAddressBook(data, addressbookForm)"></qr-scanner>
|
<qr-scanner on-scan="onQrCodeScannedAddressBook(data, addressbookForm)"></qr-scanner>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<label class="item item-input item-select">
|
||||||
|
<div class="input-label" translate>
|
||||||
|
Coin
|
||||||
|
</div>
|
||||||
|
<select ng-model="addressbookEntry.coin">
|
||||||
|
<option value="btc">{{bitcoinAlias}}</option>
|
||||||
|
<option value="bch">{{bitcoinCashAlias}}</option>
|
||||||
|
</select>
|
||||||
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="padding">
|
<div class="padding">
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue