fix refresh after delete

This commit is contained in:
Matias Alejo Garcia 2016-09-02 14:55:18 -03:00
commit 6388a97eb5
No known key found for this signature in database
GPG key ID: 02470DB551277AB3
7 changed files with 38 additions and 28 deletions

View file

@ -5,6 +5,17 @@ angular.module('copayApp.controllers').controller('confirmController', function(
var cachedTxp = {};
var isChromeApp = platformInfo.isChromeApp;
$scope.$on('Wallet/Changed', function(event, wallet) {
if (lodash.isEmpty(wallet)) {
$log.debug('No wallet provided');
return;
}
$log.debug('Wallet changed: ' + wallet.name);
setWallet(wallet, true);
});
$scope.showDescriptionPopup = function() {
var commentPopup = $ionicPopup.show({
templateUrl: "views/includes/note.html",
@ -130,15 +141,6 @@ angular.module('copayApp.controllers').controller('confirmController', function(
});
};
$scope.$on('Wallet/Changed', function(event, wallet) {
if (lodash.isEmpty(wallet)) {
$log.debug('No wallet provided');
return;
}
$log.debug('Wallet changed: ' + wallet.name);
setWallet(wallet, true);
});
function setWallet(wallet, delayed) {
var stop;
$scope.wallet = wallet;
@ -255,7 +257,9 @@ angular.module('copayApp.controllers').controller('confirmController', function(
});
}
ongoingProcess.set('creatingTx', true);
createTx(wallet, false, function(err, txp) {
ongoingProcess.set('creatingTx', false);
if (err) return;
walletService.publishAndSign(wallet, txp, function(err, txp) {
if (err) return setSendError(err);

View file

@ -34,7 +34,7 @@ angular.module('copayApp.controllers').controller('txpDetailsController', functi
walletService.publishAndSign($scope.wallet, $scope.tx, function(err, txp) {
$scope.$emit('UpdateTx');
if (err) return setSendError(err);
$scope.close(true);
$scope.close();
});
};
@ -50,7 +50,7 @@ angular.module('copayApp.controllers').controller('txpDetailsController', functi
if (err)
return setError(err, gettextCatalog.getString('Could not reject payment'));
$scope.close(true);
$scope.close();
});
@ -70,7 +70,7 @@ angular.module('copayApp.controllers').controller('txpDetailsController', functi
return setError(err, gettextCatalog.getString('Could not delete payment proposal'));
}
$scope.close(true);
$scope.close();
});
}, 10);
};
@ -87,7 +87,7 @@ angular.module('copayApp.controllers').controller('txpDetailsController', functi
return setError(err, gettextCatalog.getString('Could not broadcast payment'));
}
$scope.close(true);
$scope.close();
});
}, 10);
};
@ -172,10 +172,7 @@ angular.module('copayApp.controllers').controller('txpDetailsController', functi
});
};
$scope.close = function(shouldEmit) {
if (shouldEmit)
$rootScope.$emit('Local/TxAction', $scope.wallet.id);
$scope.close = function() {
$scope.loading = null;
$scope.txpDetailsModal.hide();
};

View file

@ -106,6 +106,7 @@ angular.module('copayApp.controllers').controller('tabHomeController',
$scope.updateWallet(wallet);
}),
$rootScope.$on('Local/TxAction', function(e, walletId) {
$log.debug('Got action for wallet '+ walletId);
var wallet = profileService.getWallet(walletId);
$scope.updateWallet(wallet);
}),