fix scanning status

This commit is contained in:
matiu 2017-09-14 22:09:20 -03:00
commit 1ac368c67d
4 changed files with 21 additions and 13 deletions

View file

@ -224,7 +224,6 @@ angular.module('copayApp.controllers').controller('tabHomeController',
wallet.error = null; wallet.error = null;
wallet.status = status; wallet.status = status;
wallet.updating = status && status.wallet && status.wallet.scanStatus == 'running';
// TODO service refactor? not in profile service // TODO service refactor? not in profile service
profileService.setLastKnownBalance(wallet.id, wallet.status.totalBalanceStr, function() {}); profileService.setLastKnownBalance(wallet.id, wallet.status.totalBalanceStr, function() {});
} }
@ -243,7 +242,6 @@ angular.module('copayApp.controllers').controller('tabHomeController',
return; return;
} }
wallet.status = status; wallet.status = status;
wallet.updating = status && status.wallet && status.wallet.scanStatus == 'running';
updateTxps(); updateTxps();
}); });
}; };

View file

@ -305,6 +305,8 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
cacheStatus(status); cacheStatus(status);
wallet.scanning = status.wallet && status.wallet.scanStatus == 'running';
return cb(null, status); return cb(null, status);
}); });
}; };
@ -818,13 +820,10 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
$log.debug('Scanning wallet ' + wallet.id); $log.debug('Scanning wallet ' + wallet.id);
if (!wallet.isComplete()) return; if (!wallet.isComplete()) return;
wallet.updating = true; wallet.scanning = true;
ongoingProcess.set('scanning', true);
wallet.startScan({ wallet.startScan({
includeCopayerBranches: true, includeCopayerBranches: true,
}, function(err) { }, function(err) {
wallet.updating = false;
ongoingProcess.set('scanning', false);
return cb(err); return cb(err);
}); });
}; };

View file

@ -91,10 +91,10 @@
Incomplete Incomplete
</span> </span>
<span ng-if="wallet.isComplete()"> <span ng-if="wallet.isComplete()">
<span ng-if="!wallet.balanceHidden && !wallet.updating"> {{wallet.status.totalBalanceStr ? wallet.status.totalBalanceStr : ( wallet.cachedBalance ? wallet.cachedBalance + (wallet.cachedBalanceUpdatedOn ? ' &middot; ' + ( wallet.cachedBalanceUpdatedOn * 1000 | amTimeAgo) : '') : '' ) }} </span> <span ng-if="!wallet.balanceHidden && !wallet.scanning"> {{wallet.status.totalBalanceStr ? wallet.status.totalBalanceStr : ( wallet.cachedBalance ? wallet.cachedBalance + (wallet.cachedBalanceUpdatedOn ? ' &middot; ' + ( wallet.cachedBalanceUpdatedOn * 1000 | amTimeAgo) : '') : '' ) }} </span>
<span ng-if="wallet.updating" translate> Scanning for funds... </span> <span ng-if="wallet.scanning" translate> Scanning for funds... </span>
<span ng-if="wallet.balanceHidden && !wallet.updating" translate>[Balance Hidden]</span> <span ng-if="wallet.balanceHidden && !wallet.scanning" translate>[Balance Hidden]</span>
<span class="tab-home__wallet__multisig-number" ng-if="wallet.n > 1"> <span class="tab-home__wallet__multisig-number" ng-if="wallet.n > 1">
{{wallet.m}}-of-{{wallet.n}} {{wallet.m}}-of-{{wallet.n}}
</span> </span>

View file

@ -31,7 +31,7 @@
<div <div
ng-click='updateAll(true)' ng-click='updateAll(true)'
ng-show="!updateStatusError && !wallet.balanceHidden" ng-show="!updateStatusError && !wallet.balanceHidden && !wallet.scanning"
on-hold="hideToggle()" on-hold="hideToggle()"
ng-style="{'transform': amountScale}" ng-style="{'transform': amountScale}"
ng-class="{amount__balance: amountIsCollapsible}"> ng-class="{amount__balance: amountIsCollapsible}">
@ -46,15 +46,26 @@
<div ng-style="{'transform': amountScale}" <div ng-style="{'transform': amountScale}"
class="amount__balance" class="amount__balance"
ng-show="!updateStatusError && wallet.balanceHidden" ng-show="!updateStatusError && wallet.balanceHidden && !wallet.scanning"
on-hold="hideToggle()"> on-hold="hideToggle()">
<strong class="size-24" translate>[Balance Hidden]</strong> <strong class="size-24" translate>[Balance Hidden]</strong>
<div ng-style="{opacity: altAmountOpacity}" class="size-14 amount-alternative" translate> § <div ng-style="{opacity: altAmountOpacity}" class="size-14 amount-alternative" translate>
Tap and hold to show Tap and hold to show
</div> </div>
</div> </div>
<div ng-if="!wallet.balanceHidden && showBalanceButton" ng-style="{'opacity': altAmountOpacity, 'transform': amountScale}">
<div ng-style="{'transform': amountScale}"
class="amount__balance"
ng-show="wallet.scanning">
<strong class="size-24" translate>[Scanning Funds]</strong>
<div ng-style="{opacity: altAmountOpacity}" class="size-14 amount-alternative" translate>
Please wait
</div>
</div>
<div ng-if="!wallet.balanceHidden && !wallet.scanning && showBalanceButton" ng-style="{'opacity': altAmountOpacity, 'transform': amountScale}">
<button class="button button-standard button-primary amount__button-balance size-14" ng-click="openBalanceModal()"> <button class="button button-standard button-primary amount__button-balance size-14" ng-click="openBalanceModal()">
<i class="icon ion-ios-checkmark-outline"></i> <i class="icon ion-ios-checkmark-outline"></i>
<strong> <strong>