Skip to content

Commit 1d625c9

Browse files
Jack251970Yusyuriv
andcommitted
Update Flow.Launcher.Core/Plugin/JsonRPCPluginSettings.cs
Co-authored-by: Yan Li <[email protected]>
1 parent ffc5047 commit 1d625c9

File tree

1 file changed

+13
-17
lines changed

1 file changed

+13
-17
lines changed

Flow.Launcher.Core/Plugin/JsonRPCPluginSettings.cs

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -65,26 +65,22 @@ public async Task InitializeAsync()
6565
foreach (var (type, attributes) in Configuration.Body)
6666
{
6767
// Skip if the setting does not have attributes or name
68-
if (attributes?.Name == null)
68+
if (attributes?.Name == null) continue;
69+
70+
// Skip if the setting does not have attributes or name
71+
if (!NeedSaveInSettings(type)) continue;
72+
73+
// If need save in settings, we need to make sure the setting exists in the settings file
74+
if (Settings.ContainsKey(attributes.Name)) continue;
75+
76+
if (type == "checkbox")
6977
{
70-
continue;
78+
// If can parse the default value to bool, use it, otherwise use false
79+
Settings[attributes.Name] = bool.TryParse(attributes.DefaultValue, out var value) && value;
7180
}
72-
73-
if (NeedSaveInSettings(type))
81+
else
7482
{
75-
// If need save in settings, we need to make sure the setting exists in the settings file
76-
if (!Settings.ContainsKey(attributes.Name))
77-
{
78-
if (type == "checkbox")
79-
{
80-
// If can parse the default value to bool, use it, otherwise use false
81-
Settings[attributes.Name] = bool.TryParse(attributes.DefaultValue, out var value) && value;
82-
}
83-
else
84-
{
85-
Settings[attributes.Name] = attributes.DefaultValue;
86-
}
87-
}
83+
Settings[attributes.Name] = attributes.DefaultValue;
8884
}
8985
}
9086
}

0 commit comments

Comments
 (0)