send
This commit is contained in:
parent
8072082f4f
commit
b5023ae9e7
10 changed files with 547 additions and 251 deletions
|
|
@ -1,21 +1,25 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('tabSendController', function($scope, $ionicModal, $log, $timeout, addressbookService, profileService, configService, lodash) {
|
||||
angular.module('copayApp.controllers').controller('tabSendController', function($scope, $ionicModal, $log, $timeout, addressbookService, profileService, configService, lodash, $state, walletService) {
|
||||
|
||||
|
||||
var originalList = [];
|
||||
|
||||
$scope.search = '';
|
||||
|
||||
|
||||
$scope.init = function() {
|
||||
|
||||
var wallets = profileService.getWallets();
|
||||
var wallets = profileService.getWallets({onlyComplete: true});
|
||||
|
||||
lodash.each(wallets, function(v) {
|
||||
originalList.push({
|
||||
color: v.color,
|
||||
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,7 +30,9 @@ angular.module('copayApp.controllers').controller('tabSendController', function(
|
|||
lodash.each(ab, function(v, k) {
|
||||
contacts.push({
|
||||
label: k,
|
||||
address: v,
|
||||
getAddress: function(cb) {
|
||||
return cb(null,v);
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
|
|
@ -37,11 +43,11 @@ angular.module('copayApp.controllers').controller('tabSendController', function(
|
|||
|
||||
$scope.findContact = function() {
|
||||
|
||||
if (!$scope.search || $scope.search.length<2){
|
||||
if (!$scope.search || $scope.search.length < 2) {
|
||||
$scope.list = originalList;
|
||||
$timeout(function() {
|
||||
$scope.$apply();
|
||||
},10);
|
||||
}, 10);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -53,15 +59,14 @@ angular.module('copayApp.controllers').controller('tabSendController', function(
|
|||
$scope.list = result;
|
||||
};
|
||||
|
||||
$scope.openInputAmountModal = function(recipient) {
|
||||
$scope.recipientName = recipient.name || recipient.label;
|
||||
$scope.recipientColor = recipient.color;
|
||||
|
||||
$ionicModal.fromTemplateUrl('views/modals/inputAmount.html', {
|
||||
scope: $scope
|
||||
}).then(function(modal) {
|
||||
$scope.inputAmountModal = modal;
|
||||
$scope.inputAmountModal.show();
|
||||
$scope.goToAmount = function(item) {
|
||||
item.getAddress(function(err,addr){
|
||||
if (err|| !addr) {
|
||||
$log.error(err);
|
||||
return;
|
||||
}
|
||||
$log.debug('Got toAddress:' + addr + ' | ' + item.label)
|
||||
return $state.transitionTo('amount', { toAddress: addr, toName: item.label})
|
||||
});
|
||||
};
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue