Skip to content

Commit c690e59

Browse files
authored
Merge branch 'dev' into plugin_settings_cache_path
2 parents af3b391 + eb2a24d commit c690e59

File tree

190 files changed

+3258
-1963
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

190 files changed

+3258
-1963
lines changed

.github/dependabot.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ updates:
88
- package-ecosystem: "nuget" # See documentation for possible values
99
directory: "/" # Location of package manifests
1010
schedule:
11-
interval: "weekly"
11+
interval: "daily"
12+
open-pull-requests-limit: 3
1213
ignore:
1314
- dependency-name: "squirrel-windows"
1415
reviewers:

Flow.Launcher.Core/Flow.Launcher.Core.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,11 @@
5454

5555
<ItemGroup>
5656
<PackageReference Include="Droplex" Version="1.7.0" />
57-
<PackageReference Include="FSharp.Core" Version="9.0.101" />
57+
<PackageReference Include="FSharp.Core" Version="9.0.201" />
5858
<PackageReference Include="Meziantou.Framework.Win32.Jobs" Version="3.4.0" />
5959
<PackageReference Include="Microsoft.IO.RecyclableMemoryStream" Version="3.0.1" />
6060
<PackageReference Include="squirrel.windows" Version="1.5.2" NoWarn="NU1701" />
61-
<PackageReference Include="StreamJsonRpc" Version="2.20.20" />
61+
<PackageReference Include="StreamJsonRpc" Version="2.21.10" />
6262
</ItemGroup>
6363

6464
<ItemGroup>

Flow.Launcher.Core/Plugin/JsonRPCPluginBase.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ namespace Flow.Launcher.Core.Plugin
1717
/// Represent the plugin that using JsonPRC
1818
/// every JsonRPC plugin should has its own plugin instance
1919
/// </summary>
20-
internal abstract class JsonRPCPluginBase : IAsyncPlugin, IContextMenu, ISettingProvider, ISavable
20+
public abstract class JsonRPCPluginBase : IAsyncPlugin, IContextMenu, ISettingProvider, ISavable
2121
{
2222
protected PluginInitContext Context;
2323
public const string JsonRPC = "JsonRPC";
@@ -139,6 +139,11 @@ public void Save()
139139
Settings?.Save();
140140
}
141141

142+
public bool NeedCreateSettingPanel()
143+
{
144+
return Settings.NeedCreateSettingPanel();
145+
}
146+
142147
public Control CreateSettingPanel()
143148
{
144149
return Settings.CreateSettingPanel();

Flow.Launcher.Core/Plugin/JsonRPCPluginSettings.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,15 @@ public void Save()
109109
_storage.Save();
110110
}
111111

112+
public bool NeedCreateSettingPanel()
113+
{
114+
// If there are no settings or the settings configuration is empty, return null
115+
return Settings != null && Configuration != null && Configuration.Body.Count != 0;
116+
}
117+
112118
public Control CreateSettingPanel()
113119
{
114-
if (Settings == null || Settings.Count == 0)
115-
return null;
120+
// No need to check if NeedCreateSettingPanel is true because CreateSettingPanel will only be called if it's true
116121

117122
var settingWindow = new UserControl();
118123
var mainPanel = new Grid { Margin = settingPanelMargin, VerticalAlignment = VerticalAlignment.Center };

Flow.Launcher.Core/Plugin/JsonRPCV2Models/JsonRPCPublicAPI.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,5 +175,15 @@ public void BackToQueryResults()
175175
{
176176
_api.BackToQueryResults();
177177
}
178+
179+
public void StartLoadingBar()
180+
{
181+
_api.StartLoadingBar();
182+
}
183+
184+
public void StopLoadingBar()
185+
{
186+
_api.StopLoadingBar();
187+
}
178188
}
179189
}

Flow.Launcher.Core/Resource/Theme.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
using Flow.Launcher.Infrastructure;
1313
using Flow.Launcher.Infrastructure.Logger;
1414
using Flow.Launcher.Infrastructure.UserSettings;
15-
using CommunityToolkit.Mvvm.DependencyInjection;
1615
using Flow.Launcher.Plugin;
1716

1817
namespace Flow.Launcher.Core.Resource
@@ -35,6 +34,8 @@ public class Theme
3534
private string DirectoryPath => Path.Combine(Constant.ProgramDirectory, Folder);
3635
private string UserDirectoryPath => Path.Combine(DataLocation.DataDirectory(), Folder);
3736

37+
public string CurrentTheme => _settings.Theme;
38+
3839
public bool BlurEnabled { get; set; }
3940

4041
private double mainWindowWidth;

Flow.Launcher.Infrastructure/Flow.Launcher.Infrastructure.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
<PrivateAssets>all</PrivateAssets>
6060
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
6161
</PackageReference>
62-
<PackageReference Include="MemoryPack" Version="1.21.3" />
62+
<PackageReference Include="MemoryPack" Version="1.21.4" />
6363
<PackageReference Include="Microsoft.VisualStudio.Threading" Version="17.12.19" />
6464
<PackageReference Include="Microsoft.Windows.CsWin32" Version="0.3.106">
6565
<PrivateAssets>all</PrivateAssets>

Flow.Launcher.Infrastructure/Logger/Log.cs

Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,17 +48,45 @@ static Log()
4848
configuration.AddTarget("file", fileTargetASyncWrapper);
4949
configuration.AddTarget("debug", debugTarget);
5050

51+
var fileRule = new LoggingRule("*", LogLevel.Debug, fileTargetASyncWrapper)
52+
{
53+
RuleName = "file"
54+
};
5155
#if DEBUG
52-
var fileRule = new LoggingRule("*", LogLevel.Debug, fileTargetASyncWrapper);
53-
var debugRule = new LoggingRule("*", LogLevel.Debug, debugTarget);
56+
var debugRule = new LoggingRule("*", LogLevel.Debug, debugTarget)
57+
{
58+
RuleName = "debug"
59+
};
5460
configuration.LoggingRules.Add(debugRule);
55-
#else
56-
var fileRule = new LoggingRule("*", LogLevel.Info, fileTargetASyncWrapper);
5761
#endif
5862
configuration.LoggingRules.Add(fileRule);
5963
LogManager.Configuration = configuration;
6064
}
6165

66+
public static void SetLogLevel(LOGLEVEL level)
67+
{
68+
switch (level)
69+
{
70+
case LOGLEVEL.DEBUG:
71+
UseDebugLogLevel();
72+
break;
73+
default:
74+
UseInfoLogLevel();
75+
break;
76+
}
77+
Info(nameof(Logger), $"Using log level: {level}.");
78+
}
79+
80+
private static void UseDebugLogLevel()
81+
{
82+
LogManager.Configuration.FindRuleByName("file").SetLoggingLevels(LogLevel.Debug, LogLevel.Fatal);
83+
}
84+
85+
private static void UseInfoLogLevel()
86+
{
87+
LogManager.Configuration.FindRuleByName("file").SetLoggingLevels(LogLevel.Info, LogLevel.Fatal);
88+
}
89+
6290
private static void LogFaultyFormat(string message)
6391
{
6492
var logger = LogManager.GetLogger("FaultyLogger");
@@ -206,4 +234,10 @@ public static void Warn(string message)
206234
LogInternal(message, LogLevel.Warn);
207235
}
208236
}
237+
238+
public enum LOGLEVEL
239+
{
240+
DEBUG,
241+
INFO
242+
}
209243
}

Flow.Launcher.Infrastructure/UserSettings/Settings.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using System.Windows;
66
using CommunityToolkit.Mvvm.DependencyInjection;
77
using Flow.Launcher.Infrastructure.Hotkey;
8+
using Flow.Launcher.Infrastructure.Logger;
89
using Flow.Launcher.Infrastructure.Storage;
910
using Flow.Launcher.Plugin;
1011
using Flow.Launcher.Plugin.SharedModels;
@@ -199,6 +200,9 @@ public CustomBrowserViewModel CustomBrowser
199200
}
200201
};
201202

203+
[JsonConverter(typeof(JsonStringEnumConverter))]
204+
public LOGLEVEL LogLevel { get; set; } = LOGLEVEL.INFO;
205+
202206
/// <summary>
203207
/// when false Alphabet static service will always return empty results
204208
/// </summary>

Flow.Launcher.Plugin/Flow.Launcher.Plugin.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
</ItemGroup>
6767

6868
<ItemGroup>
69-
<PackageReference Include="Fody" Version="6.5.4">
69+
<PackageReference Include="Fody" Version="6.5.5">
7070
<PrivateAssets>all</PrivateAssets>
7171
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
7272
</PackageReference>

0 commit comments

Comments
 (0)