mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-11-30 11:54:22 +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
@@ -24,6 +24,7 @@ import 'package:cake_wallet/entities/secret_store_key.dart';
|
||||
import 'package:cake_wallet/entities/seed_phrase_length.dart';
|
||||
import 'package:cake_wallet/entities/seed_type.dart';
|
||||
import 'package:cake_wallet/entities/sort_balance_types.dart';
|
||||
import 'package:cake_wallet/entities/sync_status_display_mode.dart';
|
||||
import 'package:cake_wallet/entities/wallet_list_order_types.dart';
|
||||
import 'package:cake_wallet/ethereum/ethereum.dart';
|
||||
import 'package:cake_wallet/wownero/wownero.dart';
|
||||
@@ -55,6 +56,7 @@ abstract class SettingsStoreBase with Store {
|
||||
required SharedPreferences sharedPreferences,
|
||||
required bool initialShouldShowMarketPlaceInDashboard,
|
||||
required bool initialShowAddressBookPopupEnabled,
|
||||
required SyncStatusDisplayMode initialSyncStatusDisplayMode,
|
||||
required FiatCurrency initialFiatCurrency,
|
||||
required BalanceDisplayMode initialBalanceDisplayMode,
|
||||
required bool initialSaveRecipientAddress,
|
||||
@@ -168,6 +170,7 @@ abstract class SettingsStoreBase with Store {
|
||||
contactListAscending = initialContactListAscending,
|
||||
shouldShowMarketPlaceInDashboard = initialShouldShowMarketPlaceInDashboard,
|
||||
showAddressBookPopupEnabled = initialShowAddressBookPopupEnabled,
|
||||
syncStatusDisplayMode = initialSyncStatusDisplayMode,
|
||||
exchangeStatus = initialExchangeStatus,
|
||||
pinCodeLength = initialPinLength,
|
||||
languageCode = initialLanguageCode,
|
||||
@@ -388,6 +391,11 @@ abstract class SettingsStoreBase with Store {
|
||||
(bool value) =>
|
||||
sharedPreferences.setBool(PreferencesKey.showAddressBookPopupEnabled, value));
|
||||
|
||||
reaction(
|
||||
(_) => syncStatusDisplayMode,
|
||||
(SyncStatusDisplayMode value) =>
|
||||
sharedPreferences.setString(PreferencesKey.syncStatusDisplayMode, value.toJson()));
|
||||
|
||||
reaction((_) => pinCodeLength,
|
||||
(int pinLength) => sharedPreferences.setInt(PreferencesKey.currentPinLength, pinLength));
|
||||
|
||||
@@ -674,6 +682,9 @@ abstract class SettingsStoreBase with Store {
|
||||
@observable
|
||||
bool showAddressBookPopupEnabled;
|
||||
|
||||
@observable
|
||||
SyncStatusDisplayMode syncStatusDisplayMode;
|
||||
|
||||
@observable
|
||||
ObservableList<ActionListDisplayMode> actionlistDisplayMode;
|
||||
|
||||
@@ -1012,6 +1023,8 @@ abstract class SettingsStoreBase with Store {
|
||||
sharedPreferences.getBool(PreferencesKey.shouldShowMarketPlaceInDashboard) ?? true;
|
||||
final showAddressBookPopupEnabled =
|
||||
sharedPreferences.getBool(PreferencesKey.showAddressBookPopupEnabled) ?? true;
|
||||
final syncStatusDisplayMode = SyncStatusDisplayModeExtension.fromString(
|
||||
sharedPreferences.getString(PreferencesKey.syncStatusDisplayMode) ?? SyncStatusDisplayMode.eta.name);
|
||||
final exchangeStatus = ExchangeApiMode.deserialize(
|
||||
raw: sharedPreferences.getInt(PreferencesKey.exchangeStatusKey) ??
|
||||
ExchangeApiMode.enabled.raw);
|
||||
@@ -1307,6 +1320,7 @@ abstract class SettingsStoreBase with Store {
|
||||
sharedPreferences: sharedPreferences,
|
||||
initialShouldShowMarketPlaceInDashboard: shouldShowMarketPlaceInDashboard,
|
||||
initialShowAddressBookPopupEnabled: showAddressBookPopupEnabled,
|
||||
initialSyncStatusDisplayMode: syncStatusDisplayMode,
|
||||
nodes: nodes,
|
||||
powNodes: powNodes,
|
||||
appVersion: packageInfo.version,
|
||||
@@ -1504,6 +1518,8 @@ abstract class SettingsStoreBase with Store {
|
||||
showAddressBookPopupEnabled =
|
||||
sharedPreferences.getBool(PreferencesKey.showAddressBookPopupEnabled) ??
|
||||
showAddressBookPopupEnabled;
|
||||
syncStatusDisplayMode = SyncStatusDisplayModeExtension.fromString(
|
||||
sharedPreferences.getString(PreferencesKey.syncStatusDisplayMode) ?? SyncStatusDisplayMode.eta.name);
|
||||
exchangeStatus = ExchangeApiMode.deserialize(
|
||||
raw: sharedPreferences.getInt(PreferencesKey.exchangeStatusKey) ??
|
||||
ExchangeApiMode.enabled.raw);
|
||||
|
||||
Reference in New Issue
Block a user