fix suggestions crash
MODIFY
WalletWasabi.Fluent/Behaviors/BindableFlyoutOpenBehavior.cs
WalletWasabi.Fluent/Behaviors/BindableFlyoutOpenBehavior.cs
@@ -41,6 +41,7 @@ public class BindableFlyoutOpenBehavior : DisposingBehavior<Control>
{
FlyoutBase.GetAttachedFlyout(AssociatedObject)?.Hide();
}
- });
+ })
+ .DisposeWith(disposable);
}
}

MODIFY
WalletWasabi.Fluent/ViewModels/Wallets/Send/PrivacySuggestionsFlyoutViewModel.cs
WalletWasabi.Fluent/ViewModels/Wallets/Send/PrivacySuggestionsFlyoutViewModel.cs
+using Avalonia.Threading;
using NBitcoin;
using Nito.AsyncEx;
using ReactiveUI;
@@ -25,6 +26,8 @@ public partial class PrivacySuggestionsFlyoutViewModel : ViewModelBase
[AutoNotify] private SuggestionViewModel? _previewSuggestion;
[AutoNotify] private SuggestionViewModel? _selectedSuggestion;
[AutoNotify] private bool _isOpen;
+ [AutoNotify] private bool _isVisible;
+ [AutoNotify] private bool _isBusy;
private CancellationTokenSource? _suggestionCancellationTokenSource;
@@ -65,8 +68,8 @@ public partial class PrivacySuggestionsFlyoutViewModel : ViewModelBase
Suggestions.Clear();
SelectedSuggestion = null;
- var loadingRing = new LoadingSuggestionViewModel();
- Suggestions.Add(loadingRing);
+ IsVisible = true;
+ IsBusy = true;
var hasChange = transaction.InnerWalletOutputs.Any(x => x.ScriptPubKey != destination.ScriptPubKey);
@@ -92,8 +95,6 @@ public partial class PrivacySuggestionsFlyoutViewModel : ViewModelBase
Suggestions.Insert(Suggestions.Count - 1, suggestion);
}
}
-
- Suggestions.Remove(loadingRing);
}
catch (OperationCanceledException)
{
@@ -105,6 +106,13 @@ public partial class PrivacySuggestionsFlyoutViewModel : ViewModelBase
{
_suggestionCancellationTokenSource = null;
}
+
+ IsBusy = false;
+ IsVisible = Suggestions.Any();
+ if (!IsVisible)
+ {
+ IsOpen = false;
+ }
}
}
}

MODIFY
WalletWasabi.Fluent/Views/Wallets/Send/TransactionPreviewView.axaml
WalletWasabi.Fluent/Views/Wallets/Send/TransactionPreviewView.axaml
</Viewbox>
</Border>
- <Border Cursor="Hand" Padding="10 0 10 10" IsVisible="{Binding !!PrivacySuggestions.Suggestions.Count}">
+ <Border Cursor="Hand" Padding="10 0 10 10" IsVisible="{Binding PrivacySuggestions.IsVisible}">
<Border.Styles>
<Style Selector="FlyoutPresenter">
<Setter Property="MaxWidth" Value="1000" />
<DockPanel>
<TextBlock Text="Suggestions to improve your privacy" HorizontalAlignment="Center" DockPanel.Dock="Top" />
+ <Panel>
<ListBox DockPanel.Dock="Top" Background="Transparent" VerticalAlignment="Center"
HorizontalAlignment="Center"
- Items="{Binding Suggestions}" SelectedItem="{Binding SelectedSuggestion}" IsVisible="{Binding IsOpen}">
+ Items="{Binding Suggestions}" SelectedItem="{Binding SelectedSuggestion}"
+ IsVisible="{Binding !IsBusy}">
<i:Interaction.Behaviors>
<behaviors:ListBoxPreviewBehavior PreviewItem="{Binding PreviewSuggestion, Mode=TwoWay}" />
</i:Interaction.Behaviors>
</DataTemplate>
</ListBox.DataTemplates>
</ListBox>
+
+ <c:ProgressRing Height="100" Width="100" IsIndeterminate="True" IsVisible="{Binding IsBusy}" Margin="0 20 0 0" />
+ </Panel>
</DockPanel>
</Panel>
</Flyout>

fix suggestions crash