diff --git a/window_scene/interfaces/kits/napi/scene_session_manager/js_rss_session.cpp b/window_scene/interfaces/kits/napi/scene_session_manager/js_rss_session.cpp index 313497e52e4b317a272dfe9193986bbad5c0f1a4..9c3d7258eda7d583ed04c84977ebf966b6c5a4a0 100644 --- a/window_scene/interfaces/kits/napi/scene_session_manager/js_rss_session.cpp +++ b/window_scene/interfaces/kits/napi/scene_session_manager/js_rss_session.cpp @@ -112,6 +112,11 @@ void SetMapValue(napi_env env, const std::string& key, const T& value, napi_valu napi_set_property(env, object, keyInfo, valueInfo); } +bool IsJsonString(const nlohmann::json& payload, const std::string& key) +{ + return payload.contains(key) && payload[key].is_string(); +} + napi_value RssSession::DealRssReply(napi_env env, const nlohmann::json& payload, const nlohmann::json& reply) { WLOGFI("[NAPI]"); @@ -122,6 +127,12 @@ napi_value RssSession::DealRssReply(napi_env env, const nlohmann::json& payload, return NapiGetUndefined(env); } + if (IsJsonString(reply, "resultType") && reply.at("resultType") == "loadSceneJudgement" && + IsJsonString(reply, "resultValue")) { + SetMapValue(env, "result", reply["resultValue"].get(), objValue); + return objValue; + } + if (!reply.contains("result") || !reply["result"].is_string() || reply.at("result") == "") { WLOGFE("Reply not find result key!"); return NapiGetUndefined(env);