use WalletViewModel for navigation
MODIFY
WalletWasabi.Fluent/ViewModels/Wallets/Home/History/HistoryItemViewModel.cs
WalletWasabi.Fluent/ViewModels/Wallets/Home/History/HistoryItemViewModel.cs
@@ -4,21 +4,20 @@ using System.Windows.Input;
using NBitcoin;
using ReactiveUI;
using WalletWasabi.Blockchain.Transactions;
-using WalletWasabi.Fluent.ViewModels.Navigation;
using WalletWasabi.Models;
-using WalletWasabi.Wallets;
namespace WalletWasabi.Fluent.ViewModels.Wallets.Home.History
{
public class HistoryItemViewModel
{
- public HistoryItemViewModel(int orderIndex, TransactionSummary transactionSummary, Wallet wallet, Money balance, IObservable<Unit> updateTrigger)
+ public HistoryItemViewModel(int orderIndex, TransactionSummary transactionSummary, WalletViewModel walletViewModel, Money balance, IObservable<Unit> updateTrigger)
{
TransactionSummary = transactionSummary;
Date = transactionSummary.DateTime.ToLocalTime();
IsCoinJoin = transactionSummary.IsLikelyCoinJoinOutput;
OrderIndex = orderIndex;
Balance = balance;
+ var wallet = walletViewModel.Wallet;
var confirmations = transactionSummary.Height.Type == HeightType.Chain ? (int) wallet.BitcoinStore.SmartHeaderChain.TipHeight - transactionSummary.Height.Value + 1 : 0;
IsConfirmed = confirmations > 0;
@@ -33,13 +32,7 @@ namespace WalletWasabi.Fluent.ViewModels.Wallets.Home.History
IncomingAmount = amount;
}
- ShowDetailsCommand = ReactiveCommand.Create(() =>
- {
- if (NavigationState.Instance.DialogScreenNavigation is { } navStack)
- {
- navStack.To(new TransactionDetailsViewModel(transactionSummary, wallet, updateTrigger));
- }
- });
+ ShowDetailsCommand = ReactiveCommand.Create(() => walletViewModel.Navigate().To(new TransactionDetailsViewModel(transactionSummary, wallet, updateTrigger)));
}
public ICommand ShowDetailsCommand { get; }

MODIFY
WalletWasabi.Fluent/ViewModels/Wallets/Home/History/HistoryViewModel.cs
WalletWasabi.Fluent/ViewModels/Wallets/Home/History/HistoryViewModel.cs
@@ -14,24 +14,23 @@ using ReactiveUI;
using WalletWasabi.Blockchain.Transactions;
using WalletWasabi.Gui;
using WalletWasabi.Logging;
-using WalletWasabi.Wallets;
namespace WalletWasabi.Fluent.ViewModels.Wallets.Home.History
{
public partial class HistoryViewModel : ActivatableViewModel
{
- private readonly Wallet _wallet;
private readonly SourceList<HistoryItemViewModel> _transactionSourceList;
+ private readonly WalletViewModel _walletViewModel;
private readonly IObservable<Unit> _updateTrigger;
private readonly ObservableCollectionExtended<HistoryItemViewModel> _transactions;
private readonly ObservableCollectionExtended<HistoryItemViewModel> _unfilteredTransactions;
[AutoNotify] private bool _showCoinJoin;
- public HistoryViewModel(Wallet wallet, UiConfig uiConfig, IObservable<Unit> updateTrigger)
+ public HistoryViewModel(WalletViewModel walletViewModel, UiConfig uiConfig, IObservable<Unit> updateTrigger)
{
+ _walletViewModel = walletViewModel;
_updateTrigger = updateTrigger;
- _wallet = wallet;
_showCoinJoin = uiConfig.ShowCoinJoinInHistory;
_transactionSourceList = new SourceList<HistoryItemViewModel>();
_transactions = new ObservableCollectionExtended<HistoryItemViewModel>();
@@ -92,7 +91,7 @@ namespace WalletWasabi.Fluent.ViewModels.Wallets.Home.History
{
try
{
- var historyBuilder = new TransactionHistoryBuilder(_wallet);
+ var historyBuilder = new TransactionHistoryBuilder(_walletViewModel.Wallet);
var txRecordList = await Task.Run(historyBuilder.BuildHistorySummary);
_transactionSourceList.Clear();
@@ -101,7 +100,7 @@ namespace WalletWasabi.Fluent.ViewModels.Wallets.Home.History
{
var transactionSummary = txRecordList[i];
balance += transactionSummary.Amount;
- _transactionSourceList.Add(new HistoryItemViewModel(i, transactionSummary, _wallet, balance, _updateTrigger));
+ _transactionSourceList.Add(new HistoryItemViewModel(i, transactionSummary, _walletViewModel, balance, _updateTrigger));
}
}
catch (Exception ex)

MODIFY
WalletWasabi.Fluent/ViewModels/Wallets/WalletViewModel.cs
WalletWasabi.Fluent/ViewModels/Wallets/WalletViewModel.cs
@@ -4,7 +4,6 @@ using System.Collections.Generic;
using System.Reactive;
using System.Reactive.Disposables;
using System.Reactive.Linq;
-using Avalonia.Threading;
using WalletWasabi.Fluent.ViewModels.Wallets.HardwareWallet;
using WalletWasabi.Fluent.ViewModels.Wallets.Home.History;
using WalletWasabi.Fluent.ViewModels.Wallets.Home.Tiles;
@@ -36,7 +35,7 @@ namespace WalletWasabi.Fluent.ViewModels.Wallets
.Merge(Wallet.Synchronizer.WhenAnyValue(x => x.UsdExchangeRate).Select(_ => Unit.Default))
.ObserveOn(RxApp.MainThreadScheduler);
- History = new HistoryViewModel(wallet, uiConfig, balanceChanged);
+ History = new HistoryViewModel(this, uiConfig, balanceChanged);
BalanceTile = new WalletBalanceTileViewModel(wallet, balanceChanged);
BalanceChartTile = new WalletBalanceChartTileViewModel(History.UnfilteredTransactions);

use WalletViewModel for navigation