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:
David Adegoke
2025-11-12 11:40:04 +01:00
committed by GitHub
parent 238022c466
commit 9775f7a629
6 changed files with 45 additions and 21 deletions
+14
View File
@@ -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;
}