cake_wallet/lib/reactions/bootstrap.dart

37 lines
1.8 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';
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';
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>();
2020-06-20 07:10:00 +00:00
final currentWalletName =
getIt.get<SharedPreferences>().getString(PreferencesKey.currentWalletName);
if (currentWalletName != null) {
authenticationStore.installed();
}
2020-06-20 07:10:00 +00:00
await startAuthenticationStateChange(authenticationStore, navigatorKey);
startCurrentWalletChangeReaction(appStore, settingsStore, fiatConversionStore);
2020-10-30 13:56:23 +00:00
startCurrentFiatChangeReaction(appStore, settingsStore, fiatConversionStore);
startCurrentFiatApiModeChangeReaction(appStore, settingsStore, fiatConversionStore);
2020-09-26 19:17:31 +00:00
startOnCurrentNodeChangeReaction(appStore);
startFiatRateUpdate(appStore, settingsStore, fiatConversionStore);
2020-06-20 07:10:00 +00:00
}