mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Return results to tell users that this plugin is still initializing
This commit is contained in:
parent
9a20b0e0de
commit
297cb5c3ef
2 changed files with 57 additions and 0 deletions
|
|
@ -383,6 +383,28 @@ namespace Flow.Launcher.Core.Plugin
|
|||
var results = new List<Result>();
|
||||
var metadata = pair.Metadata;
|
||||
|
||||
if (IsPluginInitializing(metadata))
|
||||
{
|
||||
Result r = new()
|
||||
{
|
||||
Title = Localize.pluginStillInitializing(metadata.Name),
|
||||
SubTitle = Localize.pluginStillInitializingSubtitle(),
|
||||
IcoPath = metadata.IcoPath,
|
||||
PluginDirectory = metadata.PluginDirectory,
|
||||
ActionKeywordAssigned = query.ActionKeyword,
|
||||
PluginID = metadata.ID,
|
||||
OriginQuery = query,
|
||||
Action = _ =>
|
||||
{
|
||||
PublicApi.Instance.ReQuery();
|
||||
return false;
|
||||
},
|
||||
Score = -100
|
||||
};
|
||||
results.Add(r);
|
||||
return results;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var milliseconds = await PublicApi.Instance.StopwatchLogDebugAsync(ClassName, $"Cost for {metadata.Name}",
|
||||
|
|
@ -427,6 +449,28 @@ namespace Flow.Launcher.Core.Plugin
|
|||
var results = new List<Result>();
|
||||
var metadata = pair.Metadata;
|
||||
|
||||
if (IsPluginInitializing(metadata))
|
||||
{
|
||||
Result r = new()
|
||||
{
|
||||
Title = Localize.pluginStillInitializing(metadata.Name),
|
||||
SubTitle = Localize.pluginStillInitializingSubtitle(),
|
||||
IcoPath = metadata.IcoPath,
|
||||
PluginDirectory = metadata.PluginDirectory,
|
||||
ActionKeywordAssigned = query.ActionKeyword,
|
||||
PluginID = metadata.ID,
|
||||
OriginQuery = query,
|
||||
Action = _ =>
|
||||
{
|
||||
PublicApi.Instance.ReQuery();
|
||||
return false;
|
||||
},
|
||||
Score = -100
|
||||
};
|
||||
results.Add(r);
|
||||
return results;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var milliseconds = await PublicApi.Instance.StopwatchLogDebugAsync(ClassName, $"Cost for {metadata.Name}",
|
||||
|
|
@ -457,6 +501,12 @@ namespace Flow.Launcher.Core.Plugin
|
|||
var results = new List<DialogJumpResult>();
|
||||
var metadata = pair.Metadata;
|
||||
|
||||
if (IsPluginInitializing(metadata))
|
||||
{
|
||||
// null will be fine since the results will only be added into queue if the token hasn't been cancelled
|
||||
return null;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var milliseconds = await PublicApi.Instance.StopwatchLogDebugAsync(ClassName, $"Cost for {metadata.Name}",
|
||||
|
|
@ -482,6 +532,11 @@ namespace Flow.Launcher.Core.Plugin
|
|||
return results;
|
||||
}
|
||||
|
||||
private static bool IsPluginInitializing(PluginMetadata metadata)
|
||||
{
|
||||
return !_allInitializedPlugins.ContainsKey(metadata.ID);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Get Plugin List
|
||||
|
|
|
|||
|
|
@ -66,6 +66,8 @@
|
|||
<system:String x:Key="PositionReset">Position Reset</system:String>
|
||||
<system:String x:Key="PositionResetToolTip">Reset search window position</system:String>
|
||||
<system:String x:Key="queryTextBoxPlaceholder">Type here to search</system:String>
|
||||
<system:String x:Key="pluginStillInitializing">{0}: This plugin is still initializing!</system:String>
|
||||
<system:String x:Key="pluginStillInitializingSubtitle">Please wait for a while and select this result to requery</system:String>
|
||||
|
||||
<!-- Setting General -->
|
||||
<system:String x:Key="flowlauncher_settings">Settings</system:String>
|
||||
|
|
|
|||
Loading…
Reference in a new issue