Fix event for newCopayers
This commit is contained in:
parent
e98ce470f7
commit
c21ff0c077
1 changed files with 11 additions and 6 deletions
|
|
@ -3,6 +3,7 @@
|
||||||
angular.module('copayApp.controllers').controller('copayersController',
|
angular.module('copayApp.controllers').controller('copayersController',
|
||||||
function($scope, $log, $timeout, $stateParams, $state, $rootScope, $ionicHistory, appConfigService, lodash, profileService, walletService, popupService, bwcError, platformInfo, gettextCatalog, ongoingProcess, pushNotificationsService) {
|
function($scope, $log, $timeout, $stateParams, $state, $rootScope, $ionicHistory, appConfigService, lodash, profileService, walletService, popupService, bwcError, platformInfo, gettextCatalog, ongoingProcess, pushNotificationsService) {
|
||||||
|
|
||||||
|
var listener;
|
||||||
var appName = appConfigService.userVisibleName;
|
var appName = appConfigService.userVisibleName;
|
||||||
var appUrl = appConfigService.url;
|
var appUrl = appConfigService.url;
|
||||||
|
|
||||||
|
|
@ -11,13 +12,14 @@ angular.module('copayApp.controllers').controller('copayersController',
|
||||||
$scope.wallet = profileService.getWallet(data.stateParams.walletId);
|
$scope.wallet = profileService.getWallet(data.stateParams.walletId);
|
||||||
updateWallet();
|
updateWallet();
|
||||||
$scope.shareIcon = platformInfo.isIOS ? 'iOS' : 'Android';
|
$scope.shareIcon = platformInfo.isIOS ? 'iOS' : 'Android';
|
||||||
});
|
|
||||||
|
listener = $rootScope.$on('bwsEvent', function(e, walletId, type, n) {
|
||||||
|
if ($scope.wallet && walletId == $scope.wallet.id && type == ('NewCopayer' || 'WalletComplete'))
|
||||||
|
updateWalletDebounced();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
var listener = $rootScope.$on('bwsEvent', function() {
|
$scope.$on("$ionicView.leave", function(event, data) {
|
||||||
updateWallet();
|
|
||||||
});
|
|
||||||
|
|
||||||
$scope.$on('$destroy', function() {
|
|
||||||
listener();
|
listener();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -47,6 +49,8 @@ angular.module('copayApp.controllers').controller('copayersController',
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var updateWalletDebounced = lodash.debounce(updateWallet, 5000, true);
|
||||||
|
|
||||||
$scope.showDeletePopup = function() {
|
$scope.showDeletePopup = function() {
|
||||||
var title = gettextCatalog.getString('Confirm');
|
var title = gettextCatalog.getString('Confirm');
|
||||||
var msg = gettextCatalog.getString('Are you sure you want to cancel and delete this wallet?');
|
var msg = gettextCatalog.getString('Are you sure you want to cancel and delete this wallet?');
|
||||||
|
|
@ -90,6 +94,7 @@ angular.module('copayApp.controllers').controller('copayersController',
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.clearNextView = function() {
|
$scope.clearNextView = function() {
|
||||||
|
listener(); // remove listener
|
||||||
$ionicHistory.nextViewOptions({
|
$ionicHistory.nextViewOptions({
|
||||||
disableAnimate: true,
|
disableAnimate: true,
|
||||||
historyRoot: true
|
historyRoot: true
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue