Fix problems during review
MODIFY
WalletWasabi.Fluent/ViewModels/SearchBar/SearchBarViewModel.cs
WalletWasabi.Fluent/ViewModels/SearchBar/SearchBarViewModel.cs
using System.Collections.ObjectModel;
using System.Linq;
-using System.Reactive;
using System.Reactive.Linq;
using DynamicData;
using ReactiveUI;
@@ -9,11 +8,11 @@ using WalletWasabi.Fluent.ViewModels.SearchBar.SearchItems;
namespace WalletWasabi.Fluent.ViewModels.SearchBar;
-public class SearchBarViewModel : ReactiveObject
+public partial class SearchBarViewModel : ReactiveObject
{
private readonly ReadOnlyObservableCollection<SearchItemGroup> _groups;
- private bool _isSearchListVisible;
- private string _searchText;
+ [AutoNotify] private bool _isSearchListVisible;
+ [AutoNotify] private string _searchText;
public SearchBarViewModel(IObservable<IChangeSet<ISearchItem, ComposedKey>> itemsObservable)
{
@@ -33,26 +32,10 @@ public class SearchBarViewModel : ReactiveObject
.DisposeMany()
.ObserveOn(RxApp.MainThreadScheduler)
.Subscribe();
-
- ShowListCommand = ReactiveCommand.Create(() => IsSearchListVisible = true);
- }
-
- public ReactiveCommand<Unit, bool> ShowListCommand { get; set; }
-
- public bool IsSearchListVisible
- {
- get => _isSearchListVisible;
- set => this.RaiseAndSetIfChanged(ref _isSearchListVisible, value);
}
public ReadOnlyObservableCollection<SearchItemGroup> Groups => _groups;
- public string SearchText
- {
- get => _searchText;
- set => this.RaiseAndSetIfChanged(ref _searchText, value);
- }
-
private static Func<ISearchItem, bool> SearchItemFilterFunc(string? text)
{
return searchItem =>

MODIFY
WalletWasabi.Fluent/ViewModels/SearchBar/Sources/ActionsSource.cs
WalletWasabi.Fluent/ViewModels/SearchBar/Sources/ActionsSource.cs
@@ -3,6 +3,7 @@ using System.Linq;
using System.Reactive.Linq;
using System.Threading.Tasks;
using DynamicData;
+using WalletWasabi.Fluent.ViewModels.NavBar;
using WalletWasabi.Fluent.ViewModels.Navigation;
using WalletWasabi.Fluent.ViewModels.SearchBar.Patterns;
using WalletWasabi.Fluent.ViewModels.SearchBar.SearchItems;
@@ -21,8 +22,8 @@ public class ActionsSource : ISearchItemSource
.Where(m => m.Searchable)
.Select(m =>
{
- var func = CreateFunc(m);
- var searchItem = new ActionableItem(m.Title, m.Caption, func, m.Category ?? "No category", m.Keywords)
+ var onActivate = CreateOnActivateFunction(m);
+ var searchItem = new ActionableItem(m.Title, m.Caption, onActivate, m.Category ?? "No category", m.Keywords)
{
Icon = m.IconName,
IsDefault = true,
@@ -31,7 +32,7 @@ public class ActionsSource : ISearchItemSource
});
}
- private static Func<Task> CreateFunc(NavigationMetaData navigationMetaData)
+ private static Func<Task> CreateOnActivateFunction(NavigationMetaData navigationMetaData)
{
return async () =>
{
@@ -41,19 +42,14 @@ public class ActionsSource : ISearchItemSource
return;
}
- Navigate(vm.DefaultTarget).To(vm);
- };
- }
-
- private static INavigationStack<RoutableViewModel> Navigate(NavigationTarget currentTarget)
+ if (vm is NavBarItemViewModel item && item.OpenCommand.CanExecute(default))
{
- return currentTarget switch
+ item.OpenCommand.Execute(default);
+ }
+ else
{
- NavigationTarget.HomeScreen => NavigationState.Instance.HomeScreenNavigation,
- NavigationTarget.DialogScreen => NavigationState.Instance.DialogScreenNavigation,
- NavigationTarget.FullScreen => NavigationState.Instance.FullScreenNavigation,
- NavigationTarget.CompactDialogScreen => NavigationState.Instance.CompactDialogScreenNavigation,
- _ => throw new NotSupportedException()
+ RoutableViewModel.Navigate(vm.DefaultTarget).To(vm);
+ }
};
}
}

MODIFY
WalletWasabi.Fluent/ViewModels/SearchBar/Sources/SettingsSource.cs
WalletWasabi.Fluent/ViewModels/SearchBar/Sources/SettingsSource.cs
@@ -25,7 +25,7 @@ public class SettingsSource : ISearchItemSource
{
return new ISearchItem[]
{
- new NonActionableSearchItem(new Setting<GeneralSettingsTabViewModel, bool>(_settingsPage.GeneralSettingsTab, x => x.DarkModeEnabled), "Dark mode", "Appearance", new List<string> { "Black", "White", "Theme" }, "nav_settings_regular"){ IsDefault = false},
+ new NonActionableSearchItem(new Setting<GeneralSettingsTabViewModel, bool>(_settingsPage.GeneralSettingsTab, x => x.DarkModeEnabled), "Dark mode", "Appearance", new List<string> { "Black", "White", "Theme", "Dark", "Light" }, "nav_settings_regular"){ IsDefault = false},
new NonActionableSearchItem(new Setting<GeneralSettingsTabViewModel, bool>(_settingsPage.GeneralSettingsTab, b => b.AutoCopy), "Auto copy addresses", "Settings", new List<string>(), "nav_settings_regular") { IsDefault = false },
new NonActionableSearchItem(new Setting<GeneralSettingsTabViewModel, bool>(_settingsPage.GeneralSettingsTab, b => b.AutoPaste), "Auto paste addresses", "Settings", new List<string>(), "nav_settings_regular") { IsDefault = false },
new NonActionableSearchItem(new Setting<GeneralSettingsTabViewModel, bool>(_settingsPage.GeneralSettingsTab, b => b.HideOnClose), "Run in background when closed", "Settings", new List<string>() { "hide", "tray" }, "nav_settings_regular") { IsDefault = false },

DELETE
WalletWasabi.Fluent/ViewModels/Settings/SaveConfigMessage.cs
-namespace WalletWasabi.Fluent.ViewModels.Settings;
-
-public class SaveConfigMessage
-{
-}
\ No newline at end of file

Fix problems during review