Merge pull request #153 from gabrielbazan7/feat/addEntrySend
add addressbook entry when send success
This commit is contained in:
commit
912789ccb6
8 changed files with 123 additions and 35 deletions
|
|
@ -1,9 +1,11 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('addressbookAddController', function($scope, $state, $timeout, addressbookService, popupService) {
|
||||
angular.module('copayApp.controllers').controller('addressbookAddController', function($scope, $state, $stateParams, $timeout, $ionicHistory, addressbookService, popupService) {
|
||||
|
||||
$scope.fromSendTab = $stateParams.fromSendTab;
|
||||
|
||||
$scope.addressbookEntry = {
|
||||
'address': '',
|
||||
'address': $stateParams.addressbookEntry || '',
|
||||
'name': '',
|
||||
'email': ''
|
||||
};
|
||||
|
|
@ -28,9 +30,15 @@ angular.module('copayApp.controllers').controller('addressbookAddController', fu
|
|||
popupService.showAlert(err);
|
||||
return;
|
||||
}
|
||||
$state.go('tabs.addressbook');
|
||||
if ($scope.fromSendTab) $scope.goHome();
|
||||
else $state.go('tabs.addressbook');
|
||||
});
|
||||
}, 100);
|
||||
};
|
||||
|
||||
$scope.goHome = function() {
|
||||
$ionicHistory.clearHistory();
|
||||
$state.go('tabs.home');
|
||||
};
|
||||
|
||||
});
|
||||
|
|
|
|||
|
|
@ -261,8 +261,6 @@ angular.module('copayApp.controllers').controller('confirmController', function(
|
|||
|
||||
return walletService.onlyPublish(wallet, txp, function(err, txp) {
|
||||
if (err) return setSendError(err);
|
||||
$ionicHistory.clearHistory();
|
||||
$state.go('tabs.home');
|
||||
});
|
||||
}
|
||||
ongoingProcess.set('creatingTx', true);
|
||||
|
|
@ -303,8 +301,6 @@ angular.module('copayApp.controllers').controller('confirmController', function(
|
|||
function publishAndSign(wallet, txp) {
|
||||
walletService.publishAndSign(wallet, txp, function(err, txp) {
|
||||
if (err) return setSendError(err);
|
||||
$ionicHistory.clearHistory();
|
||||
$state.go('tabs.home');
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,27 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('txStatusController', function($scope, $timeout) {
|
||||
angular.module('copayApp.controllers').controller('txStatusController', function($scope, $timeout, $state, $log, addressbookService) {
|
||||
|
||||
if ($scope.cb) $timeout($scope.cb, 100);
|
||||
|
||||
$scope.cancel = function() {
|
||||
$scope.txStatusModal.hide();
|
||||
};
|
||||
|
||||
$scope.save = function(addressbookEntry) {
|
||||
$scope.txStatusModal.hide();
|
||||
$state.go('tabs.send.addressbook', {
|
||||
fromSendTab: true,
|
||||
addressbookEntry: addressbookEntry
|
||||
})
|
||||
}
|
||||
|
||||
addressbookService.list(function(err, ab) {
|
||||
if (err) $log.error(err);
|
||||
if (ab[$scope.tx.toAddress]) {
|
||||
$scope.entryExist = true;
|
||||
$log.debug('Entry already exist');
|
||||
}
|
||||
})
|
||||
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue