Skip to content

Commit 73c5f39

Browse files
committed
Merge Dev
2 parents 72d2b7e + 9b2148f commit 73c5f39

File tree

17 files changed

+111
-22
lines changed

17 files changed

+111
-22
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
@@ -34,7 +34,7 @@ namespace Flow.Launcher.Core.Plugin
3434
/// Represent the plugin that using JsonPRC
3535
/// every JsonRPC plugin should has its own plugin instance
3636
/// </summary>
37-
internal abstract class JsonRPCPluginBase : IAsyncPlugin, IContextMenu, ISettingProvider, ISavable
37+
public abstract class JsonRPCPluginBase : IAsyncPlugin, IContextMenu, ISettingProvider, ISavable
3838
{
3939
protected PluginInitContext Context;
4040
public const string JsonRPC = "JsonRPC";
@@ -157,6 +157,11 @@ public void Save()
157157
Settings?.Save();
158158
}
159159

160+
public bool NeedCreateSettingPanel()
161+
{
162+
return Settings.NeedCreateSettingPanel();
163+
}
164+
160165
public Control CreateSettingPanel()
161166
{
162167
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.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;
@@ -201,6 +202,9 @@ public CustomBrowserViewModel CustomBrowser
201202
}
202203
};
203204

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

Flow.Launcher/App.xaml.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,8 @@ private async void OnStartupAsync(object sender, StartupEventArgs e)
112112
{
113113
await Stopwatch.NormalAsync("|App.OnStartup|Startup cost", async () =>
114114
{
115+
Log.SetLogLevel(_settings.LogLevel);
116+
115117
Ioc.Default.GetRequiredService<Portable>().PreStartCleanUpAfterPortabilityUpdate();
116118

117119
Log.Info("|App.OnStartup|Begin Flow Launcher startup ----------------------------------------------------");

Flow.Launcher/Flow.Launcher.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@
104104
<PackageReference Include="NHotkey.Wpf" Version="3.0.0" />
105105
<PackageReference Include="PropertyChanged.Fody" Version="3.4.0" />
106106
<PackageReference Include="SemanticVersioning" Version="3.0.0" />
107-
<PackageReference Include="Jack251970.TaskScheduler" Version="2.12.1" />
107+
<PackageReference Include="TaskScheduler" Version="2.12.1" />
108108
<PackageReference Include="VirtualizingWrapPanel" Version="2.1.1" />
109109
</ItemGroup>
110110

Flow.Launcher/Languages/en.xaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,12 +104,13 @@
104104
<system:String x:Key="AlwaysPreview">Always Preview</system:String>
105105
<system:String x:Key="AlwaysPreviewToolTip">Always open preview panel when Flow activates. Press {0} to toggle preview.</system:String>
106106
<system:String x:Key="shadowEffectNotAllowed">Shadow effect is not allowed while current theme has blur effect enabled</system:String>
107-
<system:String x:Key="shadowEffectRestart">The shadow effect transition takes effect after the program restarts</system:String>
108-
<system:String x:Key="shadowEffectNotAllowedBlur">Translucent themes cannot turn off shadow effects</system:String>
109107
<system:String x:Key="BackdropTypesNone">None</system:String>
110108
<system:String x:Key="BackdropTypesAcrylic">Acrylic</system:String>
111109
<system:String x:Key="BackdropTypesMica">Mica</system:String>
112110
<system:String x:Key="BackdropTypesMicaAlt">Mica Alt</system:String>
111+
<system:String x:Key="logLevel">Log level</system:String>
112+
<system:String x:Key="LogLevelDEBUG">Debug</system:String>
113+
<system:String x:Key="LogLevelINFO">Info</system:String>
113114

114115
<!-- Setting Plugin -->
115116
<system:String x:Key="searchplugin">Search Plugin</system:String>

0 commit comments

Comments
 (0)