Skip to content

Commit

Permalink
SelectCoins + ICoinListModel
Browse files Browse the repository at this point in the history
  • Loading branch information
ichthus1604 committed Apr 26, 2024
1 parent 9cf3b18 commit 92d70e6
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 9 deletions.
4 changes: 2 additions & 2 deletions WalletWasabi.Fluent/Models/Transactions/SendFlowModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ private SendFlowModel(Wallet wallet, ICoinsView availableCoins, ICoinListModel c
{
Wallet = wallet;
AvailableCoins = availableCoins;
CoinListModel = coinListModel;
CoinList = coinListModel;
}

/// <summary>Regular Send Flow. Uses all wallet coins</summary>
Expand All @@ -36,7 +36,7 @@ public SendFlowModel(Wallet wallet, IWalletModel walletModel, IEnumerable<SmartC

public ICoinsView AvailableCoins { get; }

public ICoinListModel CoinListModel { get; }
public ICoinListModel CoinList { get; }

public TransactionInfo? TransactionInfo { get; init; } = null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ public SelectCoinsDialogViewModel(IWalletModel wallet, IList<ICoinModel> selecte
{
var transactionInfo = sendFlow.TransactionInfo ?? throw new InvalidOperationException($"Missing required TransactionInfo.");

// TODO: pass the SendFlow here to show only the relevant coins in the list
CoinList = new CoinListViewModel(wallet, selectedCoins, true);
CoinList = new CoinListViewModel(wallet, sendFlow.CoinList, selectedCoins, true);

EnoughSelected = CoinList.Selection.ToObservableChangeSet()
.ToCollection()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ private WalletCoinsViewModel(IWalletModel wallet)
SetupCancel(enableCancel: false, enableCancelOnEscape: true, enableCancelOnPressed: true);
NextCommand = CancelCommand;
SkipCommand = ReactiveCommand.CreateFromTask(OnSendCoinsAsync);
_coinList = new CoinListViewModel(_wallet, new List<ICoinModel>());
_coinList = new CoinListViewModel(_wallet, _wallet.Coins, new List<ICoinModel>());
IsAnySelected = CoinList.Selection.ToObservableChangeSet().Count().Select(i => i > 0);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class CoinListViewModel : ViewModelBase, IDisposable
private readonly bool _ignorePrivacyMode;

[System.Diagnostics.CodeAnalysis.SuppressMessage("Reliability", "CA2000:Dispose objects before losing scope", Justification = "Uses DisposeWith()")]
public CoinListViewModel(IWalletModel wallet, IList<ICoinModel> initialCoinSelection, bool ignorePrivacyMode = false)
public CoinListViewModel(IWalletModel wallet, ICoinListModel availableCoins, IList<ICoinModel> initialCoinSelection, bool ignorePrivacyMode = false)
{
_wallet = wallet;
_ignorePrivacyMode = ignorePrivacyMode;
Expand Down Expand Up @@ -69,7 +69,7 @@ public CoinListViewModel(IWalletModel wallet, IList<ICoinModel> initialCoinSelec
.ToCollection()
.Select(GetSelectedCoins);

wallet.Coins.Pockets
availableCoins.Pockets
.Connect()
.ToCollection()
.WithLatestFrom(selectedCoins, (pockets, sc) => (pockets, sc))
Expand Down Expand Up @@ -98,7 +98,7 @@ public CoinListViewModel(IWalletModel wallet, IList<ICoinModel> initialCoinSelec
TreeDataGridSource.DisposeWith(_disposables);
CoinItems = coinItemsCollection;

wallet.Coins.Pockets
availableCoins.Pockets
.Connect()
.ToCollection()
.SkipWhile(pockets => pockets.Count == 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public partial class ManualControlDialogViewModel: DialogViewModelBase<IEnumerab

private ManualControlDialogViewModel(IWalletModel walletModel, Wallet wallet)
{
CoinList = new CoinListViewModel(walletModel, [], true);
CoinList = new CoinListViewModel(walletModel, walletModel.Coins, [], true);

EnableBack = true;

Expand Down

0 comments on commit 92d70e6

Please sign in to comment.