tidy change avoidance and pocket selection suggestions.
DELETE
WalletWasabi.Fluent/Models/PrivacySuggestionBenefit.cs
-namespace WalletWasabi.Fluent.Models
-{
- public record PrivacySuggestionBenefit(bool Highlight, string Message);
-}
\ No newline at end of file

MODIFY
WalletWasabi.Fluent/ViewModels/Wallets/Send/ChangeAvoidanceSuggestionViewModel.cs
WalletWasabi.Fluent/ViewModels/Wallets/Send/ChangeAvoidanceSuggestionViewModel.cs
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
-using JetBrains.Annotations;
using NBitcoin;
using WalletWasabi.Blockchain.TransactionBuilding;
using WalletWasabi.Fluent.Helpers;
-using WalletWasabi.Fluent.Models;
using WalletWasabi.Wallets;
namespace WalletWasabi.Fluent.ViewModels.Wallets.Send;
@@ -14,42 +12,27 @@ public partial class ChangeAvoidanceSuggestionViewModel : SuggestionViewModel
{
[AutoNotify] private string _amount;
[AutoNotify] private string _amountFiat;
- [AutoNotify] private List<PrivacySuggestionBenefit> _benefits;
- [AutoNotify] private PrivacyOptimisationLevel _optimisationLevel;
- [AutoNotify] private bool _optimisationLevelGood;
+ [AutoNotify] private string _differenceFiat;
public ChangeAvoidanceSuggestionViewModel(decimal originalAmount,
BuildTransactionResult transactionResult,
- PrivacyOptimisationLevel optimisationLevel,
decimal fiatExchangeRate,
- bool isOriginal,
- params PrivacySuggestionBenefit[] benefits) : base(transactionResult, isOriginal)
+ bool isOriginal) : base(transactionResult, isOriginal)
{
- _optimisationLevel = optimisationLevel;
- _benefits = benefits.ToList();
-
decimal total = transactionResult.CalculateDestinationAmount().ToDecimal(MoneyUnit.BTC);
_amountFiat = total.GenerateFiatText(fiatExchangeRate, "USD");
- _optimisationLevelGood = optimisationLevel == PrivacyOptimisationLevel.Better;
- if (_optimisationLevelGood)
+ if(!isOriginal)
{
var fiatTotal = total * fiatExchangeRate;
var fiatOriginal = originalAmount * fiatExchangeRate;
var fiatDifference = fiatTotal - fiatOriginal;
- var difference = (fiatDifference > 0
+ _differenceFiat = (fiatDifference > 0
? $"{fiatDifference.GenerateFiatText("USD")} More"
: $"{Math.Abs(fiatDifference).GenerateFiatText("USD")} Less")
.Replace("(", "").Replace(")", "");
-
- _benefits.Add(new PrivacySuggestionBenefit(false, difference));
- }
- else
- {
- // This is just to pad the control.
- _benefits.Add(new PrivacySuggestionBenefit(false, " "));
}
_amount = $"{total}";
@@ -110,13 +93,12 @@ public partial class ChangeAvoidanceSuggestionViewModel : SuggestionViewModel
smallerSuggestion = new ChangeAvoidanceSuggestionViewModel(
transactionInfo.Amount.ToDecimal(MoneyUnit.BTC), smallerTransaction,
- PrivacyOptimisationLevel.Better, wallet.Synchronizer.UsdExchangeRate, false);
+ wallet.Synchronizer.UsdExchangeRate, false);
}
var defaultSelection = new ChangeAvoidanceSuggestionViewModel(
transactionInfo.Amount.ToDecimal(MoneyUnit.BTC), requestedTransaction,
- PrivacyOptimisationLevel.Standard, wallet.Synchronizer.UsdExchangeRate, true,
- new PrivacySuggestionBenefit(false, "As Requested"));
+ wallet.Synchronizer.UsdExchangeRate, true);
var largerTransaction = await Task.Run(() => wallet.BuildTransaction(
wallet.Kitchen.SaltSoup(),
@@ -127,7 +109,7 @@ public partial class ChangeAvoidanceSuggestionViewModel : SuggestionViewModel
var largerSuggestion = new ChangeAvoidanceSuggestionViewModel(
transactionInfo.Amount.ToDecimal(MoneyUnit.BTC), largerTransaction,
- PrivacyOptimisationLevel.Better, wallet.Synchronizer.UsdExchangeRate, false);
+ wallet.Synchronizer.UsdExchangeRate, false);
// There are several scenarios, both the alternate suggestions are <, or >, or 1 < and 1 >.
// We sort them and add the suggestions accordingly.

DELETE
WalletWasabi.Fluent/ViewModels/Wallets/Send/PrivacyOptimisationLevel.cs
-namespace WalletWasabi.Fluent.ViewModels.Wallets.Send;
-
-public enum PrivacyOptimisationLevel
-{
- Standard,
- Better
-}
\ No newline at end of file

MODIFY
WalletWasabi.Fluent/Views/Wallets/Send/ChangeAvoidanceSuggestionControl.axaml
WalletWasabi.Fluent/Views/Wallets/Send/ChangeAvoidanceSuggestionControl.axaml
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:conv="using:WalletWasabi.Fluent.Converters"
xmlns:vm="using:WalletWasabi.Fluent.ViewModels.Wallets.Send"
- xmlns:models="clr-namespace:WalletWasabi.Fluent.Models"
mc:Ignorable="d" d:DesignWidth="300" d:DesignHeight="450"
x:DataType="vm:ChangeAvoidanceSuggestionViewModel"
- x:CompileBindings="True"
ClipToBounds="False"
-
+ x:CompileBindings="True"
x:Class="WalletWasabi.Fluent.Views.Wallets.Send.ChangeAvoidanceSuggestionControl">
<Panel>
<Border Name="PART_DecorationBorder" />
<StackPanel Spacing="10" VerticalAlignment="Top">
<Panel>
<PathIcon Data="{StaticResource paper_cash_regular}" Height="25" Width="25"
- Foreground="{DynamicResource TextForegroundColor}" />
-
- <Viewbox IsVisible="{Binding OptimisationLevelGood}" Height="24" Width="24" Margin="0 0 10 2"
- HorizontalAlignment="Right" VerticalAlignment="Bottom">
- <Panel>
- <Path
- Data="m 64.9375 11.75 c -9.9878 0 -19.7174 -3.53804 -29.25 -10.6875 -1 -0.75 -2.375 -0.75 -3.375 0 C 22.7799 8.21196 13.0503 11.75 3.0625 11.75 1.5092 11.75 0.25 13.0092 0.25 14.5625 V 34.25 c 0 18.7545 11.0909 32.534 32.7192 41.0543 0.6624 0.2609 1.3992 0.2609 2.0616 0 C 56.6591 66.784 67.75 53.0045 67.75 34.25 V 14.5625 c 0 -1.5533 -1.2592 -2.8125 -2.8125 -2.8125 z">
- <Path.Fill>
- <LinearGradientBrush StartPoint="0%,1%" EndPoint="100%,100%">
- <LinearGradientBrush.GradientStops>
- <GradientStop Color="#97D234" />
- <GradientStop Color="#7FAF2F" Offset="1" />
- </LinearGradientBrush.GradientStops>
- </LinearGradientBrush>
- </Path.Fill>
- </Path>
+ Foreground="{DynamicResource SystemAccentColor}" />
</Panel>
- </Viewbox>
- </Panel>
-
- <TextBlock TextWrapping="Wrap" Text="Your transaction will create change on the blockchain. Avoiding this improves your privacy. Instead you could..." />
- <TextBlock Text="Send:" FontSize="12" Opacity="0.8" />
- <TextBlock Text="{Binding Amount}" FontSize="20" HorizontalAlignment="Center" />
+ <TextBlock TextWrapping="Wrap" Text="Avoid change on the Blockchain by:" TextAlignment="Center" />
+ <Separator Margin="0 10" />
+ <StackPanel Spacing="10">
+ <TextBlock Text="Sending" FontSize="12" Opacity="0.8" TextAlignment="Center" />
+ <TextBlock Text="{Binding DifferenceFiat}" FontSize="20" HorizontalAlignment="Center" Foreground="{DynamicResource SystemAccentColor}" />
+ <TextBlock Text="{Binding Amount}" FontSize="12" HorizontalAlignment="Center" Opacity="0.6" />
<TextBlock Text="{Binding AmountFiat}" FontSize="12" HorizontalAlignment="Center" Opacity="0.6" />
</StackPanel>
+ </StackPanel>
</Panel>
- <Separator Height="1" Background="{DynamicResource SeparatorBackgroundBrush}" Opacity="0.2" />
- <ItemsControl HorizontalAlignment="Center" Items="{Binding Benefits}">
- <ItemsControl.Styles>
- <Style Selector="TextBlock">
- <Setter Property="Opacity" Value="0.6" />
- <Setter Property="TextWrapping" Value="Wrap" />
- </Style>
- </ItemsControl.Styles>
- <ItemsControl.ItemTemplate>
- <DataTemplate x:DataType="models:PrivacySuggestionBenefit">
- <Panel HorizontalAlignment="Center">
- <TextBlock IsVisible="{Binding !Highlight}" Text="{Binding Message}" />
- <TextBlock IsVisible="{Binding Highlight}" Foreground="{DynamicResource SystemAccentColor}"
- Text="{Binding Message}" />
- </Panel>
- </DataTemplate>
- </ItemsControl.ItemTemplate>
- <ItemsControl.ItemsPanel>
- <ItemsPanelTemplate>
- <StackPanel Spacing="5" />
- </ItemsPanelTemplate>
- </ItemsControl.ItemsPanel>
- </ItemsControl>
</StackPanel>
</Border>
</Panel>

MODIFY
WalletWasabi.Fluent/Views/Wallets/Send/PocketSuggestionControl.axaml
WalletWasabi.Fluent/Views/Wallets/Send/PocketSuggestionControl.axaml
<Border Name="PART_MainContentBorder">
<StackPanel Spacing="20">
<PathIcon DockPanel.Dock="Top" Data="{StaticResource incognito_filled}" Height="25" Width="25"
- Foreground="{DynamicResource TextForegroundColor}" />
+ Foreground="{DynamicResource SystemAccentColor}" />
<TextBlock HorizontalAlignment="Center" TextWrapping="Wrap" Text="Various people or companies could become aware of this transaction including..." />

MODIFY
WalletWasabi.Fluent/Views/Wallets/Send/TransactionPreviewView.axaml
WalletWasabi.Fluent/Views/Wallets/Send/TransactionPreviewView.axaml
<Border.Styles>
<Style Selector="FlyoutPresenter">
<Setter Property="MaxWidth" Value="1000" />
+ <Setter Property="Background" Value="White" />
</Style>
</Border.Styles>
<Interaction.Behaviors>

tidy change avoidance and pocket selection suggestions.