v4.25.0 Release Candidate (#2153)

* v4.25.0 Release Candidate

* update rest of platforms version [skip ci]

* replace macos icons [skip ci]

* fix: incorrect balance reporting (#2155)

* fix: monero frozen coins, call updateSendingBalance, display "ALL" balance properly

* fix: decred formatting on send page

---------

Co-authored-by: cyan <cyjan@mrcyjanek.net>
This commit is contained in:
Omar Hatem
2025-04-04 00:49:44 +02:00
committed by GitHub
co-authored by cyan
parent 2b493ff6dc
commit 24ec5fa7fd
21 changed files with 99 additions and 79 deletions
@@ -45,20 +45,17 @@ class TransactionsPage extends StatelessWidget {
Observer(builder: (_) {
final status = dashboardViewModel.status;
if (status is SyncingSyncStatus) {
return Padding(
padding: const EdgeInsets.fromLTRB(24, 0, 24, 8),
child: DashBoardRoundedCardWidget(
key: ValueKey('transactions_page_syncing_alert_card_key'),
onTap: () {
try {
final uri = Uri.parse(
"https://docs.cakewallet.com/faq/funds-not-appearing");
launchUrl(uri, mode: LaunchMode.externalApplication);
} catch (_) {}
},
title: S.of(context).syncing_wallet_alert_title,
subTitle: S.of(context).syncing_wallet_alert_content,
),
return DashBoardRoundedCardWidget(
key: ValueKey('transactions_page_syncing_alert_card_key'),
onTap: () {
try {
final uri = Uri.parse(
"https://docs.cakewallet.com/faq/funds-not-appearing");
launchUrl(uri, mode: LaunchMode.externalApplication);
} catch (_) {}
},
title: S.of(context).syncing_wallet_alert_title,
subTitle: S.of(context).syncing_wallet_alert_content,
);
} else {
return Container();
@@ -72,7 +69,6 @@ class TransactionsPage extends StatelessWidget {
child: Observer(
builder: (_) {
final items = dashboardViewModel.items;
final amount = items.length + 1;
return items.isNotEmpty
? ListView.builder(
key: ValueKey('transactions_page_list_view_builder_key'),
+38 -26
View File
@@ -94,6 +94,9 @@ class SendCardState extends State<SendCard> with AutomaticKeepAliveClientMixin<S
@override
void initState() {
super.initState();
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
sendViewModel.updateSendingBalance();
});
/// if the current wallet doesn't match the one in the qr code
if (initialPaymentRequest != null &&
@@ -244,38 +247,47 @@ class SendCardState extends State<SendCard> with AutomaticKeepAliveClientMixin<S
currencyValueValidator: output.sendAll
? sendViewModel.allAmountValidator
: sendViewModel.amountValidator,
allAmountCallback: () async => output.setSendAll(sendViewModel.sendingBalance)),
allAmountCallback: () async => output.setSendAll(await sendViewModel.sendingBalance)),
Divider(
height: 1,
color: Theme.of(context).extension<SendPageTheme>()!.textFieldHintColor),
Observer(
builder: (_) => Padding(
padding: EdgeInsets.only(top: 10),
child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Expanded(
child: Text(
S.of(context).available_balance + ':',
style: TextStyle(
builder: (_) {
// force rebuild on mobx
final _ = sendViewModel.coinTypeToSpendFrom;
return Padding(
padding: EdgeInsets.only(top: 10),
child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Expanded(
child: Text(
S.of(context).available_balance + ':',
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.w600,
color:
Theme.of(context).extension<SendPageTheme>()!.textFieldHintColor),
),
),
FutureBuilder<String>(
future: sendViewModel.sendingBalance,
builder: (context, snapshot) {
return Text(
snapshot.data ?? sendViewModel.balance, // default to balance while loading
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.w600,
color:
Theme.of(context).extension<SendPageTheme>()!.textFieldHintColor),
),
),
Text(
sendViewModel.sendingBalance,
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.w600,
color:
Theme.of(context).extension<SendPageTheme>()!.textFieldHintColor),
)
],
),
),
);
},
)
],
),
);
},
),
if (!sendViewModel.isFiatDisabled)
CurrencyAmountTextField(
@@ -509,9 +521,9 @@ class SendCardState extends State<SendCard> with AutomaticKeepAliveClientMixin<S
}
});
reaction((_) => sendViewModel.selectedCryptoCurrency, (Currency currency) {
reaction((_) => sendViewModel.selectedCryptoCurrency, (Currency currency) async {
if (output.sendAll) {
output.setSendAll(sendViewModel.sendingBalance);
output.setSendAll(await sendViewModel.sendingBalance);
}
output.setCryptoAmount(cryptoAmountController.text);
+2 -2
View File
@@ -245,7 +245,7 @@ abstract class SendViewModelBase extends WalletChangeListenerViewModel with Stor
}
@computed
String get sendingBalance {
Future<String> get sendingBalance async {
// only for electrum, monero, wownero, decred wallets atm:
switch (wallet.type) {
case WalletType.bitcoin:
@@ -255,7 +255,7 @@ abstract class SendViewModelBase extends WalletChangeListenerViewModel with Stor
case WalletType.wownero:
case WalletType.decred:
return wallet.formatCryptoAmount(
unspentCoinsListViewModel.getSendingBalance(coinTypeToSpendFrom).toString());
(await unspentCoinsListViewModel.getSendingBalance(coinTypeToSpendFrom)).toString());
default:
return balance;
}
@@ -149,12 +149,15 @@ abstract class UnspentCoinsListViewModelBase with Store {
}
@action
int getSendingBalance(UnspentCoinType overrideCoinTypeToSpendFrom) {
Future<int> getSendingBalance(UnspentCoinType overrideCoinTypeToSpendFrom) async {
// return items.where((element) => element.isSending).fold(0, (previousValue, element) => previousValue + element.value);
// go through all unspent coins and add up the value minus frozen and non sending:
int total = 0;
await _updateUnspents();
Set<String> seen = {};
for (final item in _getSpecificUnspents(overrideCoinTypeToSpendFrom)) {
if (seen.contains(item.hash)) continue;
seen.add(item.hash);
if (item.isFrozen || !item.isSending) continue;
total += item.value;
}