CW-846: Correctly display balance (#1848)

* Correctly display balance even with frozen coins * remove package= from AndroidMainfest.xml * update namespace

cyan committed Dec 4, 2024 at 07:01 UTC 9fcbc4d72a9d1b763f8fdfc21071f6024e1b4630
4 files changed +7 -8
android/app/src/debug/AndroidManifest.xml
+1 -2
@@ -1,5 +1,4 @@
1 -<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2 - package="com.cakewallet.cake_wallet">
1 +<manifest xmlns:android="http://schemas.android.com/apk/res/android">
2 <!-- Flutter needs it to communicate with the running application
3 to allow setting breakpoints, to provide hot reload, etc.
4 -->
android/app/src/profile/AndroidManifest.xml
+1 -2
@@ -1,5 +1,4 @@
1 -<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2 - package="com.cakewallet.cake_wallet">
1 +<manifest xmlns:android="http://schemas.android.com/apk/res/android">
2 <!-- Flutter needs it to communicate with the running application
3 to allow setting breakpoints, to provide hot reload, etc.
4 -->
cw_core/lib/monero_balance.dart
+2 -2
@@ -3,8 +3,8 @@ import 'package:cw_core/monero_amount_format.dart';
3
4 class MoneroBalance extends Balance {
5 MoneroBalance({required this.fullBalance, required this.unlockedBalance, this.frozenBalance = 0})
6 - : formattedFullBalance = moneroAmountToString(amount: fullBalance),
7 - formattedUnlockedBalance = moneroAmountToString(amount: unlockedBalance - frozenBalance),
6 + : formattedFullBalance = moneroAmountToString(amount: frozenBalance + fullBalance),
7 + formattedUnlockedBalance = moneroAmountToString(amount: unlockedBalance),
8 formattedLockedBalance =
9 moneroAmountToString(amount: frozenBalance + fullBalance - unlockedBalance),
10 super(unlockedBalance, fullBalance);
cw_monero/lib/monero_wallet.dart
+3 -2
@@ -725,8 +725,9 @@ abstract class MoneroWalletBase extends WalletBase<MoneroBalance,
725
726 void _askForUpdateBalance() {
727 final unlockedBalance = _getUnlockedBalance();
728 - final fullBalance = _getUnlockedBalance() + _getFrozenBalance();
729 - final frozenBalance = 0; // this is calculated on the monero side now
728 + final fullBalance = monero_wallet.getFullBalance(
729 + accountIndex: walletAddresses.account!.id);
730 + final frozenBalance = _getFrozenBalance();
731 if (balance[currency]!.fullBalance != fullBalance ||
732 balance[currency]!.unlockedBalance != unlockedBalance ||
733 balance[currency]!.frozenBalance != frozenBalance) {