mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-12-23 03:49:22 +00:00
UI bugfix for monero
This commit is contained in:
parent
0de35c249c
commit
795626af7e
1 changed files with 15 additions and 7 deletions
|
@ -309,13 +309,17 @@ class MoneroWallet extends CoinServiceAPI {
|
||||||
// int restoreheight = walletBase!.walletInfo.restoreHeight ?? 0;
|
// int restoreheight = walletBase!.walletInfo.restoreHeight ?? 0;
|
||||||
int _height = await currentSyncingHeight;
|
int _height = await currentSyncingHeight;
|
||||||
int _currentHeight = await currentNodeHeight;
|
int _currentHeight = await currentNodeHeight;
|
||||||
|
double progress = 0;
|
||||||
|
try {
|
||||||
|
progress = (walletBase!.syncStatus as SyncingSyncStatus).progress();
|
||||||
|
} catch (e, s) {}
|
||||||
|
|
||||||
final int blocksRemaining = _currentHeight - _height;
|
final int blocksRemaining = _currentHeight - _height;
|
||||||
|
|
||||||
GlobalEventBus.instance
|
GlobalEventBus.instance
|
||||||
.fire(BlocksRemainingEvent(blocksRemaining, walletId));
|
.fire(BlocksRemainingEvent(blocksRemaining, walletId));
|
||||||
|
|
||||||
if (blocksRemaining <= 1 && _currentHeight > 0 && _height > 0) {
|
if (progress == 1 && _currentHeight > 0 && _height > 0) {
|
||||||
await stopSyncPercentTimer();
|
await stopSyncPercentTimer();
|
||||||
GlobalEventBus.instance.fire(
|
GlobalEventBus.instance.fire(
|
||||||
WalletSyncStatusChangedEvent(
|
WalletSyncStatusChangedEvent(
|
||||||
|
@ -337,7 +341,7 @@ class MoneroWallet extends CoinServiceAPI {
|
||||||
_height = 1;
|
_height = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
double restorePercent = (_height / _currentHeight).clamp(0.0, 1.0);
|
double restorePercent = progress;
|
||||||
double highestPercent = highestPercentCached;
|
double highestPercent = highestPercentCached;
|
||||||
|
|
||||||
Logging.instance.log(
|
Logging.instance.log(
|
||||||
|
@ -345,10 +349,10 @@ class MoneroWallet extends CoinServiceAPI {
|
||||||
level: LogLevel.Info);
|
level: LogLevel.Info);
|
||||||
|
|
||||||
if (restorePercent > 0 && restorePercent <= 1) {
|
if (restorePercent > 0 && restorePercent <= 1) {
|
||||||
if (restorePercent > highestPercent) {
|
// if (restorePercent > highestPercent) {
|
||||||
highestPercent = restorePercent;
|
highestPercent = restorePercent;
|
||||||
highestPercentCached = restorePercent;
|
highestPercentCached = restorePercent;
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
GlobalEventBus.instance
|
GlobalEventBus.instance
|
||||||
|
@ -396,13 +400,17 @@ class MoneroWallet extends CoinServiceAPI {
|
||||||
final int storedHeight = storedChainHeight;
|
final int storedHeight = storedChainHeight;
|
||||||
int _currentNodeHeight = await currentNodeHeight;
|
int _currentNodeHeight = await currentNodeHeight;
|
||||||
|
|
||||||
|
double progress = 0;
|
||||||
|
try {
|
||||||
|
progress = (walletBase!.syncStatus as SyncingSyncStatus).progress();
|
||||||
|
} catch (e, s) {}
|
||||||
await _fetchTransactionData();
|
await _fetchTransactionData();
|
||||||
|
|
||||||
bool stillSyncing = false;
|
bool stillSyncing = false;
|
||||||
Logging.instance.log(
|
Logging.instance.log(
|
||||||
"storedHeight: $storedHeight, _currentSyncingHeight: $_currentSyncingHeight, _currentNodeHeight: $_currentNodeHeight",
|
"storedHeight: $storedHeight, _currentSyncingHeight: $_currentSyncingHeight, _currentNodeHeight: $_currentNodeHeight",
|
||||||
level: LogLevel.Info);
|
level: LogLevel.Info);
|
||||||
if (storedHeight + 10 < _currentNodeHeight) {
|
if (progress < 1.0) {
|
||||||
stillSyncing = true;
|
stillSyncing = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue