mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-29 06:38:45 +01:00
Upstream reformatted its whole tree in 16ddc0837. Matching it removes
formatting from the conflict surface of this and every later sync.
25 lines
1.0 KiB
Dart
25 lines
1.0 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';
|
|
|
|
ReactionDisposer? _onCurrentFiatCurrencyChangeDisposer;
|
|
|
|
void startCurrentFiatApiModeChangeReaction(
|
|
AppStore appStore, SettingsStore settingsStore, FiatConversionStore fiatConversionStore) {
|
|
_onCurrentFiatCurrencyChangeDisposer?.reaction.dispose();
|
|
_onCurrentFiatCurrencyChangeDisposer =
|
|
reaction((_) => settingsStore.fiatApiMode, (FiatApiMode fiatApiMode) async {
|
|
if (appStore.wallet == null || fiatApiMode == FiatApiMode.disabled) {
|
|
return;
|
|
}
|
|
|
|
fiatConversionStore.prices[appStore.wallet!.currency] = await FiatConversionService.fetchPrice(
|
|
crypto: appStore.wallet!.currency,
|
|
fiat: settingsStore.fiatCurrency,
|
|
torOnly: fiatApiMode == FiatApiMode.torOnly);
|
|
});
|
|
}
|