mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-01-11 05:04:35 +00:00
avoid updating wallet info before finishing opening
remove unused var
This commit is contained in:
parent
11f55fb6d1
commit
f52b950650
3 changed files with 12 additions and 0 deletions
|
@ -55,6 +55,7 @@ class MoneroWallet extends CryptonoteWallet with CwBasedInterface {
|
|||
|
||||
@override
|
||||
Future<void> exitCwWallet() async {
|
||||
walletOpen = false;
|
||||
(cwWalletBase as MoneroWalletBase?)?.onNewBlock = null;
|
||||
(cwWalletBase as MoneroWalletBase?)?.onNewTransaction = null;
|
||||
(cwWalletBase as MoneroWalletBase?)?.syncStatusChanged = null;
|
||||
|
@ -63,6 +64,8 @@ class MoneroWallet extends CryptonoteWallet with CwBasedInterface {
|
|||
|
||||
@override
|
||||
Future<void> open() async {
|
||||
walletOpen = false;
|
||||
|
||||
String? password;
|
||||
try {
|
||||
password = await cwKeysStorage.getWalletPassword(walletName: walletId);
|
||||
|
@ -87,6 +90,8 @@ class MoneroWallet extends CryptonoteWallet with CwBasedInterface {
|
|||
const Duration(seconds: 193),
|
||||
(_) async => await cwWalletBase?.save(),
|
||||
);
|
||||
|
||||
walletOpen = true;
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -152,6 +157,8 @@ class MoneroWallet extends CryptonoteWallet with CwBasedInterface {
|
|||
|
||||
@override
|
||||
Future<void> updateTransactions() async {
|
||||
if (!walletOpen) return;
|
||||
|
||||
await (cwWalletBase as MoneroWalletBase?)?.updateTransactions();
|
||||
final transactions =
|
||||
(cwWalletBase as MoneroWalletBase?)?.transactionHistory?.transactions;
|
||||
|
|
|
@ -7,6 +7,8 @@ abstract class CryptonoteWallet<T extends CryptonoteCurrency> extends Wallet<T>
|
|||
with MnemonicInterface<T> {
|
||||
CryptonoteWallet(T currency) : super(currency);
|
||||
|
||||
bool walletOpen = false;
|
||||
|
||||
// ========== Overrides ======================================================
|
||||
|
||||
@override
|
||||
|
|
|
@ -244,6 +244,8 @@ mixin CwBasedInterface<T extends CryptonoteCurrency> on CryptonoteWallet<T>
|
|||
|
||||
@override
|
||||
Future<void> updateBalance() async {
|
||||
if (!walletOpen) return;
|
||||
|
||||
final total = await totalBalance;
|
||||
final available = await availableBalance;
|
||||
|
||||
|
@ -300,6 +302,7 @@ mixin CwBasedInterface<T extends CryptonoteCurrency> on CryptonoteWallet<T>
|
|||
@override
|
||||
Future<void> exit() async {
|
||||
if (!_hasCalledExit) {
|
||||
walletOpen = false;
|
||||
_hasCalledExit = true;
|
||||
autoSaveTimer?.cancel();
|
||||
await exitCwWallet();
|
||||
|
|
Loading…
Reference in a new issue