mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Fix logic & Improve code quality
This commit is contained in:
parent
63f86613c3
commit
f808469285
2 changed files with 18 additions and 5 deletions
|
|
@ -533,7 +533,7 @@ namespace Flow.Launcher.Core.Plugin
|
|||
else
|
||||
{
|
||||
return [.. _allInitializedPlugins.Values
|
||||
.Where(p => !IsInitFailed(p.Metadata.ID))];
|
||||
.Where(p => !_initFailedPlugins.ContainsKey(p.Metadata.ID))];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -596,11 +596,24 @@ namespace Flow.Launcher.Core.Plugin
|
|||
|
||||
#endregion
|
||||
|
||||
#region Check Init Failed
|
||||
#region Check Initializing or Init Failed
|
||||
|
||||
public static bool IsInitFailed(string id)
|
||||
public static bool IsInitializingOrInitFailed(string id)
|
||||
{
|
||||
return _initFailedPlugins.ContainsKey(id);
|
||||
// Id does not exist in loaded plugins
|
||||
if (!_allLoadedPlugins.Any(x => x.Metadata.ID == id)) return false;
|
||||
|
||||
// Plugin initialized already
|
||||
if (_allInitializedPlugins.ContainsKey(id))
|
||||
{
|
||||
// Check if the plugin initialization failed
|
||||
return _initFailedPlugins.ContainsKey(id);
|
||||
}
|
||||
// Plugin is still initializing
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ namespace Flow.Launcher.ViewModel
|
|||
public Control BottomPart2 => IsExpanded ? _bottomPart2 ??= new InstalledPluginDisplayBottomData() : null;
|
||||
|
||||
public bool HasSettingControl =>
|
||||
!PluginManager.IsInitFailed(PluginPair.Metadata.ID) && // Do not show setting panel for init failed plugins
|
||||
!PluginManager.IsInitializingOrInitFailed(PluginPair.Metadata.ID) && // Do not show setting panel for initializing or init failed plugins
|
||||
PluginPair.Plugin is ISettingProvider &&
|
||||
(PluginPair.Plugin is not JsonRPCPluginBase jsonRPCPluginBase || // Is not JsonRPC plugin
|
||||
jsonRPCPluginBase.NeedCreateSettingPanel()); // Is JsonRPC plugin and need to create setting panel
|
||||
|
|
|
|||
Loading…
Reference in a new issue