2020-08-29 10:19:27 +00:00
|
|
|
import 'dart:async';
|
2022-12-08 15:23:17 +00:00
|
|
|
import 'package:cake_wallet/reactions/fiat_rate_update.dart';
|
2023-02-28 16:23:21 +00:00
|
|
|
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';
|
2020-07-24 16:29:16 +00:00
|
|
|
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>();
|
2020-07-24 16:29:16 +00:00
|
|
|
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
|
|
|
|
2024-08-16 22:21:03 +00:00
|
|
|
final currentWalletName =
|
|
|
|
getIt.get<SharedPreferences>().getString(PreferencesKey.currentWalletName);
|
2022-12-03 21:34:23 +00:00
|
|
|
if (currentWalletName != null) {
|
2023-03-17 19:15:28 +00:00
|
|
|
authenticationStore.installed();
|
2022-12-03 21:34:23 +00:00
|
|
|
}
|
2020-06-20 07:10:00 +00:00
|
|
|
|
2024-08-16 22:21:03 +00:00
|
|
|
await startAuthenticationStateChange(authenticationStore, navigatorKey);
|
|
|
|
startCurrentWalletChangeReaction(appStore, settingsStore, fiatConversionStore);
|
2020-10-30 13:56:23 +00:00
|
|
|
startCurrentFiatChangeReaction(appStore, settingsStore, fiatConversionStore);
|
2023-02-28 16:23:21 +00:00
|
|
|
startCurrentFiatApiModeChangeReaction(appStore, settingsStore, fiatConversionStore);
|
2020-09-26 19:17:31 +00:00
|
|
|
startOnCurrentNodeChangeReaction(appStore);
|
2022-12-08 15:23:17 +00:00
|
|
|
startFiatRateUpdate(appStore, settingsStore, fiatConversionStore);
|
2020-06-20 07:10:00 +00:00
|
|
|
}
|