From 5fc8ed1824d55b48e9b2db056688afd490f99e0f Mon Sep 17 00:00:00 2001
From: Jack251970 <1160210343@qq.com>
Date: Fri, 21 Feb 2025 11:11:44 +0800
Subject: [PATCH 1/2] Remove useless settings control & project reference
---
.../Flow.Launcher.Plugin.Url.csproj | 1 -
Plugins/Flow.Launcher.Plugin.Url/Main.cs | 10 +---------
.../SettingsControl.xaml | 17 -----------------
.../SettingsControl.xaml.cs | 18 ------------------
4 files changed, 1 insertion(+), 45 deletions(-)
delete mode 100644 Plugins/Flow.Launcher.Plugin.Url/SettingsControl.xaml
delete mode 100644 Plugins/Flow.Launcher.Plugin.Url/SettingsControl.xaml.cs
diff --git a/Plugins/Flow.Launcher.Plugin.Url/Flow.Launcher.Plugin.Url.csproj b/Plugins/Flow.Launcher.Plugin.Url/Flow.Launcher.Plugin.Url.csproj
index 3db0cd0cb61..6d338733e31 100644
--- a/Plugins/Flow.Launcher.Plugin.Url/Flow.Launcher.Plugin.Url.csproj
+++ b/Plugins/Flow.Launcher.Plugin.Url/Flow.Launcher.Plugin.Url.csproj
@@ -42,7 +42,6 @@
-
diff --git a/Plugins/Flow.Launcher.Plugin.Url/Main.cs b/Plugins/Flow.Launcher.Plugin.Url/Main.cs
index 80425a8ff94..03516636d43 100644
--- a/Plugins/Flow.Launcher.Plugin.Url/Main.cs
+++ b/Plugins/Flow.Launcher.Plugin.Url/Main.cs
@@ -1,11 +1,10 @@
using System;
using System.Collections.Generic;
using System.Text.RegularExpressions;
-using System.Windows.Controls;
namespace Flow.Launcher.Plugin.Url
{
- public class Main : ISettingProvider,IPlugin, IPluginI18n
+ public class Main : IPlugin, IPluginI18n
{
//based on https://gist.github.com/dperini/729294
private const string urlPattern = "^" +
@@ -43,7 +42,6 @@ public class Main : ISettingProvider,IPlugin, IPluginI18n
Regex reg = new Regex(urlPattern, RegexOptions.Compiled | RegexOptions.IgnoreCase);
private PluginInitContext context;
private Settings _settings;
-
public List Query(Query query)
{
@@ -82,12 +80,6 @@ public List Query(Query query)
return new List(0);
}
-
- public Control CreateSettingPanel()
- {
- return new SettingsControl(context.API,_settings);
- }
-
public bool IsURL(string raw)
{
raw = raw.ToLower();
diff --git a/Plugins/Flow.Launcher.Plugin.Url/SettingsControl.xaml b/Plugins/Flow.Launcher.Plugin.Url/SettingsControl.xaml
deleted file mode 100644
index 8ff7b5ab53b..00000000000
--- a/Plugins/Flow.Launcher.Plugin.Url/SettingsControl.xaml
+++ /dev/null
@@ -1,17 +0,0 @@
-
-
-
-
-
-
-
-
diff --git a/Plugins/Flow.Launcher.Plugin.Url/SettingsControl.xaml.cs b/Plugins/Flow.Launcher.Plugin.Url/SettingsControl.xaml.cs
deleted file mode 100644
index f68d1bb2db0..00000000000
--- a/Plugins/Flow.Launcher.Plugin.Url/SettingsControl.xaml.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-using System.Windows.Controls;
-
-namespace Flow.Launcher.Plugin.Url
-{
- public partial class SettingsControl : UserControl
- {
- private Settings _settings;
- private IPublicAPI _flowlauncherAPI;
-
- public SettingsControl(IPublicAPI flowlauncherAPI,Settings settings)
- {
- InitializeComponent();
- _settings = settings;
- _flowlauncherAPI = flowlauncherAPI;
-
- }
- }
-}
From c472239ea9e2e8a814ed85330d4a66308a9bf956 Mon Sep 17 00:00:00 2001
From: Jack251970 <1160210343@qq.com>
Date: Fri, 21 Feb 2025 11:20:00 +0800
Subject: [PATCH 2/2] Fix unneccessary black lines when settings control is
null
---
Flow.Launcher.Core/Plugin/JsonRPCPluginSettings.cs | 2 +-
Flow.Launcher/ViewModel/PluginViewModel.cs | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/Flow.Launcher.Core/Plugin/JsonRPCPluginSettings.cs b/Flow.Launcher.Core/Plugin/JsonRPCPluginSettings.cs
index 50eb30998d3..2a4b22bf395 100644
--- a/Flow.Launcher.Core/Plugin/JsonRPCPluginSettings.cs
+++ b/Flow.Launcher.Core/Plugin/JsonRPCPluginSettings.cs
@@ -112,7 +112,7 @@ public void Save()
public Control CreateSettingPanel()
{
if (Settings == null || Settings.Count == 0)
- return new();
+ return null;
var settingWindow = new UserControl();
var mainPanel = new Grid { Margin = settingPanelMargin, VerticalAlignment = VerticalAlignment.Center };
diff --git a/Flow.Launcher/ViewModel/PluginViewModel.cs b/Flow.Launcher/ViewModel/PluginViewModel.cs
index 4ce8bd4706f..a46b98d64b6 100644
--- a/Flow.Launcher/ViewModel/PluginViewModel.cs
+++ b/Flow.Launcher/ViewModel/PluginViewModel.cs
@@ -90,7 +90,7 @@ public bool IsExpanded
private Control _bottomPart2;
public Control BottomPart2 => IsExpanded ? _bottomPart2 ??= new InstalledPluginDisplayBottomData() : null;
- public bool HasSettingControl => PluginPair.Plugin is ISettingProvider;
+ public bool HasSettingControl => PluginPair.Plugin is ISettingProvider settingProvider && settingProvider.CreateSettingPanel() != null;
public Control SettingControl
=> IsExpanded
? _settingControl