show status modal after sweep
This commit is contained in:
parent
ee99c03602
commit
1c35cf5e81
1 changed files with 8 additions and 9 deletions
|
|
@ -1,5 +1,5 @@
|
||||||
angular.module('copayApp.controllers').controller('paperWalletController',
|
angular.module('copayApp.controllers').controller('paperWalletController',
|
||||||
function($scope, $timeout, $log, $ionicModal, $ionicHistory, popupService, gettextCatalog, platformInfo, configService, profileService, $state, addressService, bitcore, ongoingProcess, txFormatService, $stateParams, walletService) {
|
function($scope, $timeout, $log, $ionicModal, $ionicHistory, popupService, gettextCatalog, platformInfo, configService, profileService, $state, bitcore, ongoingProcess, txFormatService, $stateParams, walletService) {
|
||||||
var wallet = profileService.getWallet($stateParams.walletId);
|
var wallet = profileService.getWallet($stateParams.walletId);
|
||||||
var rawTx;
|
var rawTx;
|
||||||
|
|
||||||
|
|
@ -85,7 +85,7 @@ angular.module('copayApp.controllers').controller('paperWalletController',
|
||||||
};
|
};
|
||||||
|
|
||||||
function _sweepWallet(cb) {
|
function _sweepWallet(cb) {
|
||||||
addressService.getAddress(wallet.credentials.walletId, true, function(err, destinationAddress) {
|
walletService.getAddress(wallet, true, function(err, destinationAddress) {
|
||||||
if (err) return cb(err);
|
if (err) return cb(err);
|
||||||
|
|
||||||
wallet.buildTxFromPrivateKey($scope.privateKey, destinationAddress, null, function(err, tx) {
|
wallet.buildTxFromPrivateKey($scope.privateKey, destinationAddress, null, function(err, tx) {
|
||||||
|
|
@ -109,13 +109,12 @@ angular.module('copayApp.controllers').controller('paperWalletController',
|
||||||
$timeout(function() {
|
$timeout(function() {
|
||||||
_sweepWallet(function(err, destinationAddress, txid) {
|
_sweepWallet(function(err, destinationAddress, txid) {
|
||||||
ongoingProcess.set('sweepingWallet', false);
|
ongoingProcess.set('sweepingWallet', false);
|
||||||
|
$scope.sending = false;
|
||||||
if (err) {
|
if (err) {
|
||||||
$log.error(err);
|
$log.error(err);
|
||||||
popupService.showAlert(gettextCatalog.getString('Error sweeping wallet:'), err || err.toString());
|
popupService.showAlert(gettextCatalog.getString('Error sweeping wallet:'), err || err.toString());
|
||||||
} else {
|
} else {
|
||||||
var type = walletService.getViewStatus(wallet, txp);
|
$scope.openStatusModal('broadcasted', function() {
|
||||||
$scope.openStatusModal(type, txp, function() {
|
|
||||||
$ionicHistory.clearHistory();
|
$ionicHistory.clearHistory();
|
||||||
$state.go('tabs.home');
|
$state.go('tabs.home');
|
||||||
});
|
});
|
||||||
|
|
@ -125,15 +124,15 @@ angular.module('copayApp.controllers').controller('paperWalletController',
|
||||||
}, 100);
|
}, 100);
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.openStatusModal = function(type, txp, cb) {
|
$scope.openStatusModal = function(type, cb) {
|
||||||
|
$scope.tx = {};
|
||||||
|
$scope.tx.amountStr = $scope.balance;
|
||||||
$scope.type = type;
|
$scope.type = type;
|
||||||
$scope.tx = txFormatService.processTx(txp);
|
|
||||||
$scope.color = wallet.backgroundColor;
|
$scope.color = wallet.backgroundColor;
|
||||||
$scope.cb = cb;
|
$scope.cb = cb;
|
||||||
|
|
||||||
$ionicModal.fromTemplateUrl('views/modals/tx-status.html', {
|
$ionicModal.fromTemplateUrl('views/modals/tx-status.html', {
|
||||||
scope: $scope,
|
scope: $scope
|
||||||
animation: 'slide-in-up'
|
|
||||||
}).then(function(modal) {
|
}).then(function(modal) {
|
||||||
$scope.txStatusModal = modal;
|
$scope.txStatusModal = modal;
|
||||||
$scope.txStatusModal.show();
|
$scope.txStatusModal.show();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue