address review comments[skip ci]

This commit is contained in:
Serhii 2024-07-14 16:48:42 +03:00
parent ccf0fc0e09
commit 6b8d800392
2 changed files with 4 additions and 10 deletions

View file

@ -1521,12 +1521,7 @@ abstract class SettingsStoreBase with Store {
String? serializedData = await _sharedPreferences.getString(PreferencesKey.trocadorProviderStatesKey);
Map<String, bool> regularMap = {};
if (serializedData != null) {
var decodedData = json.decode(serializedData);
if (decodedData is Map) {
regularMap = decodedData.map<String, bool>((key, value) => MapEntry(key as String, value as bool));
}
}
if (serializedData != null) regularMap = json.decode(serializedData) as Map<String, bool>;
trocadorProviderStates.clear();
@ -1547,8 +1542,7 @@ abstract class SettingsStoreBase with Store {
}
Future<void> saveMapToString(String key, Map<String, bool> map) async {
Map<String, bool> regularMap = Map<String, bool>.from(map);
String serializedData = json.encode(regularMap);
String serializedData = json.encode(map);
await _sharedPreferences.setString(key, serializedData);
}

View file

@ -154,10 +154,10 @@ abstract class ExchangeViewModelBase extends WalletChangeListenerViewModel with
ChangeNowExchangeProvider(settingsStore: _settingsStore),
SideShiftExchangeProvider(),
SimpleSwapExchangeProvider(),
TrocadorExchangeProvider(useTorOnly: _useTorOnly),
ThorChainExchangeProvider(tradesStore: trades),
if (FeatureFlag.isExolixEnabled) ExolixExchangeProvider(),
QuantexExchangeProvider(),
TrocadorExchangeProvider(useTorOnly: _useTorOnly)
];
@observable
@ -515,7 +515,7 @@ abstract class ExchangeViewModelBase extends WalletChangeListenerViewModel with
try {
tradeState = TradeIsCreating();
if (provider is TrocadorExchangeProvider) {
await updateAllTrocadorProviderStates(provider);
updateAllTrocadorProviderStates(provider);
provider.providerStates =
Map<String, bool>.from(_settingsStore.trocadorProviderStates);
}