mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-23 06:38:35 +02:00
fix(cw_monero): prevent monero wallet from breaking during rename (#2214)
* fix(cw_monero): prevent monero wallet from breaking during rename * update to cleaned up monero.dart * fix: transaction screen not refreshing in monero * fix: wallets not opening until app restart after rename. * fix(cw_decred): wallet renaming throwing * fix: transaction not being shown after sending until 1st confirmation * fix(cw_monero): loop safeguard * fix: don't await wallet.fetchTransactions
This commit is contained in:
@@ -271,10 +271,19 @@ abstract class DashboardViewModelBase with Store {
|
||||
});
|
||||
|
||||
_transactionDisposer?.reaction.dispose();
|
||||
_transactionDisposer = reaction(
|
||||
(_) => appStore.wallet!.transactionHistory.transactions.length,
|
||||
_transactionDisposerCallback,
|
||||
);
|
||||
_transactionDisposer = reaction((_) {
|
||||
final length = appStore.wallet!.transactionHistory.transactions.length;
|
||||
if (length == 0) {
|
||||
return 0;
|
||||
}
|
||||
int confirmations = 1;
|
||||
if (![WalletType.solana, WalletType.tron].contains(wallet.type)) {
|
||||
try {
|
||||
confirmations = appStore.wallet!.transactionHistory.transactions.values.first.confirmations + 1;
|
||||
} catch (_) {}
|
||||
}
|
||||
return length * confirmations;
|
||||
}, _transactionDisposerCallback);
|
||||
|
||||
if (hasSilentPayments) {
|
||||
silentPaymentsScanningActive = bitcoin!.getScanningActive(wallet);
|
||||
@@ -891,8 +900,19 @@ abstract class DashboardViewModelBase with Store {
|
||||
|
||||
_transactionDisposer?.reaction.dispose();
|
||||
|
||||
_transactionDisposer = reaction((_) => appStore.wallet!.transactionHistory.transactions.length,
|
||||
_transactionDisposerCallback);
|
||||
_transactionDisposer = reaction((_) {
|
||||
final length = appStore.wallet!.transactionHistory.transactions.length;
|
||||
if (length == 0) {
|
||||
return 0;
|
||||
}
|
||||
int confirmations = 1;
|
||||
if (![WalletType.solana, WalletType.tron].contains(wallet.type)) {
|
||||
try {
|
||||
confirmations = appStore.wallet!.transactionHistory.transactions.values.first.confirmations + 1;
|
||||
} catch (_) {}
|
||||
}
|
||||
return length * confirmations;
|
||||
}, _transactionDisposerCallback);
|
||||
}
|
||||
|
||||
@action
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:cake_wallet/bitcoin/bitcoin.dart';
|
||||
import 'package:cake_wallet/core/address_validator.dart';
|
||||
import 'package:cake_wallet/core/amount_validator.dart';
|
||||
@@ -591,7 +593,7 @@ abstract class SendViewModelBase extends WalletChangeListenerViewModel with Stor
|
||||
}
|
||||
final sharedPreferences = await SharedPreferences.getInstance();
|
||||
await sharedPreferences.setString(PreferencesKey.backgroundSyncLastTrigger(wallet.name), DateTime.now().add(Duration(minutes: 1)).toIso8601String());
|
||||
|
||||
unawaited(wallet.fetchTransactions());
|
||||
state = TransactionCommitted();
|
||||
} catch (e) {
|
||||
state = FailureState(translateErrorMessage(e, wallet.type, wallet.currency));
|
||||
|
||||
Reference in New Issue
Block a user