sync status eta (#1701)

* sync status eta

* other necessary changes

* feat: Enhance Sync ETA display mode

- Enhance block rate calculation with weighted averages(accounts for network flunctuations and sync speed of more recent blocks while calculating eta, basically giving us more accuracy)
- Add option to switch between ETA and blocks remaining display in display settings
- Add placeholder ETA while gathering block data

* chore: Listen to smaller changes in eta

---------

Co-authored-by: Omar Hatem <omarh.ismail1@gmail.com>
Co-authored-by: Blazebrain <davidadegoke16@gmail.com>
This commit is contained in:
Matthew Fosse
2025-08-19 18:09:51 +03:00
committed by GitHub
co-authored by Omar Hatem Blazebrain
parent 013211e7a6
commit c8dca29f68
36 changed files with 361 additions and 8 deletions
+1
View File
@@ -114,5 +114,6 @@ class PreferencesKey {
static String backgroundSyncLastTrigger(String walletId) => 'background_sync_last_trigger_${walletId}';
static const backgroundSyncNotificationsEnabled = 'background_sync_notifications_enabled';
static const enableAutomaticNodeSwitching = 'enable_automatic_node_switching';
static const syncStatusDisplayMode = 'sync_status_display_mode';
static const backgroundImage = 'background_image';
}
@@ -0,0 +1,34 @@
enum SyncStatusDisplayMode { eta, blocksRemaining }
extension SyncStatusDisplayModeExtension on SyncStatusDisplayMode {
String get title {
switch (this) {
case SyncStatusDisplayMode.eta:
return 'ETA';
case SyncStatusDisplayMode.blocksRemaining:
return 'Blocks Remaining';
}
}
String get description {
switch (this) {
case SyncStatusDisplayMode.eta:
return 'Show estimated time remaining for sync completion';
case SyncStatusDisplayMode.blocksRemaining:
return 'Show number of blocks remaining to sync';
}
}
static SyncStatusDisplayMode fromString(String value) {
switch (value) {
case 'eta':
return SyncStatusDisplayMode.eta;
case 'blocksRemaining':
return SyncStatusDisplayMode.blocksRemaining;
default:
return SyncStatusDisplayMode.eta;
}
}
String toJson() => name;
}