diff --git a/Flow.Launcher.Plugin/AllowedLanguage.cs b/Flow.Launcher.Plugin/AllowedLanguage.cs index 619a94deb50..0d22756a7fb 100644 --- a/Flow.Launcher.Plugin/AllowedLanguage.cs +++ b/Flow.Launcher.Plugin/AllowedLanguage.cs @@ -65,7 +65,42 @@ public static class AllowedLanguage public static bool IsDotNet(string language) { return language.Equals(CSharp, StringComparison.OrdinalIgnoreCase) - || language.Equals(FSharp, StringComparison.OrdinalIgnoreCase); + || language.Equals(FSharp, StringComparison.OrdinalIgnoreCase); + } + + /// + /// Determines if this language is a Python language + /// + /// + /// + public static bool IsPython(string language) + { + return language.Equals(Python, StringComparison.OrdinalIgnoreCase) + || language.Equals(PythonV2, StringComparison.OrdinalIgnoreCase); + } + + /// + /// Determines if this language is a Node.js language + /// + /// + /// + public static bool IsNodeJs(string language) + { + return language.Equals(TypeScript, StringComparison.OrdinalIgnoreCase) + || language.Equals(TypeScriptV2, StringComparison.OrdinalIgnoreCase) + || language.Equals(JavaScript, StringComparison.OrdinalIgnoreCase) + || language.Equals(JavaScriptV2, StringComparison.OrdinalIgnoreCase); + } + + /// + /// Determines if this language is a executable language + /// + /// + /// + public static bool IsExecutable(string language) + { + return language.Equals(Executable, StringComparison.OrdinalIgnoreCase) + || language.Equals(ExecutableV2, StringComparison.OrdinalIgnoreCase); } /// @@ -76,15 +111,9 @@ public static bool IsDotNet(string language) public static bool IsAllowed(string language) { return IsDotNet(language) - || language.Equals(Python, StringComparison.OrdinalIgnoreCase) - || language.Equals(PythonV2, StringComparison.OrdinalIgnoreCase) - || language.Equals(Executable, StringComparison.OrdinalIgnoreCase) - || language.Equals(TypeScript, StringComparison.OrdinalIgnoreCase) - || language.Equals(JavaScript, StringComparison.OrdinalIgnoreCase) - || language.Equals(ExecutableV2, StringComparison.OrdinalIgnoreCase) - || language.Equals(TypeScriptV2, StringComparison.OrdinalIgnoreCase) - || language.Equals(JavaScriptV2, StringComparison.OrdinalIgnoreCase); - ; + || IsPython(language) + || IsNodeJs(language) + || IsExecutable(language); } } } diff --git a/Flow.Launcher/Images/EXE.png b/Flow.Launcher/Images/EXE.png deleted file mode 100644 index ecc91bdb3ab..00000000000 Binary files a/Flow.Launcher/Images/EXE.png and /dev/null differ diff --git a/Flow.Launcher/SettingPages/ViewModels/SettingsPanePluginStoreViewModel.cs b/Flow.Launcher/SettingPages/ViewModels/SettingsPanePluginStoreViewModel.cs index 68c69f8411b..249e4dd424e 100644 --- a/Flow.Launcher/SettingPages/ViewModels/SettingsPanePluginStoreViewModel.cs +++ b/Flow.Launcher/SettingPages/ViewModels/SettingsPanePluginStoreViewModel.cs @@ -9,7 +9,75 @@ namespace Flow.Launcher.SettingPages.ViewModels; public partial class SettingsPanePluginStoreViewModel : BaseModel { - public string FilterText { get; set; } = string.Empty; + private string filterText = string.Empty; + public string FilterText + { + get => filterText; + set + { + if (filterText != value) + { + filterText = value; + OnPropertyChanged(); + } + } + } + + private bool showDotNet = true; + public bool ShowDotNet + { + get => showDotNet; + set + { + if (showDotNet != value) + { + showDotNet = value; + OnPropertyChanged(); + } + } + } + + private bool showPython = true; + public bool ShowPython + { + get => showPython; + set + { + if (showPython != value) + { + showPython = value; + OnPropertyChanged(); + } + } + } + + private bool showNodeJs = true; + public bool ShowNodeJs + { + get => showNodeJs; + set + { + if (showNodeJs != value) + { + showNodeJs = value; + OnPropertyChanged(); + } + } + } + + private bool showExecutable = true; + public bool ShowExecutable + { + get => showExecutable; + set + { + if (showExecutable != value) + { + showExecutable = value; + OnPropertyChanged(); + } + } + } public IList ExternalPlugins => App.API.GetPluginManifest()?.Select(p => new PluginStoreItemViewModel(p)) @@ -30,8 +98,29 @@ private async Task RefreshExternalPluginsAsync() public bool SatisfiesFilter(PluginStoreItemViewModel plugin) { + // Check plugin language + var pluginShown = false; + if (AllowedLanguage.IsDotNet(plugin.Language)) + { + pluginShown = ShowDotNet; + } + else if (AllowedLanguage.IsPython(plugin.Language)) + { + pluginShown = ShowPython; + } + else if (AllowedLanguage.IsNodeJs(plugin.Language)) + { + pluginShown = ShowNodeJs; + } + else if (AllowedLanguage.IsExecutable(plugin.Language)) + { + pluginShown = ShowExecutable; + } + if (!pluginShown) return false; + + // Check plugin name & description return string.IsNullOrEmpty(FilterText) || - App.API.FuzzySearch(FilterText, plugin.Name).IsSearchPrecisionScoreMet() || - App.API.FuzzySearch(FilterText, plugin.Description).IsSearchPrecisionScoreMet(); + App.API.FuzzySearch(FilterText, plugin.Name).IsSearchPrecisionScoreMet() || + App.API.FuzzySearch(FilterText, plugin.Description).IsSearchPrecisionScoreMet(); } } diff --git a/Flow.Launcher/SettingPages/Views/SettingsPanePluginStore.xaml b/Flow.Launcher/SettingPages/Views/SettingsPanePluginStore.xaml index 5f9e57faa6f..9312b0c2dfd 100644 --- a/Flow.Launcher/SettingPages/Views/SettingsPanePluginStore.xaml +++ b/Flow.Launcher/SettingPages/Views/SettingsPanePluginStore.xaml @@ -27,8 +27,8 @@ - - + + @@ -51,60 +51,93 @@ Grid.Column="1" Margin="5 24 0 0"> - - - - - - + + + + + + + - - diff --git a/Flow.Launcher/SettingPages/Views/SettingsPanePluginStore.xaml.cs b/Flow.Launcher/SettingPages/Views/SettingsPanePluginStore.xaml.cs index 131dfab6d29..5ddfe465009 100644 --- a/Flow.Launcher/SettingPages/Views/SettingsPanePluginStore.xaml.cs +++ b/Flow.Launcher/SettingPages/Views/SettingsPanePluginStore.xaml.cs @@ -26,9 +26,15 @@ protected override void OnNavigatedTo(NavigationEventArgs e) private void ViewModel_PropertyChanged(object sender, PropertyChangedEventArgs e) { - if (e.PropertyName == nameof(SettingsPanePluginStoreViewModel.FilterText)) + switch (e.PropertyName) { - ((CollectionViewSource)FindResource("PluginStoreCollectionView")).View.Refresh(); + case nameof(SettingsPanePluginStoreViewModel.FilterText): + case nameof(SettingsPanePluginStoreViewModel.ShowDotNet): + case nameof(SettingsPanePluginStoreViewModel.ShowPython): + case nameof(SettingsPanePluginStoreViewModel.ShowNodeJs): + case nameof(SettingsPanePluginStoreViewModel.ShowExecutable): + ((CollectionViewSource)FindResource("PluginStoreCollectionView")).View.Refresh(); + break; } }