mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-12-22 11:39:22 +00:00
Fixes for gray screen bug.
This commit is contained in:
parent
606f4e59c5
commit
2eb229b91e
5 changed files with 36 additions and 7 deletions
|
@ -175,6 +175,7 @@ extern "C"
|
|||
Monero::SubaddressAccount *m_account;
|
||||
uint64_t m_last_known_wallet_height;
|
||||
uint64_t m_cached_syncing_blockchain_height = 0;
|
||||
std::mutex store_mutex;
|
||||
|
||||
|
||||
void change_current_wallet(Monero::Wallet *wallet)
|
||||
|
@ -293,6 +294,7 @@ extern "C"
|
|||
|
||||
void load_wallet(char *path, char *password, int32_t nettype)
|
||||
{
|
||||
nice(19);
|
||||
Monero::NetworkType networkType = static_cast<Monero::NetworkType>(nettype);
|
||||
Monero::Wallet *wallet = Monero::WalletManagerFactory::getWalletManager()->openWallet(std::string(path), std::string(password), networkType);
|
||||
change_current_wallet(wallet);
|
||||
|
@ -429,7 +431,9 @@ extern "C"
|
|||
|
||||
void store(char *path)
|
||||
{
|
||||
store_mutex.lock();
|
||||
get_current_wallet()->store(std::string(path));
|
||||
store_mutex.unlock();
|
||||
}
|
||||
|
||||
bool transaction_create(char *address, char *payment_id, char *amount,
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
4dc2ef1ba73deeed13cd85894dacb10b
|
23
lib/di.dart
23
lib/di.dart
|
@ -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');
|
||||
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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());
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue