mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-25 05:58:42 +01:00
Fixes for update fiat rate after change of current wallet type. Fixes for change amount for btc transactions. Changed displaying of balance for btc wallet. General fixes.
This commit is contained in:
@@ -12,12 +12,13 @@ Future<void> startFiatRateUpdate(AppStore appStore, SettingsStore settingsStore,
|
||||
return;
|
||||
}
|
||||
|
||||
fiatConversionStore.price = await FiatConversionService.fetchPrice(
|
||||
appStore.wallet.currency, settingsStore.fiatCurrency);
|
||||
fiatConversionStore.prices[appStore.wallet.currency] =
|
||||
await FiatConversionService.fetchPrice(
|
||||
appStore.wallet.currency, settingsStore.fiatCurrency);
|
||||
|
||||
_timer = Timer.periodic(
|
||||
Duration(seconds: 30),
|
||||
(_) async => fiatConversionStore.price =
|
||||
(_) async => fiatConversionStore.prices[appStore.wallet.currency] =
|
||||
await FiatConversionService.fetchPrice(
|
||||
appStore.wallet.currency, settingsStore.fiatCurrency));
|
||||
}
|
||||
|
||||
@@ -7,12 +7,13 @@ import 'package:cake_wallet/entities/fiat_currency.dart';
|
||||
|
||||
ReactionDisposer _onCurrentFiatCurrencyChangeDisposer;
|
||||
|
||||
void startCurrentFiatChangeReaction(AppStore appStore, SettingsStore settingsStore, FiatConversionStore fiatConversionStore) {
|
||||
void startCurrentFiatChangeReaction(AppStore appStore,
|
||||
SettingsStore settingsStore, FiatConversionStore fiatConversionStore) {
|
||||
_onCurrentFiatCurrencyChangeDisposer?.reaction?.dispose();
|
||||
_onCurrentFiatCurrencyChangeDisposer = reaction(
|
||||
(_) => settingsStore.fiatCurrency, (FiatCurrency fiatCurrency) async {
|
||||
(_) => settingsStore.fiatCurrency, (FiatCurrency fiatCurrency) async {
|
||||
final cryptoCurrency = appStore.wallet.currency;
|
||||
fiatConversionStore.price = await FiatConversionService.fetchPrice(
|
||||
cryptoCurrency, fiatCurrency);
|
||||
fiatConversionStore.prices[appStore.wallet.currency] =
|
||||
await FiatConversionService.fetchPrice(cryptoCurrency, fiatCurrency);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,10 +6,9 @@ ReactionDisposer _onCurrentNodeChangeReaction;
|
||||
|
||||
void startOnCurrentNodeChangeReaction(AppStore appStore) {
|
||||
_onCurrentNodeChangeReaction?.reaction?.dispose();
|
||||
_onCurrentNodeChangeReaction =
|
||||
reaction((_) => appStore.settingsStore.currentNode, (Node node) async {
|
||||
appStore.settingsStore.nodes.observe((change) async {
|
||||
try {
|
||||
await appStore.wallet.connectToNode(node: node);
|
||||
await appStore.wallet.connectToNode(node: change.newValue);
|
||||
} catch (e) {
|
||||
print(e.toString());
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ import 'package:cake_wallet/core/wallet_base.dart';
|
||||
import 'package:cake_wallet/entities/wallet_type.dart';
|
||||
|
||||
ReactionDisposer _onCurrentWalletChangeReaction;
|
||||
ReactionDisposer _onCurrentWalletChangeFiatRateUpdateReaction;
|
||||
|
||||
void startCurrentWalletChangeReaction(AppStore appStore,
|
||||
SettingsStore settingsStore, FiatConversionStore fiatConversionStore) {
|
||||
@@ -29,8 +30,16 @@ void startCurrentWalletChangeReaction(AppStore appStore,
|
||||
await getIt.get<SharedPreferences>().setInt(
|
||||
PreferencesKey.currentWalletType, serializeToInt(wallet.type));
|
||||
await wallet.connectToNode(node: node);
|
||||
} catch (e) {
|
||||
print(e.toString());
|
||||
}
|
||||
});
|
||||
|
||||
fiatConversionStore.price = await FiatConversionService.fetchPrice(
|
||||
_onCurrentWalletChangeFiatRateUpdateReaction =
|
||||
reaction((_) => appStore.wallet, (WalletBase wallet) async {
|
||||
try {
|
||||
fiatConversionStore.prices[wallet.currency] = 0;
|
||||
fiatConversionStore.prices[wallet.currency] = await FiatConversionService.fetchPrice(
|
||||
wallet.currency, settingsStore.fiatCurrency);
|
||||
} catch (e) {
|
||||
print(e.toString());
|
||||
|
||||
Reference in New Issue
Block a user