diff --git a/src/js/controllers/addressbookView.js b/src/js/controllers/addressbookView.js
index 06bf68fd4..aab6fb5b4 100644
--- a/src/js/controllers/addressbookView.js
+++ b/src/js/controllers/addressbookView.js
@@ -40,12 +40,13 @@ angular.module('copayApp.controllers').controller('addressbookViewController', f
}, 100);
};
- $scope.remove = function(addr) {
+ $scope.remove = function(addressbookEntry) {
var title = gettextCatalog.getString('Warning!');
var message = gettextCatalog.getString('Are you sure you want to delete this contact?');
popupService.showConfirm(title, message, null, null, function(res) {
if (!res) return;
- addressbookService.remove(addr, function(err, ab) {
+
+ addressbookService.remove(addressbookEntry, function(err, ab) {
if (err) {
popupService.showAlert(gettextCatalog.getString('Error'), err);
return;
diff --git a/src/js/directives/directives.js b/src/js/directives/directives.js
index eed8ec104..52b84a3ec 100644
--- a/src/js/directives/directives.js
+++ b/src/js/directives/directives.js
@@ -15,7 +15,10 @@ angular.module('copayApp.directives')
var validator = function(value) {
- if (value.indexOf('bitcoincash:') >= 0 || value[0] == 'C' || value[0] == 'H') {
+ if (value.indexOf('bitcoincash:') >= 0 || value[0] == 'C' || value[0] == 'H' || value[0] == 'p' || value[0] == 'q') {
+ if (value.indexOf('bitcoincash:') < 0) {
+ value = 'bitcoincash:' + value;
+ }
value = bitcoinCashJsService.readAddress(value).legacy;
}
diff --git a/src/js/services/addressbookService.js b/src/js/services/addressbookService.js
index f98bda41d..28a3fd31d 100644
--- a/src/js/services/addressbookService.js
+++ b/src/js/services/addressbookService.js
@@ -64,16 +64,28 @@ angular.module('copayApp.services').factory('addressbookService', function($log,
});
};
- root.remove = function(addr, cb) {
- var network = getNetwork(addr);
+ root.remove = function(entry, cb) {
+
+ // The entry is in bitcoin address, so I get the legacy one, and I operate.
+ if (entry.coin == 'bch') {
+ var a = entry.address;
+ if (entry.address.indexOf('bitcoincash:') < 0) {
+ a = 'bitcoincash:' + a;
+ }
+ entry.address = bitcoinCashJsService.readAddress(a).legacy;
+ } else {
+ entry.address = entry.address;
+ }
+
+ var network = getNetwork(entry.address);
if (lodash.isEmpty(network)) return cb('Not valid bitcoin address');
storageService.getAddressbook(network, function(err, ab) {
if (err) return cb(err);
if (ab) ab = JSON.parse(ab);
ab = ab || {};
if (lodash.isEmpty(ab)) return cb('Addressbook is empty');
- if (!ab[addr]) return cb('Entry does not exist');
- delete ab[addr];
+ if (!ab[entry.coin + entry.address]) return cb('Entry does not exist');
+ delete ab[entry.coin + entry.address];
storageService.setAddressbook(network, JSON.stringify(ab), function(err) {
if (err) return cb('Error deleting entry');
root.list(function(err, ab) {
diff --git a/www/views/addressbook.view.html b/www/views/addressbook.view.html
index 143a97828..ad3ba4964 100644
--- a/www/views/addressbook.view.html
+++ b/www/views/addressbook.view.html
@@ -6,7 +6,7 @@
{{addressbookEntry.name}}
-
+
@@ -36,7 +36,7 @@
-