diff options
Diffstat (limited to 'src/homescreen.cpp')
-rw-r--r-- | src/homescreen.cpp | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/homescreen.cpp b/src/homescreen.cpp index d9fef91..ae98643 100644 --- a/src/homescreen.cpp +++ b/src/homescreen.cpp @@ -37,6 +37,8 @@ const char _display_message[] = "display_message"; const char _reply_message[] = "reply_message"; const char _keyData[] = "data"; const char _keyId[] = "id"; +const char _parameter[] = "parameter"; +const char _area[] = "area"; struct hs_handshake { hs_handshake(int times, int sleep) : m_times(times), m_sleep(sleep) {} @@ -332,12 +334,16 @@ static void pingSample(afb_req_t request) static void tap_shortcut (afb_req_t request) { int ret = 0; + struct json_object *param_obj, *area_obj; const char* value = afb_req_value(request, _application_id); - if (value) { + if (value + && json_object_object_get_ex(afb_req_json(request), _parameter, ¶m_obj) + && json_object_object_get_ex(param_obj, _area, &area_obj)) { AFB_INFO("request appid = %s.", value); + const char* area = json_object_get_string(area_obj); ret = g_hs_instance->client_manager->handleRequest(request, __FUNCTION__, value); if(ret == AFB_REQ_NOT_STARTED_APPLICATION) { - g_hs_instance->client_manager->setStartupAppid(std::string(value)); + g_hs_instance->client_manager->setStartupAppidAndArea(make_pair(std::string(value), std::string(area))); std::string id = g_hs_instance->app_info->getAppProperty(value, _keyId); HS_AfmMainProxy afm_proxy; afm_proxy.start(request->api, id); @@ -486,11 +492,15 @@ static void unsubscribe(afb_req_t request) static void showWindow(afb_req_t request) { int ret = 0; + struct json_object *param_obj, *area_obj; const char* value = afb_req_value(request, _application_id); - if (value) { + if (value + && json_object_object_get_ex(afb_req_json(request), _parameter, ¶m_obj) + && json_object_object_get_ex(param_obj, _area, &area_obj)) { + const char* area = json_object_get_string(area_obj); ret = g_hs_instance->client_manager->handleRequest(request, __FUNCTION__, value); if(ret == AFB_REQ_NOT_STARTED_APPLICATION) { - g_hs_instance->client_manager->setStartupAppid(std::string(value)); + g_hs_instance->client_manager->setStartupAppidAndArea(make_pair(std::string(value), std::string(area))); std::string id = g_hs_instance->app_info->getAppProperty(value, _keyId); HS_AfmMainProxy afm_proxy; afm_proxy.start(request->api, id); |