Hack for display login issue
M committed
Nov 12, 2020 at 22:02 UTC
4e4cd081353c5f14bc8540984130eb9f0320e182
3 files changed
+22
-9
lib/di.dart
+7
@@ -2,12 +2,14 @@ import 'package:cake_wallet/bitcoin/bitcoin_wallet_service.dart';
2
import 'package:cake_wallet/core/wallet_service.dart';
3
import 'package:cake_wallet/entities/biometric_auth.dart';
4
import 'package:cake_wallet/entities/contact_record.dart';
5
+import 'package:cake_wallet/entities/load_current_wallet.dart';
6
import 'package:cake_wallet/entities/transaction_description.dart';
7
import 'package:cake_wallet/entities/transaction_info.dart';
8
import 'package:cake_wallet/monero/monero_wallet_service.dart';
9
import 'package:cake_wallet/entities/contact.dart';
10
import 'package:cake_wallet/entities/node.dart';
11
import 'package:cake_wallet/exchange/trade.dart';
12
+import 'package:cake_wallet/reactions/on_authentication_state_change.dart';
13
14
import 'package:cake_wallet/src/screens/contact/contact_list_page.dart';
15
import 'package:cake_wallet/src/screens/contact/contact_page.dart';
@@ -199,6 +201,11 @@ Future setup(
201
}
202
203
authPageState.changeProcessText('Loading the wallet');
204
+
205
+ if (loginError != null) {
206
+ authPageState.changeProcessText('ERROR: ${loginError.toString()}');
207
+ }
208
+
209
ReactionDisposer _reaction;
210
_reaction = reaction((_) => appStore.wallet, (Object _) {
211
_reaction?.reaction?.dispose();
lib/monero/monero_wallet_service.dart
+8
-8
@@ -103,15 +103,15 @@ class MoneroWalletService extends WalletService<
103
final isValid = await wallet.validate();
104
105
if (!isValid) {
106
- if (wallet.seed?.isNotEmpty ?? false) {
106
+ // if (wallet.seed?.isNotEmpty ?? false) {
107
// let restore from seed in this case;
108
- final seed = wallet.seed;
109
- final credentials = MoneroRestoreWalletFromSeedCredentials(
110
- name: name, password: password, mnemonic: seed, height: 2000000)
111
- ..walletInfo = walletInfo;
112
- await remove(name);
113
- return restoreFromSeed(credentials);
114
- }
108
+ // final seed = wallet.seed;
109
+ // final credentials = MoneroRestoreWalletFromSeedCredentials(
110
+ // name: name, password: password, mnemonic: seed, height: 2000000)
111
+ // ..walletInfo = walletInfo;
112
+ // await remove(name);
113
+ // return restoreFromSeed(credentials);
114
+ // }
115
116
throw MoneroWalletLoadingException();
117
}
lib/reactions/on_authentication_state_change.dart
+7
-1
@@ -7,13 +7,19 @@ import 'package:cake_wallet/store/authentication_store.dart';
7
8
ReactionDisposer _onAuthenticationStateChange;
9
10
+dynamic loginError;
11
+
12
void startAuthenticationStateChange(AuthenticationStore authenticationStore,
13
@required GlobalKey<NavigatorState> navigatorKey) {
14
_onAuthenticationStateChange ??= autorun((_) async {
15
final state = authenticationStore.state;
16
17
if (state == AuthenticationState.installed) {
16
- await loadCurrentWallet();
18
+ try {
19
+ await loadCurrentWallet();
20
+ } catch(e) {
21
+ loginError = e;
22
+ }
23
return;
24
}
25