mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-06-28 20:39:51 +00:00
TMP 0
This commit is contained in:
parent
5eefd6a31b
commit
6aaac93fa8
28 changed files with 364 additions and 143 deletions
|
@ -50,7 +50,8 @@ ReactionDisposer _onCurrentWalletChangeReaction;
|
|||
ReactionDisposer _onWalletSyncStatusChangeReaction;
|
||||
ReactionDisposer _onCurrentFiatCurrencyChangeDisposer;
|
||||
|
||||
Future<void> bootstrap({FiatConvertationService fiatConvertationService}) async {
|
||||
Future<void> bootstrap(
|
||||
{FiatConvertationService fiatConvertationService}) async {
|
||||
final authenticationStore = getIt.get<AuthenticationStore>();
|
||||
final settingsStore = getIt.get<SettingsStore>();
|
||||
final fiatConvertationStore = getIt.get<FiatConvertationStore>();
|
||||
|
@ -72,12 +73,10 @@ Future<void> bootstrap({FiatConvertationService fiatConvertationService}) async
|
|||
|
||||
_onCurrentWalletChangeReaction ??=
|
||||
reaction((_) => getIt.get<AppStore>().wallet, (WalletBase wallet) async {
|
||||
print('Wallet name ${wallet.name}');
|
||||
|
||||
_onWalletSyncStatusChangeReaction?.reaction?.dispose();
|
||||
_onWalletSyncStatusChangeReaction = when(
|
||||
_onWalletSyncStatusChangeReaction = reaction(
|
||||
(_) => wallet.syncStatus is ConnectedSyncStatus,
|
||||
() async => await wallet.startSync());
|
||||
(_) async => await wallet.startSync());
|
||||
|
||||
await getIt
|
||||
.get<SharedPreferences>()
|
||||
|
@ -87,30 +86,24 @@ Future<void> bootstrap({FiatConvertationService fiatConvertationService}) async
|
|||
.get<SharedPreferences>()
|
||||
.setInt('current_wallet_type', serializeToInt(wallet.type));
|
||||
|
||||
await wallet.connectToNode(node: null);
|
||||
|
||||
final node = settingsStore.getCurrentNode(wallet.type);
|
||||
final cryptoCurrency = wallet.currency;
|
||||
final fiatCurrency = settingsStore.fiatCurrency;
|
||||
|
||||
await wallet.connectToNode(node: node);
|
||||
|
||||
final price = await fiatConvertationService.getPrice(
|
||||
crypto: cryptoCurrency,
|
||||
fiat: fiatCurrency
|
||||
);
|
||||
crypto: cryptoCurrency, fiat: fiatCurrency);
|
||||
|
||||
fiatConvertationStore.setPrice(price);
|
||||
});
|
||||
|
||||
//
|
||||
|
||||
_onCurrentFiatCurrencyChangeDisposer ??=
|
||||
reaction((_) => settingsStore.fiatCurrency,
|
||||
(FiatCurrency fiatCurrency) async {
|
||||
_onCurrentFiatCurrencyChangeDisposer ??= reaction(
|
||||
(_) => settingsStore.fiatCurrency, (FiatCurrency fiatCurrency) async {
|
||||
final cryptoCurrency = getIt.get<AppStore>().wallet.currency;
|
||||
|
||||
final price = await fiatConvertationService.getPrice(
|
||||
crypto: cryptoCurrency,
|
||||
fiat: fiatCurrency
|
||||
);
|
||||
crypto: cryptoCurrency, fiat: fiatCurrency);
|
||||
|
||||
fiatConvertationStore.setPrice(price);
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue