mirror of https://github.com/BTCPrivate/copay.git
Merge pull request #452 from cmgustavo/bug/01-refresh
Fix refresh button
This commit is contained in:
commit
41dadab915
10
index.html
10
index.html
|
@ -331,16 +331,16 @@
|
|||
<span>{{addr.address}}</span>
|
||||
<span ng-if="addr.isChange">(change)</span>
|
||||
<span class="right">
|
||||
<span ng-if="$root.receivedFund[1] == addr.address">
|
||||
<span ng-if="addrWithFund == addr.address">
|
||||
<span ng-if="$root.updatingBalance">
|
||||
<i class="fi-bitcoin-circle icon-rotate spinner"></i>
|
||||
</span>
|
||||
<span ng-if="!$root.updatingBalance">
|
||||
{{$root.balanceByAddr[addr.address]}}
|
||||
{{$root.balanceByAddr[addr.address] || 0}}
|
||||
<i class="fi-bitcoin"></i>
|
||||
</span>
|
||||
</span>
|
||||
<span ng-if="$root.receivedFund[1] != addr.address">
|
||||
<span ng-if="addrWithFund != addr.address">
|
||||
{{addr.balance || 0}}
|
||||
<i class="fi-bitcoin"></i>
|
||||
</span>
|
||||
|
@ -351,7 +351,7 @@
|
|||
<qrcode size="160" data="{{selectedAddr.address}}"></qrcode>
|
||||
<p class="m10t">
|
||||
<strong>
|
||||
<span ng-if="$root.receivedFund[1] == selectedAddr.address">
|
||||
<span ng-if="addrWithFund == selectedAddr.address">
|
||||
<span ng-if="$root.updatingBalance">
|
||||
<i class="fi-bitcoin-circle icon-rotate spinner"></i>
|
||||
</span>
|
||||
|
@ -359,7 +359,7 @@
|
|||
<i class="fi-bitcoin"></i>
|
||||
</span>
|
||||
</span>
|
||||
<span ng-if="$root.receivedFund[1] != selectedAddr.address">
|
||||
<span ng-if="addrWithFund != selectedAddr.address">
|
||||
{{selectedAddr.balance || 0}}
|
||||
<i class="fi-bitcoin"></i>
|
||||
</span>
|
||||
|
|
|
@ -20,12 +20,13 @@ angular.module('copay.addresses').controller('AddressesController',
|
|||
$scope.selectedAddr = addr;
|
||||
};
|
||||
|
||||
$rootScope.$watch('addrInfos', function(addrInfos) {
|
||||
$scope.addressList(addrInfos);
|
||||
$rootScope.$watch('addrInfos', function() {
|
||||
$scope.addressList();
|
||||
});
|
||||
|
||||
$scope.addressList = function (addrInfos) {
|
||||
$scope.addressList = function () {
|
||||
$scope.addresses = [];
|
||||
var addrInfos = $rootScope.addrInfos;
|
||||
if (addrInfos) {
|
||||
for(var i=0;i<addrInfos.length;i++) {
|
||||
var addrinfo = addrInfos[i];
|
||||
|
@ -36,6 +37,8 @@ angular.module('copay.addresses').controller('AddressesController',
|
|||
});
|
||||
}
|
||||
$scope.selectedAddr = $scope.addresses[0];
|
||||
$scope.addrWithFund = $rootScope.receivedFund ? $rootScope.receivedFund[1] : null;
|
||||
$rootScope.receivedFund = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -63,9 +63,11 @@ angular.module('copay.header').controller('HeaderController',
|
|||
$scope.refresh = function() {
|
||||
var w = $rootScope.wallet;
|
||||
w.connectToAll();
|
||||
if ($rootScope.addrInfos.length > 0 ) {
|
||||
controllerUtils.updateBalance(function() {
|
||||
$rootScope.$digest();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
$scope.clearFlashMessage = function() {
|
||||
|
|
|
@ -107,10 +107,7 @@ angular.module('copay.controllerUtils')
|
|||
|
||||
root.updateBalance = function(cb) {
|
||||
console.log('Updating balance...');
|
||||
root.updateAddressList();
|
||||
var w = $rootScope.wallet;
|
||||
if ($rootScope.addrInfos.length === 0)
|
||||
return cb?cb():null;
|
||||
|
||||
$rootScope.balanceByAddr = {};
|
||||
$rootScope.updatingBalance = true;
|
||||
|
@ -130,6 +127,7 @@ angular.module('copay.controllerUtils')
|
|||
$rootScope.totalBalance = balance;
|
||||
$rootScope.balanceByAddr = balanceByAddr;
|
||||
$rootScope.availableBalance = safeBalance;
|
||||
root.updateAddressList();
|
||||
$rootScope.updatingBalance = false;
|
||||
console.log('Done updating balance.'); //TODO
|
||||
return cb?cb():null;
|
||||
|
|
Loading…
Reference in New Issue