-
Wallets
+
+
Wallets
-
-
diff --git a/public/views/tab-send.html b/public/views/tab-send.html
index 6ef03a252..340dca1fc 100644
--- a/public/views/tab-send.html
+++ b/public/views/tab-send.html
@@ -1,4 +1,4 @@
-
+
Send
@@ -7,25 +7,33 @@
- Recipient
+
+
Recipient
-
+
+
- Contacts & Wallets
+
+
+
Contacts & Wallets
+
+
+
diff --git a/src/js/controllers/modals/addressbook.js b/src/js/controllers/modals/addressbook.js
deleted file mode 100644
index 23d448755..000000000
--- a/src/js/controllers/modals/addressbook.js
+++ /dev/null
@@ -1,162 +0,0 @@
-'use strict';
-
-angular.module('copayApp.controllers').controller('addressbookController', function($rootScope, $scope, $timeout, lodash, profileService, addressService, addressbookService, bwcError) {
- var self = $scope.self;
-
- var fc = profileService.focusedClient;
- self.lockAddress = false;
- self._address = null;
- $scope.editAddressbook = false;
- $scope.addAddressbookEntry = false;
- $scope.selectedAddressbook = {};
- $scope.newAddress = address;
- $scope.walletName = fc.credentials.walletName;
- $scope.color = fc.backgroundColor;
- $scope.addressbook = {
- 'address': ($scope.newAddress || ''),
- 'label': ''
- };
-
- $scope.checkClipboard = function() {
- if (!$scope.newAddress) {
- getClipboard(function(value) {
- $scope.newAddress = value;
- });
- }
- };
-
- $scope.beforeQrCodeScann = function() {
- $scope.error = null;
- $scope.addAddressbookEntry = true;
- $scope.editAddressbook = false;
- };
-
- $scope.onQrCodeScanned = function(data, addressbookForm) {
- $timeout(function() {
- var form = addressbookForm;
- if (data && form) {
- data = data.replace('bitcoin:', '');
- form.address.$setViewValue(data);
- form.address.$isValid = true;
- form.address.$render();
- }
- $scope.$digest();
- }, 100);
- };
-
- $scope.toggleEditAddressbook = function() {
- $scope.editAddressbook = !$scope.editAddressbook;
- $scope.selectedAddressbook = {};
- $scope.addAddressbookEntry = false;
- };
-
- $scope.selectAddressbook = function(addr) {
- self.setForm(addr);
- $scope.cancel();
- };
-
- $scope.toggleSelectAddressbook = function(addr) {
- $scope.selectedAddressbook[addr] = $scope.selectedAddressbook[addr] ? false : true;
- };
-
- $scope.toggleAddAddressbookEntry = function() {
- $scope.error = null;
- $scope.addressbook = {
- 'address': '',
- 'label': ''
- };
- $scope.addAddressbookEntry = !$scope.addAddressbookEntry;
- };
-
- $scope.contactList = function() {
- $scope.error = null;
- addressbookService.list(function(err, ab) {
- if (err) {
- $scope.error = err;
- return;
- }
- $scope.list = ab;
- $scope.isEmptyList = lodash.isEmpty($scope.list);
- $timeout(function() {
- $scope.$digest();
- });
- });
- };
-
- $scope.setSelectedWalletsOpt = function(val) {
- $scope.selectedWalletsOpt = val;
- };
-
- $scope.add = function(addressbook) {
- $scope.error = null;
- $timeout(function() {
- addressbookService.add(addressbook, function(err, ab) {
- if (err) {
- $scope.error = err;
- return;
- }
- $rootScope.$emit('Local/AddressbookUpdated', ab);
- $scope.list = ab;
- $scope.isEmptyList = lodash.isEmpty($scope.list);
- $scope.editAddressbook = true;
- $scope.toggleEditAddressbook();
- $scope.$digest();
- });
- }, 100);
- };
-
- $scope.remove = function(addr) {
- $scope.error = null;
- $timeout(function() {
- addressbookService.remove(addr, function(err, ab) {
- if (err) {
- $scope.error = err;
- return;
- }
- $rootScope.$emit('Local/AddressbookUpdated', ab);
- $scope.list = ab;
- $scope.isEmptyList = lodash.isEmpty($scope.list);
- if ($scope.isEmptyList)
- $scope.editAddressbook = false;
- $scope.$digest();
- });
- }, 100);
- };
-
- $scope.selectWallet = function(walletId, walletName) {
- var client = profileService.getClient(walletId);
- $scope.errorSelectedWallet = {};
-
- profileService.isReady(client, function(err) {
- if (err) $scope.errorSelectedWallet[walletId] = bwcError.msg(err);
- else {
- $scope.gettingAddress = true;
- $scope.selectedWalletName = walletName;
-
- addressService.getAddress(walletId, false, function(err, addr) {
- $scope.gettingAddress = false;
- if (err) {
- self.error = err;
- $scope.cancelAddress();
- return;
- }
-
- self.setForm(addr);
- $scope.cancel();
- });
- }
- $timeout(function() {
- $scope.$apply();
- });
- });
- };
-
- $scope.cancelAddress = function() {
- self.resetForm();
- $scope.cancel();
- };
-
- $scope.cancel = function() {
- $scope.addressbookModal.hide();
- };
-});
diff --git a/src/js/controllers/tab-scan.js b/src/js/controllers/tab-scan.js
index 03e81a246..704b643e7 100644
--- a/src/js/controllers/tab-scan.js
+++ b/src/js/controllers/tab-scan.js
@@ -180,7 +180,7 @@ angular.module('copayApp.controllers').controller('tabScanController', function(
};
}
localMediaStream = null;
- video.src = '';
+ if (video && video.src) video.src = '';
};
qrcode.callback = function(data) {
diff --git a/src/js/controllers/tab-send.js b/src/js/controllers/tab-send.js
index 7d7f3f7d3..f158194d2 100644
--- a/src/js/controllers/tab-send.js
+++ b/src/js/controllers/tab-send.js
@@ -2,12 +2,10 @@
angular.module('copayApp.controllers').controller('tabSendController', function($scope, $ionicModal, $log, $timeout, addressbookService, profileService, configService, lodash, $state, walletService) {
-
- var originalList = [];
-
- $scope.search = '';
+ var originalList;
$scope.init = function() {
+ originalList = [];
var wallets = profileService.getWallets({onlyComplete: true});
@@ -17,7 +15,6 @@ angular.module('copayApp.controllers').controller('tabSendController', function(
label: v.name,
isWallet: true,
getAddress: function(cb) {
- console.log('[tab-send.js.20] get ADDRESS at wallet!!!', v.name); //TODO
walletService.getAddress(v, false, cb);
},
});
@@ -26,12 +23,15 @@ angular.module('copayApp.controllers').controller('tabSendController', function(
addressbookService.list(function(err, ab) {
if (err) $log.error(err);
+ $scope.isEmptyList = lodash.isEmpty(ab);
+
var contacts = [];
lodash.each(ab, function(v, k) {
contacts.push({
- label: k,
+ label: v,
+ address: k,
getAddress: function(cb) {
- return cb(null,v);
+ return cb(null,k);
},
});
});
@@ -41,9 +41,10 @@ angular.module('copayApp.controllers').controller('tabSendController', function(
});
};
- $scope.findContact = function() {
+ $scope.findContact = function(search, opts) {
+ opts = opts || {};
- if (!$scope.search || $scope.search.length < 2) {
+ if (!search || search.length < 2) {
$scope.list = originalList;
$timeout(function() {
$scope.$apply();
@@ -52,8 +53,9 @@ angular.module('copayApp.controllers').controller('tabSendController', function(
}
var result = lodash.filter($scope.list, function(item) {
+ if (opts && opts.onlyContacts && item.isWallet) return;
var val = item.label || item.alias || item.name;
- return lodash.includes(val.toLowerCase(), $scope.search.toLowerCase());
+ return lodash.includes(val.toLowerCase(), search.toLowerCase());
});
$scope.list = result;
@@ -69,4 +71,82 @@ angular.module('copayApp.controllers').controller('tabSendController', function(
return $state.transitionTo('amount', { toAddress: addr, toName: item.label})
});
};
+
+ /*
+ * Modal Addressbook
+ */
+
+ $ionicModal.fromTemplateUrl('views/modals/addressbook.html', {
+ scope: $scope
+ }).then(function(modal) {
+ $scope.addressbookModal = modal;
+ });
+
+ $scope.openAddressbookModal = function() {
+ $scope.addressbookModal.show();
+ };
+
+ $scope.closeAddressbookModal = function() {
+ $scope.cleanAddressbookEntry();
+ $scope.addAddressbookEntry = false;
+ $scope.addressbookModal.hide();
+ };
+
+ $scope.onQrCodeScanned = function(data, addressbookForm) {
+ $timeout(function() {
+ var form = addressbookForm;
+ if (data && form) {
+ data = data.replace('bitcoin:', '');
+ form.address.$setViewValue(data);
+ form.address.$isValid = true;
+ form.address.$render();
+ }
+ $scope.$digest();
+ }, 100);
+ };
+
+ $scope.cleanAddressbookEntry = function() {
+ $scope.addressbookEntry = {
+ 'address': '',
+ 'label': ''
+ };
+ };
+
+ $scope.toggleAddAddressbookEntry = function() {
+ $scope.cleanAddressbookEntry();
+ $scope.addAddressbookEntry = !$scope.addAddressbookEntry;
+ };
+
+ $scope.add = function(addressbook) {
+ $timeout(function() {
+ addressbookService.add(addressbook, function(err, ab) {
+ if (err) {
+ $log.error(err);
+ return;
+ }
+ $scope.init();
+ $scope.toggleAddAddressbookEntry();
+ $scope.$digest();
+ });
+ }, 100);
+ };
+
+ $scope.remove = function(addr) {
+ $timeout(function() {
+ addressbookService.remove(addr, function(err, ab) {
+ if (err) {
+ $scope.error = err;
+ return;
+ }
+ $scope.init();
+ $scope.$digest();
+ });
+ }, 100);
+ };
+
+ $scope.$on('$destroy', function() {
+ $scope.addressbookModal.remove();
+ });
+
+
});
diff --git a/src/js/directives/qrScanner.js b/src/js/directives/qrScanner.js
index 0c00a8dfa..b29290209 100644
--- a/src/js/directives/qrScanner.js
+++ b/src/js/directives/qrScanner.js
@@ -11,6 +11,6 @@ angular.module('copayApp.directives')
},
controller: 'tabScanController',
replace: true,
- template: ''
+ template: ''
}
});
diff --git a/src/sass/main.scss b/src/sass/main.scss
index f6b3467b0..ae392e38f 100644
--- a/src/sass/main.scss
+++ b/src/sass/main.scss
@@ -548,6 +548,26 @@ ul.wallet-selection.wallets {
margin: 0 auto;
}
+// INPUT CAMERA / VALID / INVALID ICONS
+.input-notification {
+ float: right;
+ margin-right: 10px;
+}
+
+.qr-scan-icon {
+ position: relative;
+}
+
+.qr-scan-icon a {
+ display: block;
+ position: absolute;
+ top: 0;
+ right: 0;
+ padding: 0 10px;
+ font-size: 24px;
+ cursor: pointer;
+}
+
// General purpose
.dn {
display: none;
@@ -948,6 +968,14 @@ input[type=file] {
line-height: 0px;
}
+.text-right {
+ text-align: right;
+}
+
+.text-left {
+ text-align: left;
+}
+
/*
* Calculator
*/