Fix Don'tHideAfterAction logic for JsonRPCPlugin.cs

This commit is contained in:
Kevin Zhang 2021-06-10 11:21:58 +08:00
parent a5f5c091be
commit aa3e7decd8

View file

@ -84,27 +84,34 @@ namespace Flow.Launcher.Core.Plugin
{ {
if (result.JsonRPCAction == null) return false; if (result.JsonRPCAction == null) return false;
if (!string.IsNullOrEmpty(result.JsonRPCAction.Method)) if (string.IsNullOrEmpty(result.JsonRPCAction.Method))
{ {
if (result.JsonRPCAction.Method.StartsWith("Flow.Launcher.")) return !result.JsonRPCAction.DontHideAfterAction;
}
if (result.JsonRPCAction.Method.StartsWith("Flow.Launcher."))
{
ExecuteFlowLauncherAPI(result.JsonRPCAction.Method[14..],
result.JsonRPCAction.Parameters);
}
else
{
var actionResponse = ExecuteCallback(result.JsonRPCAction);
if (string.IsNullOrEmpty(actionResponse))
{ {
ExecuteFlowLauncherAPI(result.JsonRPCAction.Method[14..], return !result.JsonRPCAction.DontHideAfterAction;
result.JsonRPCAction.Parameters);
} }
else
JsonRPCRequestModel jsonRpcRequestModel =
JsonSerializer.Deserialize<JsonRPCRequestModel>(actionResponse);
if (jsonRpcRequestModel != null
&& !string.IsNullOrEmpty(jsonRpcRequestModel.Method)
&& jsonRpcRequestModel.Method.StartsWith("Flow.Launcher."))
{ {
string actionReponse = ExecuteCallback(result.JsonRPCAction); ExecuteFlowLauncherAPI(jsonRpcRequestModel.Method.Substring(4),
if (string.IsNullOrEmpty(actionReponse)) jsonRpcRequestModel.Parameters);
return false;
JsonRPCRequestModel jsonRpcRequestModel =
JsonSerializer.Deserialize<JsonRPCRequestModel>(actionReponse);
if (jsonRpcRequestModel != null
&& !string.IsNullOrEmpty(jsonRpcRequestModel.Method)
&& jsonRpcRequestModel.Method.StartsWith("Flow.Launcher."))
{
ExecuteFlowLauncherAPI(jsonRpcRequestModel.Method.Substring(4),
jsonRpcRequestModel.Parameters);
}
} }
} }