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,8 +84,11 @@ 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))
{ {
return !result.JsonRPCAction.DontHideAfterAction;
}
if (result.JsonRPCAction.Method.StartsWith("Flow.Launcher.")) if (result.JsonRPCAction.Method.StartsWith("Flow.Launcher."))
{ {
ExecuteFlowLauncherAPI(result.JsonRPCAction.Method[14..], ExecuteFlowLauncherAPI(result.JsonRPCAction.Method[14..],
@ -93,11 +96,16 @@ namespace Flow.Launcher.Core.Plugin
} }
else else
{ {
string actionReponse = ExecuteCallback(result.JsonRPCAction); var actionResponse = ExecuteCallback(result.JsonRPCAction);
if (string.IsNullOrEmpty(actionReponse))
return false; if (string.IsNullOrEmpty(actionResponse))
{
return !result.JsonRPCAction.DontHideAfterAction;
}
JsonRPCRequestModel jsonRpcRequestModel = JsonRPCRequestModel jsonRpcRequestModel =
JsonSerializer.Deserialize<JsonRPCRequestModel>(actionReponse); JsonSerializer.Deserialize<JsonRPCRequestModel>(actionResponse);
if (jsonRpcRequestModel != null if (jsonRpcRequestModel != null
&& !string.IsNullOrEmpty(jsonRpcRequestModel.Method) && !string.IsNullOrEmpty(jsonRpcRequestModel.Method)
&& jsonRpcRequestModel.Method.StartsWith("Flow.Launcher.")) && jsonRpcRequestModel.Method.StartsWith("Flow.Launcher."))
@ -106,7 +114,6 @@ namespace Flow.Launcher.Core.Plugin
jsonRpcRequestModel.Parameters); jsonRpcRequestModel.Parameters);
} }
} }
}
return !result.JsonRPCAction.DontHideAfterAction; return !result.JsonRPCAction.DontHideAfterAction;
}; };