From aa3e7decd80e12c5c6e1add5e311237b4a4aa0f2 Mon Sep 17 00:00:00 2001 From: Kevin Zhang Date: Thu, 10 Jun 2021 11:21:58 +0800 Subject: [PATCH] Fix Don'tHideAfterAction logic for JsonRPCPlugin.cs --- Flow.Launcher.Core/Plugin/JsonRPCPlugin.cs | 41 +++++++++++++--------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/Flow.Launcher.Core/Plugin/JsonRPCPlugin.cs b/Flow.Launcher.Core/Plugin/JsonRPCPlugin.cs index 875f4fb3e..f684bc6aa 100644 --- a/Flow.Launcher.Core/Plugin/JsonRPCPlugin.cs +++ b/Flow.Launcher.Core/Plugin/JsonRPCPlugin.cs @@ -84,27 +84,34 @@ namespace Flow.Launcher.Core.Plugin { 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..], - result.JsonRPCAction.Parameters); + return !result.JsonRPCAction.DontHideAfterAction; } - else + + JsonRPCRequestModel jsonRpcRequestModel = + JsonSerializer.Deserialize(actionResponse); + + if (jsonRpcRequestModel != null + && !string.IsNullOrEmpty(jsonRpcRequestModel.Method) + && jsonRpcRequestModel.Method.StartsWith("Flow.Launcher.")) { - string actionReponse = ExecuteCallback(result.JsonRPCAction); - if (string.IsNullOrEmpty(actionReponse)) - return false; - JsonRPCRequestModel jsonRpcRequestModel = - JsonSerializer.Deserialize(actionReponse); - if (jsonRpcRequestModel != null - && !string.IsNullOrEmpty(jsonRpcRequestModel.Method) - && jsonRpcRequestModel.Method.StartsWith("Flow.Launcher.")) - { - ExecuteFlowLauncherAPI(jsonRpcRequestModel.Method.Substring(4), - jsonRpcRequestModel.Parameters); - } + ExecuteFlowLauncherAPI(jsonRpcRequestModel.Method.Substring(4), + jsonRpcRequestModel.Parameters); } }