Try to show seeds if wallet files gets corrupted (#1567)

* add litecoin nodes
minor ui fix

* Try to open the wallet or fetch the seeds and show them to the user

* make sure the seeds are only displayed after authentication
This commit is contained in:
Omar Hatem 2024-08-06 17:59:44 +03:00 committed by GitHub
parent 9da9bee384
commit 5e944a8bf7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 175 additions and 13 deletions

View file

@ -1,3 +1,5 @@
import 'dart:async';
import 'package:cake_wallet/routes.dart';
import 'package:cake_wallet/utils/exception_handler.dart';
import 'package:flutter/widgets.dart';
@ -8,9 +10,16 @@ import 'package:cake_wallet/store/authentication_store.dart';
ReactionDisposer? _onAuthenticationStateChange;
dynamic loginError;
StreamController<dynamic> authenticatedErrorStreamController = StreamController<dynamic>();
void startAuthenticationStateChange(
AuthenticationStore authenticationStore, GlobalKey<NavigatorState> navigatorKey) {
authenticatedErrorStreamController.stream.listen((event) {
if (authenticationStore.state == AuthenticationState.allowed) {
ExceptionHandler.showError(event.toString(), delayInSeconds: 3);
}
});
_onAuthenticationStateChange ??= autorun((_) async {
final state = authenticationStore.state;
@ -26,6 +35,11 @@ void startAuthenticationStateChange(
if (state == AuthenticationState.allowed) {
await navigatorKey.currentState!.pushNamedAndRemoveUntil(Routes.dashboard, (route) => false);
if (!(await authenticatedErrorStreamController.stream.isEmpty)) {
ExceptionHandler.showError(
(await authenticatedErrorStreamController.stream.first).toString());
authenticatedErrorStreamController.stream.drain();
}
return;
}
});