UX: just update address balance that received fund.
Changed rootscope for scope to control address page. Fixes: not alert when address change receive fund
This commit is contained in:
parent
3f8612ee0c
commit
9428ea55d5
4 changed files with 80 additions and 26 deletions
|
|
@ -11,14 +11,32 @@ angular.module('copay.addresses').controller('AddressesController',
|
|||
$timeout(function() {
|
||||
controllerUtils.setSocketHandlers();
|
||||
controllerUtils.updateAddressList();
|
||||
$rootScope.selectedAddr = $rootScope.addrInfos[0].address.toString();
|
||||
$scope.loading = false;
|
||||
$rootScope.$digest();
|
||||
},1);
|
||||
});
|
||||
};
|
||||
|
||||
$scope.selectAddr = function (addr) {
|
||||
return addr === $rootScope.selectedAddr ? 'selected' : '';
|
||||
$scope.selectAddress = function (addr) {
|
||||
$scope.selectedAddr = addr;
|
||||
};
|
||||
|
||||
$rootScope.$watch('addrInfos', function(addrInfos) {
|
||||
$scope.addressList(addrInfos);
|
||||
});
|
||||
|
||||
$scope.addressList = function (addrInfos) {
|
||||
$scope.addresses = [];
|
||||
if (addrInfos) {
|
||||
for(var i=0;i<addrInfos.length;i++) {
|
||||
var addrinfo = addrInfos[i];
|
||||
$scope.addresses.push({
|
||||
'address' : addrinfo.address.toString(),
|
||||
'balance' : $rootScope.balanceByAddr ? $rootScope.balanceByAddr[addrinfo.address.toString()] : 0,
|
||||
'isChange': addrinfo.isChange
|
||||
});
|
||||
}
|
||||
$scope.selectedAddr = $scope.addresses[0];
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
|
|
|||
|
|
@ -31,7 +31,17 @@ angular.module('copay.header').controller('HeaderController',
|
|||
|
||||
$rootScope.$watch('receivedFund', function(receivedFund) {
|
||||
if (receivedFund) {
|
||||
$notification.funds('Received fund', 'on ' + receivedFund[1], receivedFund);
|
||||
var currentAddr;
|
||||
for(var i=0;i<$rootScope.addrInfos.length;i++) {
|
||||
var addrinfo = $rootScope.addrInfos[i];
|
||||
if (addrinfo.address.toString() == receivedFund[1] && !addrinfo.isChange) {
|
||||
currentAddr = addrinfo.address.toString();
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (currentAddr) {
|
||||
$notification.funds('Received fund', currentAddr, receivedFund);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue