make notification messages simpler
MODIFY
WalletWasabi.Fluent/Converters/MoneyConverters.cs
WalletWasabi.Fluent/Converters/MoneyConverters.cs
-using System;
using Avalonia.Data.Converters;
using NBitcoin;
+using WalletWasabi.Fluent.Helpers;
namespace WalletWasabi.Fluent.Converters
{
@@ -14,30 +14,6 @@ namespace WalletWasabi.Fluent.Converters
});
public static readonly IValueConverter ToFormattedString =
- new FuncValueConverter<Money?, string>(money =>
- {
- if (money is null)
- {
- return "";
- }
-
- const int WholeGroupSize = 3;
-
- var moneyString = money.ToString();
-
- moneyString = moneyString.Insert(moneyString.Length - 4, " ");
-
- var startIndex = moneyString.IndexOf(".", StringComparison.Ordinal) - WholeGroupSize;
-
- if (startIndex > 0)
- {
- for (var i = startIndex; i > 0; i -= WholeGroupSize)
- {
- moneyString = moneyString.Insert(i, " ");
- }
- }
-
- return moneyString;
- });
+ new FuncValueConverter<Money?, string>(money => money is null ? "" : money.ToFormattedString());
}
}

MODIFY
WalletWasabi.Fluent/Helpers/TransactionHelpers.cs
WalletWasabi.Fluent/Helpers/TransactionHelpers.cs
@@ -66,11 +66,6 @@ namespace WalletWasabi.Fluent.Helpers
try
{
- // ToDo
- // Double spent.
- // Anonymity set gained?
- // Received dust
-
bool isSpent = result.NewlySpentCoins.Any();
bool isReceived = result.NewlyReceivedCoins.Any();
bool isConfirmedReceive = result.NewlyConfirmedReceivedCoins.Any();
@@ -83,7 +78,7 @@ namespace WalletWasabi.Fluent.Helpers
Money spentSum = result.NewlySpentCoins.Sum(x => x.Amount);
Money incoming = receivedSum - spentSum;
Money receiveSpentDiff = incoming.Abs();
- string amountString = receiveSpentDiff.ToString(false, true);
+ string amountString = receiveSpentDiff.ToFormattedString();
message = $"{amountString} BTC";
if (result.Transaction.Transaction.IsCoinBase)
@@ -97,26 +92,11 @@ namespace WalletWasabi.Fluent.Helpers
}
else if (incoming > Money.Zero)
{
- if (result.Transaction.IsRBF && result.Transaction.IsReplacement)
- {
- title = "Received Replaceable Replacement Transaction";
- }
- else if (result.Transaction.IsRBF)
- {
- title = "Received Replaceable Transaction";
- }
- else if (result.Transaction.IsReplacement)
- {
- title = "Received Replacement Transaction";
- }
- else
- {
- title = "Received";
- }
+ title = "Transaction Received";
}
else if (incoming < Money.Zero)
{
- title = "Sent";
+ title = "Transaction Sent";
}
}
else if (isConfirmedReceive || isConfirmedSpent)
@@ -125,7 +105,7 @@ namespace WalletWasabi.Fluent.Helpers
Money spentSum = result.SpentCoins.Sum(x => x.Amount);
Money incoming = receivedSum - spentSum;
Money receiveSpentDiff = incoming.Abs();
- string amountString = receiveSpentDiff.ToString(false, true);
+ string amountString = receiveSpentDiff.ToFormattedString();
message = $"{amountString} BTC";
if (isConfirmedSpent && receiveSpentDiff == miningFee)

make notification messages simpler