Handle number of privacy chars
MODIFY
WalletWasabi.Fluent/ViewModels/Wallets/Home/History/HistoryViewModel.cs
WalletWasabi.Fluent/ViewModels/Wallets/Home/History/HistoryViewModel.cs
@@ -101,7 +101,8 @@ public partial class HistoryViewModel : ActivatableViewModel
CompareDescending = HistoryItemViewModelBase.SortDescending(x => x.Date),
MinWidth = new GridLength(150, GridUnitType.Pixel)
},
- width: new GridLength(0, GridUnitType.Auto)),
+ width: new GridLength(0, GridUnitType.Auto),
+ numberOfPrivacyChars: 15),
// Labels
new TemplateColumn<HistoryItemViewModelBase>(
@@ -130,7 +131,8 @@ public partial class HistoryViewModel : ActivatableViewModel
MinWidth = new GridLength(120, GridUnitType.Pixel),
MaxWidth = new GridLength(150, GridUnitType.Pixel)
},
- width: new GridLength(0, GridUnitType.Auto)),
+ width: new GridLength(0, GridUnitType.Auto),
+ numberOfPrivacyChars: 9),
// Outgoing
// new TemplateColumn<HistoryItemViewModelBase>(
@@ -147,7 +149,8 @@ public partial class HistoryViewModel : ActivatableViewModel
MinWidth = new GridLength(120, GridUnitType.Pixel),
MaxWidth = new GridLength(150, GridUnitType.Pixel)
},
- width: new GridLength(0, GridUnitType.Auto)),
+ width: new GridLength(0, GridUnitType.Auto),
+ numberOfPrivacyChars: 9),
// Balance
// new TemplateColumn<HistoryItemViewModelBase>(
@@ -161,10 +164,11 @@ public partial class HistoryViewModel : ActivatableViewModel
CanUserSortColumn = true,
CompareAscending = HistoryItemViewModelBase.SortAscending(x => x.Balance),
CompareDescending = HistoryItemViewModelBase.SortDescending(x => x.Balance),
- MinWidth = new GridLength(120, GridUnitType.Pixel),
+ MinWidth = new GridLength(150, GridUnitType.Pixel),
MaxWidth = new GridLength(150, GridUnitType.Pixel)
},
- width: new GridLength(0, GridUnitType.Auto)),
+ width: new GridLength(0, GridUnitType.Auto),
+ numberOfPrivacyChars: 9),
}
};

MODIFY
WalletWasabi.Fluent/Views/Wallets/Home/History/Columns/CustomDrawCells.cs
WalletWasabi.Fluent/Views/Wallets/Home/History/Columns/CustomDrawCells.cs
@@ -17,9 +17,14 @@ namespace WalletWasabi.Fluent.Views.Wallets.Home.History.Columns;
internal class PrivacyTextCell : ICell
{
- public PrivacyTextCell(string? value) => Value = value;
+ public PrivacyTextCell(string? value, int numberOfPrivacyChars)
+ {
+ Value = value;
+ NumberOfPrivacyChars = numberOfPrivacyChars;
+ }
public bool CanEdit => false;
public string? Value { get; }
+ public int NumberOfPrivacyChars { get; }
object? ICell.Value => Value;
}
@@ -28,22 +33,25 @@ internal class PrivacyTextColumn : ColumnBase<HistoryItemViewModelBase>
private readonly Func<HistoryItemViewModelBase, string?> _getter;
private readonly Comparison<HistoryItemViewModelBase?>? _sortAscending;
private readonly Comparison<HistoryItemViewModelBase?>? _sortDescending;
+ private readonly int _numberOfPrivacyChars;
public PrivacyTextColumn(
object? header,
Func<HistoryItemViewModelBase, string?> getter,
GridLength? width,
- ColumnOptions<HistoryItemViewModelBase>? options)
+ ColumnOptions<HistoryItemViewModelBase>? options,
+ int numberOfPrivacyChars = 0)
: base(header, width, options)
{
_sortAscending = options?.CompareAscending;
_sortDescending = options?.CompareDescending;
_getter = getter;
+ _numberOfPrivacyChars = numberOfPrivacyChars;
}
public override ICell CreateCell(IRow<HistoryItemViewModelBase> row)
{
- return new PrivacyTextCell(_getter(row.Model));
+ return new PrivacyTextCell(_getter(row.Model), _numberOfPrivacyChars);
}
public override Comparison<HistoryItemViewModelBase?>? GetComparison(ListSortDirection direction)
@@ -59,17 +67,21 @@ internal class PrivacyTextColumn : ColumnBase<HistoryItemViewModelBase>
internal class TreeDataGridPrivacyTextCell : TreeDataGridCell
{
- private static List<TreeDataGridPrivacyTextCell> Realized = new List<TreeDataGridPrivacyTextCell>();
+ private static List<TreeDataGridPrivacyTextCell> Realized = new();
private static IDisposable? Subscription;
private static bool IsContentVisible = true;
private string? _value;
private FormattedText? _formattedText;
+ private int _numberOfPrivacyChars;
- public string? Text => IsContentVisible ? _value : new string('#', _value?.Length ?? 0);
+ public string? Text => IsContentVisible ? _value : new string('#', _value is not null ? _numberOfPrivacyChars : 0);
public override void Realize(IElementFactory factory, ICell model, int columnIndex, int rowIndex)
{
- var text = ((PrivacyTextCell)model).Value;
+ var privacyTextCell = (PrivacyTextCell)model;
+ var text = privacyTextCell.Value;
+
+ _numberOfPrivacyChars = privacyTextCell.NumberOfPrivacyChars;
if (text != _value)
{

Handle number of privacy chars