Hack for display login issue

This commit is contained in:
M 2020-11-12 22:02:37 +02:00
parent 52c5d11787
commit 4e4cd08135
3 changed files with 22 additions and 9 deletions

View file

@ -2,12 +2,14 @@ import 'package:cake_wallet/bitcoin/bitcoin_wallet_service.dart';
import 'package:cake_wallet/core/wallet_service.dart';
import 'package:cake_wallet/entities/biometric_auth.dart';
import 'package:cake_wallet/entities/contact_record.dart';
import 'package:cake_wallet/entities/load_current_wallet.dart';
import 'package:cake_wallet/entities/transaction_description.dart';
import 'package:cake_wallet/entities/transaction_info.dart';
import 'package:cake_wallet/monero/monero_wallet_service.dart';
import 'package:cake_wallet/entities/contact.dart';
import 'package:cake_wallet/entities/node.dart';
import 'package:cake_wallet/exchange/trade.dart';
import 'package:cake_wallet/reactions/on_authentication_state_change.dart';
import 'package:cake_wallet/src/screens/contact/contact_list_page.dart';
import 'package:cake_wallet/src/screens/contact/contact_page.dart';
@ -199,6 +201,11 @@ Future setup(
}
authPageState.changeProcessText('Loading the wallet');
if (loginError != null) {
authPageState.changeProcessText('ERROR: ${loginError.toString()}');
}
ReactionDisposer _reaction;
_reaction = reaction((_) => appStore.wallet, (Object _) {
_reaction?.reaction?.dispose();

View file

@ -103,15 +103,15 @@ class MoneroWalletService extends WalletService<
final isValid = await wallet.validate();
if (!isValid) {
if (wallet.seed?.isNotEmpty ?? false) {
// if (wallet.seed?.isNotEmpty ?? false) {
// let restore from seed in this case;
final seed = wallet.seed;
final credentials = MoneroRestoreWalletFromSeedCredentials(
name: name, password: password, mnemonic: seed, height: 2000000)
..walletInfo = walletInfo;
await remove(name);
return restoreFromSeed(credentials);
}
// final seed = wallet.seed;
// final credentials = MoneroRestoreWalletFromSeedCredentials(
// name: name, password: password, mnemonic: seed, height: 2000000)
// ..walletInfo = walletInfo;
// await remove(name);
// return restoreFromSeed(credentials);
// }
throw MoneroWalletLoadingException();
}

View file

@ -7,13 +7,19 @@ import 'package:cake_wallet/store/authentication_store.dart';
ReactionDisposer _onAuthenticationStateChange;
dynamic loginError;
void startAuthenticationStateChange(AuthenticationStore authenticationStore,
@required GlobalKey<NavigatorState> navigatorKey) {
_onAuthenticationStateChange ??= autorun((_) async {
final state = authenticationStore.state;
if (state == AuthenticationState.installed) {
await loadCurrentWallet();
try {
await loadCurrentWallet();
} catch(e) {
loginError = e;
}
return;
}