mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-12-01 12:04:21 +01:00
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:
co-authored by
Omar Hatem
Blazebrain
parent
013211e7a6
commit
c8dca29f68
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user