fix refresh
This commit is contained in:
parent
e9d90d16fa
commit
0e300c946a
3 changed files with 17 additions and 25 deletions
|
|
@ -297,7 +297,7 @@
|
|||
</span>
|
||||
<span class="text-gray" >
|
||||
{{index.lockedBalanceStr}}
|
||||
<span translate>in pending payments</span>
|
||||
<span translate>locked by pending payments</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -159,29 +159,20 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
|||
};
|
||||
|
||||
var _walletStatusHash = function(walletStatus) {
|
||||
var st = {};
|
||||
|
||||
var bal;
|
||||
if (walletStatus) {
|
||||
st.bal = walletStatus.balance.totalAmount;
|
||||
st.txs = walletStatus.pendingTxps;
|
||||
bal = walletStatus.balance.totalAmount;
|
||||
} else {
|
||||
st.bal = self.totalBalanceSat;
|
||||
st.txs = self.txps;
|
||||
bal = self.totalBalanceSat;
|
||||
}
|
||||
|
||||
var hash = st.bal + ':';
|
||||
if (st.txs) {
|
||||
hash += lodash.map(st.txs, function(t) {
|
||||
return t.id + ':' + (t.actions ? t.actions.length : 0);
|
||||
}).join(':');
|
||||
}
|
||||
return hash;
|
||||
return bal;
|
||||
};
|
||||
|
||||
self.updateAll = function(walletStatus, untilItChanges, initStatusHash, tries) {
|
||||
tries = tries || 0;
|
||||
if (untilItChanges && lodash.isUndefined(initStatusHash)) {
|
||||
initStatusHash = _walletStatusHash();
|
||||
$log.debug('Updating status until it changes. initStatusHash:' + initStatusHash)
|
||||
}
|
||||
var get = function(cb) {
|
||||
if (walletStatus)
|
||||
|
|
@ -206,8 +197,11 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
|||
self.setOngoingProcess('updatingStatus', true);
|
||||
$log.debug('Updating Status:', fc, tries);
|
||||
get(function(err, walletStatus) {
|
||||
if (!err && untilItChanges && initStatusHash == _walletStatusHash(walletStatus) && tries < 7) {
|
||||
var currentStatusHash = _walletStatusHash(walletStatus);
|
||||
$log.debug('Status update. hash:' + currentStatusHash + ' Try:'+ tries);
|
||||
if (!err && untilItChanges && initStatusHash == currentStatusHash && tries < 7) {
|
||||
return $timeout(function() {
|
||||
$log.debug('Retrying update... Try:' + tries)
|
||||
return self.updateAll(null, true, initStatusHash, ++tries);
|
||||
}, 1400 * tries);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -127,6 +127,7 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
|||
|
||||
this.openTxpModal = function(tx, copayers) {
|
||||
var fc = profileService.focusedClient;
|
||||
var refreshUntilItChanges = false;
|
||||
var ModalInstanceCtrl = function($scope, $modalInstance) {
|
||||
$scope.error = null;
|
||||
$scope.tx = tx;
|
||||
|
|
@ -136,7 +137,7 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
|||
$scope.copayerId = fc.credentials.copayerId;
|
||||
$scope.loading = null;
|
||||
$scope.color = fc.backgroundColor;
|
||||
$scope.refreshUntilItChanges = false;
|
||||
refreshUntilItChanges = false;
|
||||
|
||||
$scope.getShortNetworkName = function() {
|
||||
return fc.credentials.networkName.substring(0, 4);
|
||||
|
|
@ -219,12 +220,11 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
|||
$scope.error = gettext('Could not broadcast payment. Check you connection and try again');
|
||||
$scope.$digest();
|
||||
} else {
|
||||
|
||||
console.log('[walletHome.js.219]'); //TODO
|
||||
$log.debug('Transaction signed and broadcasted')
|
||||
if (memo)
|
||||
$log.info(memo);
|
||||
|
||||
$scope.refreshUntilItChanges = true;
|
||||
refreshUntilItChanges = true;
|
||||
$modalInstance.close(txpsb);
|
||||
}
|
||||
});
|
||||
|
|
@ -250,7 +250,6 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
|||
$scope.error = err.message || gettext('Could not reject payment. Check you connection and try again');
|
||||
$scope.$digest();
|
||||
} else {
|
||||
$scope.refreshUntilItChanges = true;
|
||||
$modalInstance.close(txpr);
|
||||
}
|
||||
});
|
||||
|
|
@ -274,7 +273,6 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
|||
$scope.$digest();
|
||||
return;
|
||||
}
|
||||
$scope.refreshUntilItChanges = true;
|
||||
$modalInstance.close();
|
||||
});
|
||||
}, 100);
|
||||
|
|
@ -297,7 +295,7 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
|||
if (memo)
|
||||
$log.info(memo);
|
||||
|
||||
$scope.refreshUntilItChanges = true;
|
||||
refreshUntilItChanges = true;
|
||||
$modalInstance.close(txpb);
|
||||
}
|
||||
});
|
||||
|
|
@ -329,11 +327,11 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
|||
self.setOngoingProcess();
|
||||
if (txp) {
|
||||
txStatus.notify(txp, function() {
|
||||
$scope.$emit('Local/TxProposalAction', $scope.refreshUntilItChanges);
|
||||
$scope.$emit('Local/TxProposalAction', refreshUntilItChanges);
|
||||
});
|
||||
} else {
|
||||
$timeout(function() {
|
||||
$scope.$emit('Local/TxProposalAction', $scope.refreshUntilItChanges);
|
||||
$scope.$emit('Local/TxProposalAction', refreshUntilItChanges);
|
||||
}, 100);
|
||||
}
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue