Notify when a tx has been confirmed

This commit is contained in:
Gustavo Maximiliano Cortez 2017-05-23 09:46:42 -03:00
commit 5ae543d4c4
No known key found for this signature in database
GPG key ID: 15EDAD8D9F2EB1AF
5 changed files with 73 additions and 1 deletions

View file

@ -1,6 +1,6 @@
'use strict';
angular.module('copayApp.controllers').controller('txDetailsController', function($rootScope, $log, $ionicHistory, $scope, $timeout, walletService, lodash, gettextCatalog, profileService, configService, externalLinkService, popupService, ongoingProcess, txFormatService) {
angular.module('copayApp.controllers').controller('txDetailsController', function($rootScope, $log, $ionicHistory, $scope, $timeout, walletService, lodash, gettextCatalog, profileService, externalLinkService, popupService, ongoingProcess, txFormatService, txConfirmNotification) {
var txId;
var listeners = [];
@ -12,6 +12,10 @@ angular.module('copayApp.controllers').controller('txDetailsController', functio
$scope.color = $scope.wallet.color;
$scope.copayerId = $scope.wallet.credentials.copayerId;
$scope.isShared = $scope.wallet.credentials.n > 1;
txConfirmNotification.checkIfEnabled(txId, function(res) {
$scope.txNotification = { value: res };
});
});
$scope.$on("$ionicView.afterEnter", function(event) {
@ -186,4 +190,12 @@ angular.module('copayApp.controllers').controller('txDetailsController', functio
});
};
$scope.txConfirmNotificationChange = function() {
if ($scope.txNotification.value) {
txConfirmNotification.subscribe($scope.wallet, { txid: txId });
} else {
txConfirmNotification.unsubscribe($scope.wallet, txId);
}
};
});