rename AllPockets and AllLabels to be plural
MODIFY
WalletWasabi.Fluent/ViewModels/Wallets/Send/LabelSelectionViewModel.cs
WalletWasabi.Fluent/ViewModels/Wallets/Send/LabelSelectionViewModel.cs
@@ -23,17 +23,17 @@ public partial class LabelSelectionViewModel : ViewModelBase
_targetAmount = targetAmount;
}
- public Pocket[] AllPocket { get; set; } = Array.Empty<Pocket>();
+ public Pocket[] AllPockets { get; set; } = Array.Empty<Pocket>();
- public IEnumerable<LabelViewModel> AllLabelViewModel { get; set; } = Array.Empty<LabelViewModel>();
+ public IEnumerable<LabelViewModel> AllLabelsViewModel { get; set; } = Array.Empty<LabelViewModel>();
- public IEnumerable<LabelViewModel> LabelsWhiteList => AllLabelViewModel.Where(x => !x.IsBlackListed);
+ public IEnumerable<LabelViewModel> LabelsWhiteList => AllLabelsViewModel.Where(x => !x.IsBlackListed);
- public IEnumerable<LabelViewModel> LabelsBlackList => AllLabelViewModel.Where(x => x.IsBlackListed);
+ public IEnumerable<LabelViewModel> LabelsBlackList => AllLabelsViewModel.Where(x => x.IsBlackListed);
public Pocket[] GetSafeToUsePockets()
{
- var pockets = AllPocket.ToList();
+ var pockets = AllPockets.ToList();
if (_privatePocket is { } privatePocket)
{
@@ -53,7 +53,7 @@ public partial class LabelSelectionViewModel : ViewModelBase
public Pocket[] GetUsedPockets()
{
- var pocketsToReturn = AllPocket.Where(x => x.Labels.All(label => LabelsWhiteList.Any(labelViewModel => labelViewModel.Value == label))).ToList();
+ var pocketsToReturn = AllPockets.Where(x => x.Labels.All(label => LabelsWhiteList.Any(labelViewModel => labelViewModel.Value == label))).ToList();
if (_includePrivatePocket && _privatePocket is { } privatePocket)
{
@@ -67,13 +67,14 @@ public partial class LabelSelectionViewModel : ViewModelBase
{
_privatePocket = pockets.FirstOrDefault(x => x.Labels == CoinPocketHelper.PrivateFundsText);
- AllPocket = pockets.Where(x => x != _privatePocket).ToArray();
+ AllPockets = pockets.Where(x => x != _privatePocket).ToArray();
- var allLabels = SmartLabel.Merge(AllPocket.Select(x => x.Labels));
- AllLabelViewModel = allLabels.Select(x => new LabelViewModel(this, x)).ToArray();
+ var allLabels = SmartLabel.Merge(AllPockets.Select(x => x.Labels));
+ AllLabelsViewModel = allLabels.Select(x => new LabelViewModel(this, x)).ToArray();
- if (AllLabelViewModel.FirstOrDefault(x => x.Value == CoinPocketHelper.UnlabelledFundsText) is { } unlabelledViewModel)
+ if (AllLabelsViewModel.FirstOrDefault(x => x.Value == CoinPocketHelper.UnlabelledFundsText) is { } unlabelledViewModel)
{
+ unlabelledViewModel.IsDangerous = true;
unlabelledViewModel.ToolTip = "There is no information about these people, only use it when necessary!";
}
@@ -84,13 +85,13 @@ public partial class LabelSelectionViewModel : ViewModelBase
{
if (labelViewModel.IsBlackListed)
{
- var associatedPocketLabels = AllPocket.OrderBy(x => x.Labels.Count()).First(x => x.Labels.Contains(labelViewModel.Value)).Labels;
+ var associatedPocketLabels = AllPockets.OrderBy(x => x.Labels.Count()).First(x => x.Labels.Contains(labelViewModel.Value)).Labels;
return LabelsBlackList.Where(x => associatedPocketLabels.Contains(x.Value)).ToArray();
}
else
{
- var associatedPockets = AllPocket.Where(x => x.Labels.Contains(labelViewModel.Value));
- var notAssociatedPockets = AllPocket.Except(associatedPockets);
+ var associatedPockets = AllPockets.Where(x => x.Labels.Contains(labelViewModel.Value));
+ var notAssociatedPockets = AllPockets.Except(associatedPockets);
var allNotAssociatedLabels = SmartLabel.Merge(notAssociatedPockets.Select(x => x.Labels));
return LabelsWhiteList.Where(x => !allNotAssociatedLabels.Contains(x.Value)).ToArray();
}
@@ -131,7 +132,7 @@ public partial class LabelSelectionViewModel : ViewModelBase
private void OnSelectionChanged()
{
- Money sumOfWhiteList = AllPocket.Where(x => LabelsWhiteList.Any(y => x.Labels.Contains(y.Value))).Sum(x => x.Amount);
+ Money sumOfWhiteList = AllPockets.Where(x => LabelsWhiteList.Any(y => x.Labels.Contains(y.Value))).Sum(x => x.Amount);
if (sumOfWhiteList >= _targetAmount)
{
@@ -165,10 +166,10 @@ public partial class LabelSelectionViewModel : ViewModelBase
return;
}
- var usedPockets = AllPocket.Where(pocket => pocket.Coins.Any(usedCoins.Contains)).ToArray();
- var notUsedPockets = AllPocket.Except(usedPockets);
+ var usedPockets = AllPockets.Where(pocket => pocket.Coins.Any(usedCoins.Contains)).ToArray();
+ var notUsedPockets = AllPockets.Except(usedPockets);
var notUsedPocketsLabels = SmartLabel.Merge(notUsedPockets.Select(x => x.Labels));
- var notUsedLabelViewModels = AllLabelViewModel.Where(x => notUsedPocketsLabels.Contains(x.Value)).ToArray();
+ var notUsedLabelViewModels = AllLabelsViewModel.Where(x => notUsedPocketsLabels.Contains(x.Value)).ToArray();
foreach (LabelViewModel label in notUsedLabelViewModels)
{

MODIFY
WalletWasabi.Tests/UnitTests/UserInterfaceTest/PocketSelectionTests.cs
WalletWasabi.Tests/UnitTests/UserInterfaceTest/PocketSelectionTests.cs
@@ -465,7 +465,7 @@ internal static class LabelTestExtensions
{
public static LabelViewModel GetLabel(this LabelSelectionViewModel selection, string label)
{
- return selection.AllLabelViewModel.Single(x => x.Value == label);
+ return selection.AllLabelsViewModel.Single(x => x.Value == label);
}
public static void AddPocket(this List<Pocket> pockets, decimal amount, out Pocket pocket, params string[] labels)

rename AllPockets and AllLabels to be plural