Fixes for gray screen bug.

This commit is contained in:
M
2020-10-01 19:46:23 +03:00
parent 606f4e59c5
commit 2eb229b91e
5 changed files with 36 additions and 7 deletions
+19 -4
View File
@@ -61,6 +61,7 @@ import 'package:cake_wallet/view_model/exchange/exchange_view_model.dart';
import 'package:flutter/widgets.dart';
import 'package:get_it/get_it.dart';
import 'package:hive/hive.dart';
import 'package:mobx/mobx.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
import 'package:cake_wallet/view_model/wallet_restoration_from_seed_vm.dart';
@@ -177,11 +178,25 @@ Future setup(
BiometricAuth()));
getIt.registerFactory<AuthPage>(
() => AuthPage(getIt.get<AuthViewModel>(),
onAuthenticationFinished: (isAuthenticated, __) {
if (isAuthenticated) {
getIt.get<AuthenticationStore>().allowed();
() => AuthPage(getIt.get<AuthViewModel>(), onAuthenticationFinished:
(isAuthenticated, AuthPageState authPageState) {
if (!isAuthenticated) {
return;
}
final authStore = getIt.get<AuthenticationStore>();
final appStore = getIt.get<AppStore>();
if (appStore.wallet != null) {
authStore.allowed();
return;
}
authPageState.changeProcessText('Loading the wallet');
ReactionDisposer _reaction;
_reaction = reaction((_) => appStore.wallet, (Object _) {
_reaction?.reaction?.dispose();
authStore.allowed();
});
}, closable: false),
instanceName: 'login');
+12 -1
View File
@@ -19,6 +19,7 @@ import 'package:cake_wallet/entities/wallet_info.dart';
import 'package:cake_wallet/entities/node.dart';
import 'package:cake_wallet/entities/transaction_priority.dart';
part 'monero_wallet.g.dart';
const moneroBlockSize = 1000;
@@ -40,6 +41,7 @@ abstract class MoneroWalletBase extends WalletBase<MoneroBalance> with Store {
subaddress = subaddressList.subaddresses.first;
address = subaddress.address;
});
_cachedRefreshHeight = 0;
}
@override
@@ -80,6 +82,7 @@ abstract class MoneroWalletBase extends WalletBase<MoneroBalance> with Store {
String _filename;
SyncListner _listener;
ReactionDisposer _onAccountChangeReaction;
int _cachedRefreshHeight;
Future<void> init() async {
await accountList.update();
@@ -177,7 +180,9 @@ abstract class MoneroWalletBase extends WalletBase<MoneroBalance> with Store {
@override
Future<void> save() async {
print('SAVE CALLED');
await monero_wallet.store();
print('SAVE FINISHED');
}
Future<int> getNodeHeight() async => monero_wallet.getNodeHeight();
@@ -191,12 +196,15 @@ abstract class MoneroWalletBase extends WalletBase<MoneroBalance> with Store {
@override
Future<void> rescan({int height}) async {
walletInfo.restoreHeight = height;
walletInfo.isRecovery = true;
monero_wallet.setRefreshFromBlockHeight(height: height);
monero_wallet.rescanBlockchainAsync();
await startSync();
_askForUpdateBalance();
await _askForUpdateTransactionHistory();
await save();
await walletInfo.save();
}
void _setListeners() {
@@ -284,7 +292,10 @@ abstract class MoneroWalletBase extends WalletBase<MoneroBalance> with Store {
await setAsRecovered();
}
await save();
if (currentHeight - _cachedRefreshHeight > moneroBlockSize) {
_cachedRefreshHeight = currentHeight;
await save();
}
}
void _onNewTransaction() {
+1 -1
View File
@@ -87,8 +87,8 @@ class WalletMenu {
rightButtonText: S.of(context).ok,
leftButtonText: S.of(context).cancel,
actionRightButton: () async {
await reconnect?.call();
Navigator.of(context).pop();
await reconnect?.call();
},
actionLeftButton: () => Navigator.of(context).pop());
});