mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-28 06:28:41 +01:00
fix: Sync bar ETA (#2515)
* fix: Sync bar ETA * fix: Smooth ETA - WIP * fix: Show disconnected status when sync disconnects * feat: Display blocks remaining for the first five seconds and then switch to percentage * Update * fix: Extend duration for showing blocks remaining during sync from 5 to 15 seconds; update connectivity check to handle multiple connectivity results, and handle disconnected state while syncing * feat: Initially display block if the a reconnection is triggered while syncing * fix: More improvements to syncing
This commit is contained in:
@@ -4,6 +4,20 @@ import 'package:cw_core/sync_status.dart';
|
||||
|
||||
String syncStatusTitle(SyncStatus syncStatus, SyncStatusDisplayMode syncStatusDisplayMode) {
|
||||
if (syncStatus is SyncingSyncStatus) {
|
||||
// Show blocks remaining for the first 3 seconds, then switch to percentage
|
||||
if (syncStatus.shouldShowBlocksRemaining()) {
|
||||
if (syncStatus.blocksLeft == 1) {
|
||||
return S.current.block_remaining;
|
||||
}
|
||||
return S.current.Blocks_remaining('${syncStatus.blocksLeft}');
|
||||
}
|
||||
|
||||
// After 3 seconds, show percentage-based display
|
||||
// Don't show ETA for very few blocks (less than 100) to avoid inconsistency
|
||||
if (syncStatus.blocksLeft < 100) {
|
||||
return S.current.Blocks_remaining('${syncStatus.blocksLeft}');
|
||||
}
|
||||
|
||||
if (syncStatus.blocksLeft == 1) {
|
||||
return S.current.block_remaining;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user