From 6c737ee6f06ce03080d129b1263fb30d41e60cb8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20So=C3=B3s?= Date: Wed, 17 May 2023 12:36:57 +0200 Subject: [PATCH 1/3] remove redundant prop --- .../Wallets/Home/History/HistoryViewModel.cs | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/WalletWasabi.Fluent/ViewModels/Wallets/Home/History/HistoryViewModel.cs b/WalletWasabi.Fluent/ViewModels/Wallets/Home/History/HistoryViewModel.cs index 173a86cf9e5..6c4a44d04f3 100644 --- a/WalletWasabi.Fluent/ViewModels/Wallets/Home/History/HistoryViewModel.cs +++ b/WalletWasabi.Fluent/ViewModels/Wallets/Home/History/HistoryViewModel.cs @@ -29,8 +29,6 @@ public partial class HistoryViewModel : ActivatableViewModel private readonly ObservableCollectionExtended _transactions; private readonly ObservableCollectionExtended _unfilteredTransactions; - [AutoNotify] private HistoryItemViewModelBase? _selectedItem; - [AutoNotify(SetterModifier = AccessModifier.Private)] private bool _isTransactionHistoryEmpty; @@ -78,10 +76,6 @@ private HistoryViewModel(WalletViewModel walletVm) }; Source.RowSelection!.SingleSelect = true; - - Source.RowSelection - .WhenAnyValue(x => x.SelectedItem) - .Subscribe(x => SelectedItem = x); } public ObservableCollection UnfilteredTransactions => _unfilteredTransactions; @@ -211,10 +205,9 @@ public void SelectTransaction(uint256 txid) if (txnItem is { }) { - SelectedItem = txnItem; - SelectedItem.IsFlashing = true; + txnItem.IsFlashing = true; - var index = _transactions.IndexOf(SelectedItem); + var index = _transactions.IndexOf(txnItem); Dispatcher.UIThread.Post(() => Source.RowSelection!.SelectedIndex = new IndexPath(index)); } } From 4ac274f1de37b84ff5569b4bfe5f450ca3a4b63d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20So=C3=B3s?= Date: Wed, 17 May 2023 12:51:18 +0200 Subject: [PATCH 2/3] add logic for child selection --- .../Wallets/Home/History/HistoryViewModel.cs | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/WalletWasabi.Fluent/ViewModels/Wallets/Home/History/HistoryViewModel.cs b/WalletWasabi.Fluent/ViewModels/Wallets/Home/History/HistoryViewModel.cs index 6c4a44d04f3..e6a70363945 100644 --- a/WalletWasabi.Fluent/ViewModels/Wallets/Home/History/HistoryViewModel.cs +++ b/WalletWasabi.Fluent/ViewModels/Wallets/Home/History/HistoryViewModel.cs @@ -206,9 +206,22 @@ public void SelectTransaction(uint256 txid) if (txnItem is { }) { txnItem.IsFlashing = true; - var index = _transactions.IndexOf(txnItem); - Dispatcher.UIThread.Post(() => Source.RowSelection!.SelectedIndex = new IndexPath(index)); + IndexPath indexPath; + + if (txnItem is CoinJoinsHistoryItemViewModel cjGroup && + cjGroup.CoinJoinTransactions.FirstOrDefault(x => x.TransactionId == txid) is { } child) + { + txnItem.IsExpanded = true; + var childIndex = cjGroup.CoinJoinTransactions.IndexOf(child); + indexPath = new IndexPath(index, childIndex); + } + else + { + indexPath = new IndexPath(index); + } + + Dispatcher.UIThread.Post(() => Source.RowSelection!.SelectedIndex = indexPath); } } From 546df043d3c39cd95304192e6620ece5b6996b05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20So=C3=B3s?= Date: Wed, 17 May 2023 13:01:54 +0200 Subject: [PATCH 3/3] workaround for visual glitch --- .../Wallets/Home/History/HistoryViewModel.cs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/WalletWasabi.Fluent/ViewModels/Wallets/Home/History/HistoryViewModel.cs b/WalletWasabi.Fluent/ViewModels/Wallets/Home/History/HistoryViewModel.cs index e6a70363945..26420a50f64 100644 --- a/WalletWasabi.Fluent/ViewModels/Wallets/Home/History/HistoryViewModel.cs +++ b/WalletWasabi.Fluent/ViewModels/Wallets/Home/History/HistoryViewModel.cs @@ -205,23 +205,24 @@ public void SelectTransaction(uint256 txid) if (txnItem is { }) { - txnItem.IsFlashing = true; + // TDG has a visual glitch, if the item is not visible in the list, it will be glitched when gets expanded. + // Selecting first the root item, then the child solves the issue. var index = _transactions.IndexOf(txnItem); - IndexPath indexPath; + Dispatcher.UIThread.Post(() => Source.RowSelection!.SelectedIndex = new IndexPath(index)); if (txnItem is CoinJoinsHistoryItemViewModel cjGroup && - cjGroup.CoinJoinTransactions.FirstOrDefault(x => x.TransactionId == txid) is { } child) + cjGroup.Children.FirstOrDefault(x => x.Id == txid) is { } child) { txnItem.IsExpanded = true; - var childIndex = cjGroup.CoinJoinTransactions.IndexOf(child); - indexPath = new IndexPath(index, childIndex); + child.IsFlashing = true; + + var childIndex = cjGroup.Children.IndexOf(child); + Dispatcher.UIThread.Post(() => Source.RowSelection!.SelectedIndex = new IndexPath(index, childIndex)); } else { - indexPath = new IndexPath(index); + txnItem.IsFlashing = true; } - - Dispatcher.UIThread.Post(() => Source.RowSelection!.SelectedIndex = indexPath); } }