mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-11-13 09:04:09 +01:00
fix: Restore backup bug fix and clean up sol error message (#1614)
* fix: Restore backup bug fix and clean up sol error message * fix: Add async await to reinitialize
This commit is contained in:
@@ -21,16 +21,14 @@ Future<void> bootstrap(GlobalKey<NavigatorState> navigatorKey) async {
|
||||
final settingsStore = getIt.get<SettingsStore>();
|
||||
final fiatConversionStore = getIt.get<FiatConversionStore>();
|
||||
|
||||
final currentWalletName = getIt
|
||||
.get<SharedPreferences>()
|
||||
.getString(PreferencesKey.currentWalletName);
|
||||
final currentWalletName =
|
||||
getIt.get<SharedPreferences>().getString(PreferencesKey.currentWalletName);
|
||||
if (currentWalletName != null) {
|
||||
authenticationStore.installed();
|
||||
}
|
||||
|
||||
startAuthenticationStateChange(authenticationStore, navigatorKey);
|
||||
startCurrentWalletChangeReaction(
|
||||
appStore, settingsStore, fiatConversionStore);
|
||||
await startAuthenticationStateChange(authenticationStore, navigatorKey);
|
||||
startCurrentWalletChangeReaction(appStore, settingsStore, fiatConversionStore);
|
||||
startCurrentFiatChangeReaction(appStore, settingsStore, fiatConversionStore);
|
||||
startCurrentFiatApiModeChangeReaction(appStore, settingsStore, fiatConversionStore);
|
||||
startOnCurrentNodeChangeReaction(appStore);
|
||||
|
||||
@@ -13,8 +13,20 @@ ReactionDisposer? _onAuthenticationStateChange;
|
||||
dynamic loginError;
|
||||
StreamController<dynamic> authenticatedErrorStreamController = StreamController<dynamic>();
|
||||
|
||||
void startAuthenticationStateChange(
|
||||
AuthenticationStore authenticationStore, GlobalKey<NavigatorState> navigatorKey) {
|
||||
Future<void> reInitializeStreamController() async {
|
||||
if (!authenticatedErrorStreamController.isClosed) {
|
||||
await authenticatedErrorStreamController.close();
|
||||
}
|
||||
|
||||
authenticatedErrorStreamController = StreamController<dynamic>();
|
||||
}
|
||||
|
||||
Future<void> startAuthenticationStateChange(
|
||||
AuthenticationStore authenticationStore,
|
||||
GlobalKey<NavigatorState> navigatorKey,
|
||||
) async {
|
||||
await reInitializeStreamController();
|
||||
|
||||
authenticatedErrorStreamController.stream.listen((event) {
|
||||
if (authenticationStore.state == AuthenticationState.allowed) {
|
||||
ExceptionHandler.showError(event.toString(), delayInSeconds: 3);
|
||||
|
||||
Reference in New Issue
Block a user