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

View file

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