mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-11-07 08:04:04 +01:00
Upstream reformatted its whole tree in 16ddc0837. Matching it removes
formatting from the conflict surface of this and every later sync.
27 lines
1.1 KiB
Dart
27 lines
1.1 KiB
Dart
import 'package:hash_wallet/entities/fiat_api_mode.dart';
|
|
import 'package:mobx/mobx.dart';
|
|
import 'package:hash_wallet/core/fiat_conversion_service.dart';
|
|
import 'package:hash_wallet/store/dashboard/fiat_conversion_store.dart';
|
|
import 'package:hash_wallet/store/settings_store.dart';
|
|
import 'package:hash_wallet/store/app_store.dart';
|
|
import 'package:hash_wallet/entities/fiat_currency.dart';
|
|
|
|
ReactionDisposer? _onCurrentFiatCurrencyChangeDisposer;
|
|
|
|
void startCurrentFiatChangeReaction(
|
|
AppStore appStore, SettingsStore settingsStore, FiatConversionStore fiatConversionStore) {
|
|
_onCurrentFiatCurrencyChangeDisposer?.reaction.dispose();
|
|
_onCurrentFiatCurrencyChangeDisposer =
|
|
reaction((_) => settingsStore.fiatCurrency, (FiatCurrency fiatCurrency) async {
|
|
if (appStore.wallet == null || settingsStore.fiatApiMode == FiatApiMode.disabled) {
|
|
return;
|
|
}
|
|
|
|
final cryptoCurrency = appStore.wallet!.currency;
|
|
fiatConversionStore.prices[cryptoCurrency] = await FiatConversionService.fetchPrice(
|
|
crypto: cryptoCurrency,
|
|
fiat: fiatCurrency,
|
|
torOnly: settingsStore.fiatApiMode == FiatApiMode.torOnly);
|
|
});
|
|
}
|