Remove Searchable Transactions (PoC)
Remove search transaction leftovers
MODIFY
WalletWasabi.Fluent/App.axaml.cs
WalletWasabi.Fluent/App.axaml.cs
@@ -33,8 +33,6 @@ public class App : Application
DataContext = applicationViewModel;
applicationViewModel.ShowRequested += (sender, args) => ShowRequested?.Invoke(sender, args);
}
-
- TransactionsWatcher.Instance = new TransactionsWatcher();
}
public App(Func<Task> backendInitialiseAsync) : this()

DELETE
WalletWasabi.Fluent/TransactionsWatcher.cs
-using System.Linq;
-using DynamicData;
-using ReactiveUI;
-using WalletWasabi.Fluent.ViewModels.SearchBar;
-using WalletWasabi.Fluent.ViewModels.SearchBar.Patterns;
-using WalletWasabi.Fluent.ViewModels.Wallets.Home.History;
-
-namespace WalletWasabi.Fluent;
-
-public class TransactionsWatcher
-{
- public IObservable<IChangeSet<TransactionEntry, ComposedKey>> TransactionChanges { get; }
- public static TransactionsWatcher Instance { get; set; } = new();
-
- public TransactionsWatcher()
- {
- var cache = new SourceCache<TransactionEntry, ComposedKey>(x => x.Key);
-
- MessageBus.Current.Listen<TransactionsChangedMessage>()
- .Subscribe(msg =>
- {
- cache.Edit(r =>
- {
- var toRemove = r.Items.Where(r => r.Parent == msg.HistoryViewModel).ToList();
- r.Remove(toRemove);
- r.AddOrUpdate(msg.NewHistoryList
- .OrderByDescending(r => r.Date)
- .Select(b => new TransactionEntry(msg.HistoryViewModel, b)));
- });
- });
-
- TransactionChanges = cache.Connect();
- }
-}
\ No newline at end of file

MODIFY
WalletWasabi.Fluent/ViewModels/MainViewModel.cs
WalletWasabi.Fluent/ViewModels/MainViewModel.cs
-using System.Collections.Generic;
using System.Linq;
using System.Reactive.Concurrency;
using System.Reactive.Linq;
using Avalonia;
using Avalonia.Controls;
-using DynamicData;
using NBitcoin;
using ReactiveUI;
using WalletWasabi.Fluent.ViewModels.AddWallet;
@@ -43,7 +41,6 @@ public partial class MainViewModel : ViewModelBase
[AutoNotify] private double _windowWidth;
[AutoNotify] private double _windowHeight;
[AutoNotify] private PixelPoint? _windowPosition;
- private readonly WalletWatcher _walletWatcher;
public MainViewModel()
{
@@ -176,7 +173,7 @@ public partial class MainViewModel : ViewModelBase
}
});
- var source = new CompositeSearchItemsSource(new TransactionsSource(), new ActionsSource(), new SettingsSource(_settingsPage));
+ var source = new CompositeSearchItemsSource(new ActionsSource(), new SettingsSource(_settingsPage));
SearchBar = new SearchBarViewModel(source.Changes);
}

DELETE
WalletWasabi.Fluent/ViewModels/SearchBar/Sources/TransactionsSource.cs
-using System.Linq;
-using DynamicData;
-using WalletWasabi.Fluent.ViewModels.SearchBar.Patterns;
-using WalletWasabi.Fluent.ViewModels.SearchBar.SearchItem;
-using WalletWasabi.Fluent.ViewModels.Wallets.Home.History;
-
-namespace WalletWasabi.Fluent.ViewModels.SearchBar.Sources;
-
-public class TransactionsSource : ISearchItemSource
-{
- public IObservable<IChangeSet<ISearchItem, ComposedKey>> Changes =>
- TransactionsWatcher.Instance.TransactionChanges
- .Transform(ToSearchItem);
-
- private static ISearchItem ToSearchItem(TransactionEntry r)
- {
- var transactionId = r.HistoryItem.Id.ToString().Trim('0');
- var keywords = r.HistoryItem.Label?.Concat(new[] { transactionId }) ?? Enumerable.Empty<string>();
- return new NonActionableSearchItem(new TransactionSearchItem(r.HistoryItem), "", "Transactions", keywords.ToList(), "normal_transaction");
- }
-}
\ No newline at end of file

DELETE
WalletWasabi.Fluent/ViewModels/WalletWatcher.cs
-using System.Reactive;
-using System.Reactive.Linq;
-using NBitcoin;
-using WalletWasabi.Blockchain.Analysis.Clustering;
-using WalletWasabi.Blockchain.TransactionProcessing;
-using WalletWasabi.Blockchain.Transactions;
-using WalletWasabi.Wallets;
-
-namespace WalletWasabi.Fluent.ViewModels;
-
-public class WalletWatcher
-{
- public WalletWatcher(WalletManager walletManager)
- {
- var added = Observable
- .FromEventPattern<Wallet>(Services.WalletManager, nameof(WalletManager.WalletAdded))
- .Select(_ => Unit.Default);
- var transactionProcessed = Observable
- .FromEventPattern<ProcessedResult>(Services.WalletManager, nameof(WalletManager.WalletRelevantTransactionProcessed))
- .Select(_ => Unit.Default);
- }
-
- public IObservable<TransactionSummary> Transactions => GetTransactions();
-
- private IObservable<TransactionSummary> GetTransactions()
- {
- return new[]
- {
- new TransactionSummary
- {
- Amount = Money.Zero,
- BlockIndex = 1,
- Height = 1,
- TransactionId = 123,
- IsOwnCoinjoin = true,
- DateTime = DateTimeOffset.Now,
- Label = new SmartLabel("Hola")
- }
- }.ToObservable();
- }
-}
\ No newline at end of file

MODIFY
WalletWasabi.Fluent/ViewModels/Wallets/Home/History/HistoryViewModel.cs
WalletWasabi.Fluent/ViewModels/Wallets/Home/History/HistoryViewModel.cs
@@ -40,8 +40,6 @@ public partial class HistoryViewModel : ActivatableViewModel
[AutoNotify(SetterModifier = AccessModifier.Private)]
private bool _isInitialized;
- private readonly SourceCache<HistoryItemViewModelBase, uint256> _sourceCache;
-
public HistoryViewModel(WalletViewModel walletViewModel, IObservable<Unit> updateTrigger)
{
_walletViewModel = walletViewModel;
@@ -230,7 +228,6 @@ public partial class HistoryViewModel : ActivatableViewModel
var historyBuilder = new TransactionHistoryBuilder(_walletViewModel.Wallet);
var rawHistoryList = await Task.Run(historyBuilder.BuildHistorySummary);
var newHistoryList = GenerateHistoryList(rawHistoryList).ToArray();
- MessageBus.Current.SendMessage(new TransactionsChangedMessage(this, newHistoryList));
_transactionSourceList.Edit(x =>
{
@@ -238,8 +235,6 @@ public partial class HistoryViewModel : ActivatableViewModel
x.AddRange(newHistoryList);
});
-
-
if (!IsInitialized)
{
IsInitialized = true;

DELETE
WalletWasabi.Fluent/ViewModels/Wallets/Home/History/TransactionEntry.cs
-using WalletWasabi.Fluent.ViewModels.SearchBar;
-using WalletWasabi.Fluent.ViewModels.SearchBar.Patterns;
-using WalletWasabi.Fluent.ViewModels.Wallets.Home.History.HistoryItems;
-
-namespace WalletWasabi.Fluent.ViewModels.Wallets.Home.History;
-
-public class TransactionEntry
-{
- public HistoryItemViewModelBase HistoryItem { get; }
-
- public TransactionEntry(HistoryViewModel parent, HistoryItemViewModelBase historyItem)
- {
- Parent = parent;
- HistoryItem = historyItem;
- Key = new ComposedKey(Parent, HistoryItem.Id);
- }
-
- public ComposedKey Key { get; }
- public HistoryViewModel Parent { get; set; }
-}
\ No newline at end of file

DELETE
WalletWasabi.Fluent/ViewModels/Wallets/Home/History/TransactionsChangedMessage.cs
-using WalletWasabi.Fluent.ViewModels.Wallets.Home.History.HistoryItems;
-
-namespace WalletWasabi.Fluent.ViewModels.Wallets.Home.History;
-
-public class TransactionsChangedMessage
-{
- public HistoryViewModel HistoryViewModel { get; }
- public HistoryItemViewModelBase[] NewHistoryList { get; }
-
- public TransactionsChangedMessage(HistoryViewModel historyViewModel, HistoryItemViewModelBase[] newHistoryList)
- {
- HistoryViewModel = historyViewModel;
- NewHistoryList = newHistoryList;
- }
-}
\ No newline at end of file

Remove Searchable Transactions (PoC)

Remove search transaction leftovers