cake_wallet/lib/reactions/bootstrap.dart

43 lines
2.2 KiB
Dart
Raw Normal View History

2020-08-29 10:19:27 +00:00
import 'dart:async';
import 'package:cake_wallet/reactions/fiat_rate_update.dart';
import 'package:cake_wallet/reactions/on_current_fiat_api_mode_change.dart';
2020-09-26 19:17:31 +00:00
import 'package:cake_wallet/reactions/on_current_node_change.dart';
2020-09-14 12:08:33 +00:00
import 'package:flutter/cupertino.dart';
import 'package:flutter/widgets.dart';
2024-05-03 08:46:41 +00:00
import 'package:hive/hive.dart';
2020-06-20 07:10:00 +00:00
import 'package:shared_preferences/shared_preferences.dart';
2020-09-21 11:50:26 +00:00
import 'package:cake_wallet/di.dart';
import 'package:cake_wallet/entities/preferences_key.dart';
import 'package:cake_wallet/reactions/on_authentication_state_change.dart';
import 'package:cake_wallet/reactions/on_current_fiat_change.dart';
import 'package:cake_wallet/reactions/on_current_wallet_change.dart';
2020-06-20 07:10:00 +00:00
import 'package:cake_wallet/store/app_store.dart';
import 'package:cake_wallet/store/settings_store.dart';
2020-06-20 07:10:00 +00:00
import 'package:cake_wallet/store/authentication_store.dart';
2020-09-21 11:50:26 +00:00
import 'package:cake_wallet/store/dashboard/fiat_conversion_store.dart';
2024-05-03 08:46:41 +00:00
import 'package:cake_wallet/entities/transaction_description.dart';
2020-06-20 07:10:00 +00:00
2020-09-21 11:50:26 +00:00
Future<void> bootstrap(GlobalKey<NavigatorState> navigatorKey) async {
2020-06-20 07:10:00 +00:00
final appStore = getIt.get<AppStore>();
final authenticationStore = getIt.get<AuthenticationStore>();
final settingsStore = getIt.get<SettingsStore>();
2020-09-21 11:50:26 +00:00
final fiatConversionStore = getIt.get<FiatConversionStore>();
2024-05-03 08:46:41 +00:00
final transactionDescription = getIt.get<Box<TransactionDescription>>();
2020-06-20 07:10:00 +00:00
2021-01-15 17:41:30 +00:00
final currentWalletName = getIt
.get<SharedPreferences>()
.getString(PreferencesKey.currentWalletName);
if (currentWalletName != null) {
authenticationStore.installed();
}
2020-06-20 07:10:00 +00:00
2020-09-21 11:50:26 +00:00
startAuthenticationStateChange(authenticationStore, navigatorKey);
startCurrentWalletChangeReaction(
2024-05-03 08:46:41 +00:00
appStore, settingsStore, fiatConversionStore, transactionDescription);
startCurrentFiatChangeReaction(appStore, settingsStore, fiatConversionStore, transactionDescription);
startCurrentFiatApiModeChangeReaction(appStore, settingsStore, fiatConversionStore, transactionDescription);
2024-05-03 12:56:49 +00:00
startHistoricalRateUpdateReaction(appStore, settingsStore, fiatConversionStore, transactionDescription);
2020-09-26 19:17:31 +00:00
startOnCurrentNodeChangeReaction(appStore);
startFiatRateUpdate(appStore, settingsStore, fiatConversionStore);
2020-06-20 07:10:00 +00:00
}