From d29826dc4607e2143fe96405935f038f7be3c632 Mon Sep 17 00:00:00 2001 From: "sungwook79.park" Date: Thu, 21 Jul 2016 13:35:25 +0900 Subject: [PATCH] remove the legacy code for sms appcontrol Change-Id: I4f0c1d2dbd5a11355854179156913fe42f566857 Signed-off-by: sungwook79.park --- inc/w-input-keyboard.h | 3 +- inc/w-input-selector.h | 5 -- src/w-input-emoticon.cpp | 5 +- src/w-input-keyboard.cpp | 186 ++++++++++------------------------------------ src/w-input-selector.cpp | 152 ++++++------------------------------- src/w-input-stt-voice.cpp | 29 ++------ 6 files changed, 68 insertions(+), 312 deletions(-) diff --git a/inc/w-input-keyboard.h b/inc/w-input-keyboard.h index 192d005..4cff081 100755 --- a/inc/w-input-keyboard.h +++ b/inc/w-input-keyboard.h @@ -23,7 +23,6 @@ bool input_keyboard_init(app_control_h app_control); void input_keyboard_deinit(void); -bool input_keyboard_launch(Evas_Object *window); -bool input_keyboard_launch_with_ui(Evas_Object *window, void * data); +bool input_keyboard_launch(Evas_Object *window, void * data); #endif diff --git a/inc/w-input-selector.h b/inc/w-input-selector.h index 5bfbc5e..83c1799 100755 --- a/inc/w-input-selector.h +++ b/inc/w-input-selector.h @@ -45,7 +45,6 @@ enum { APP_TYPE_REPLY, APP_TYPE_HANDWRITING, APP_TYPE_KEYBOARD, - APP_TYPE_KEYBOARD_FROM_SMS, }; enum { @@ -80,9 +79,6 @@ typedef enum struct _InputKeyboardData { - char *app_id; - char **data_array; - int data_array_len; char *guide_text; char *default_text; }; @@ -94,7 +90,6 @@ typedef struct _InputKeyboardData InputKeyboardData; void _app_terminate(void* user_data); void reply_to_sender_by_callback_for_back(); void reply_to_sender_by_callback(const char *value, const char *type); -void reply_to_sender_by_appcontrol(void *data, const char *value, const char *type); char* get_resource_path(); char* get_shared_resource_path(); void show_gl_focus(Eina_Bool bVisible); diff --git a/src/w-input-emoticon.cpp b/src/w-input-emoticon.cpp index 2240448..db808bd 100755 --- a/src/w-input-emoticon.cpp +++ b/src/w-input-emoticon.cpp @@ -137,10 +137,7 @@ static void _rotary_selector_item_clicked(void *data, Evas_Object *obj, void *ev char* utf_8 = eina_unicode_unicode_to_utf8(unicode_event, &length); input_smartreply_send_feedback(utf_8); - if(ad->reply_type == REPLY_APP_CONTROL) - reply_to_sender_by_appcontrol(data, (const char*)utf_8, "emoticon"); - else - reply_to_sender_by_callback((const char*)utf_8, "emoticon"); + reply_to_sender_by_callback((const char*)utf_8, "emoticon"); PRINTFUNC(SECURE_DEBUG, "[%d]%s", i, utf_8); if (utf_8) diff --git a/src/w-input-keyboard.cpp b/src/w-input-keyboard.cpp index 6951c2e..486ffd8 100755 --- a/src/w-input-keyboard.cpp +++ b/src/w-input-keyboard.cpp @@ -36,9 +36,9 @@ static void input_keyboard_app_control_send_reply_cb(app_control_h request, app_ static void input_keyboard_app_control_send_reply_cb(app_control_h request, app_control_h reply, app_control_result_e result, void *user_data) { - char *feedback = NULL; + char *feedback = NULL; if (result == APP_CONTROL_RESULT_SUCCEEDED) { - if (reply) { + if (reply) { int ret; ret = app_control_get_extra_data(reply, "template_feedback", &feedback); @@ -50,7 +50,7 @@ static void input_keyboard_app_control_send_reply_cb(app_control_h request, app_ } } reply_to_sender_by_callback(feedback, "keyboard"); - free(feedback); + free(feedback); elm_exit(); } } @@ -59,194 +59,84 @@ static void input_keyboard_app_control_send_reply_cb(app_control_h request, app_ bool input_keyboard_init(app_control_h app_control) { int ret = -1; - - char *app_id = NULL; - char **data_array = NULL; - int data_array_len = -1; - char *default_text = NULL; - char *guide_text = NULL; + char *default_text = NULL; + char *guide_text = NULL; input_keyboard_deinit(); - ret = app_control_get_extra_data(app_control, APP_CONTROL_DATA_INPUT_DEFAULT_TEXT, &default_text); - if (ret == APP_CONTROL_ERROR_NONE) { - g_input_keyboard_data.default_text = default_text; - } - ret = app_control_get_extra_data(app_control, APP_CONTROL_DATA_INPUT_GUIDE_TEXT, &guide_text); - if (ret == APP_CONTROL_ERROR_NONE) { - g_input_keyboard_data.guide_text = guide_text; - } - - ret = app_control_get_extra_data(app_control, - "selector_keyboard_app_id", - &app_id); - - if (ret != APP_CONTROL_ERROR_NONE) { - PRINTFUNC(DLOG_WARN, "can not get selector_keyboard_app_id: %d", ret); - return false; + ret = app_control_get_extra_data(app_control, APP_CONTROL_DATA_INPUT_DEFAULT_TEXT, &default_text); + if (ret == APP_CONTROL_ERROR_NONE) { + g_input_keyboard_data.default_text = default_text; } - - ret = app_control_get_extra_data_array(app_control, - "selector_keyboard_data_array", - &data_array, &data_array_len); - - - if (ret != APP_CONTROL_ERROR_NONE) { - if (app_id) - free(app_id); - - PRINTFUNC(DLOG_WARN, "can not get selector_keyboard_data_array : %d", ret); - return false; + ret = app_control_get_extra_data(app_control, APP_CONTROL_DATA_INPUT_GUIDE_TEXT, &guide_text); + if (ret == APP_CONTROL_ERROR_NONE) { + g_input_keyboard_data.guide_text = guide_text; } - if (app_id) - g_input_keyboard_data.app_id = app_id; - - if (data_array) - g_input_keyboard_data.data_array = data_array; - - g_input_keyboard_data.data_array_len = data_array_len; - - PRINTFUNC(DLOG_WARN, "app_id = %s", app_id); - PRINTFUNC(DLOG_WARN, "data_array = %s", data_array); - return true; } void input_keyboard_deinit(void) { - int i = 0; - char **data_array = NULL; - if (g_input_keyboard_data.guide_text) free(g_input_keyboard_data.guide_text); if (g_input_keyboard_data.default_text) free(g_input_keyboard_data.default_text); - if (g_input_keyboard_data.app_id) - free(g_input_keyboard_data.app_id); - - data_array = g_input_keyboard_data.data_array; - if (data_array) { - for (i = 0; i < g_input_keyboard_data.data_array_len; i++) { - if (*(data_array + i)) - free(*(data_array + i)); - } - - free(data_array); - } - - g_input_keyboard_data.app_id = NULL; - g_input_keyboard_data.data_array = NULL; - g_input_keyboard_data.data_array_len = 0; + g_input_keyboard_data.default_text = NULL; + g_input_keyboard_data.guide_text = NULL; return; } -bool input_keyboard_launch(Evas_Object *window) -{ - int ret; - - char *app_id; - - app_control_h app_control; - - if (window == NULL) { - PRINTFUNC(DLOG_ERROR, "Can not get window"); - return false; - } - - ret = app_control_create(&app_control); - if (ret != APP_CONTROL_ERROR_NONE) { - PRINTFUNC(DLOG_ERROR, "Can not create app_control : %d", ret); - return false; - } - - app_id = g_input_keyboard_data.app_id; - if (app_id == NULL) { - PRINTFUNC(DLOG_INFO, "app id is undefined, use defualt"); - app_id = "com.samsung.message.appcontrol.compose"; - } - - app_control_set_app_id(app_control, app_id); - app_control_set_operation(app_control, APP_CONTROL_OPERATION_DEFAULT); -/* - ret = app_control_set_window(app_control, - elm_win_xwindow_get(window)); - if (ret != APP_CONTROL_ERROR_NONE) { - PRINTFUNC(DLOG_ERROR, "Can not app control set window : %d", ret); - app_control_destroy(app_control); - return false; - } -*/ - if (g_input_keyboard_data.data_array && g_input_keyboard_data.data_array_len > 0) { - app_control_add_extra_data_array(app_control, - "selector_keyboard_data_array", - (const char**)(g_input_keyboard_data.data_array), - g_input_keyboard_data.data_array_len); - } - - set_source_caller_app_id(app_control); - - ret = app_control_send_launch_request(app_control, - input_keyboard_app_control_send_reply_cb, - NULL); - if (ret != APP_CONTROL_ERROR_NONE) - PRINTFUNC(DLOG_ERROR, "Can not launch app_control: %d", ret); - - app_control_destroy(app_control); - - return true; -} - void btn_clicked_cb(void *data, Evas_Object *obj, void *event_info) { - app_control_h app_control; - int ret = app_control_create(&app_control); + app_control_h app_control; + int ret = app_control_create(&app_control); if (ret != APP_CONTROL_ERROR_NONE) { PRINTFUNC(DLOG_ERROR, "Can not create app_control : %d", ret); return; } - const char *getText = elm_entry_entry_get(entry); - LOGD("button key clicked!! : getText = %s", getText); + const char *getText = elm_entry_entry_get(entry); + LOGD("button key clicked!! : getText = %s", getText); - if (getText) - input_smartreply_send_feedback(getText); + if (getText) + input_smartreply_send_feedback(getText); - char *app_id = NULL; - app_control_get_caller(app_data->source_app_control, &app_id); - if (app_id != NULL) - app_control_set_app_id(app_control, app_id); + char *app_id = NULL; + app_control_get_caller(app_data->source_app_control, &app_id); + if (app_id != NULL) + app_control_set_app_id(app_control, app_id); app_control_set_operation(app_control, APP_CONTROL_OPERATION_DEFAULT); - set_source_caller_app_id(app_control); - free(app_id); + set_source_caller_app_id(app_control); + free(app_id); reply_to_sender_by_callback(getText, "keyboard"); elm_exit(); } static Eina_Bool custom_back_cb(void *data, Elm_Object_Item *it) { - _back_to_genlist_for_selector(); - return EINA_TRUE; + _back_to_genlist_for_selector(); + return EINA_TRUE; } void create_fullscreen_editor(void *data) { App_Data *ad = (App_Data *)data; - Evas_Object *box = elm_box_add(ad->naviframe); - evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_show(box); - elm_win_resize_object_add(ad->naviframe, box); + Evas_Object *box = elm_box_add(ad->naviframe); + evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(box); + elm_win_resize_object_add(ad->naviframe, box); - entry = elm_entry_add(box); + entry = elm_entry_add(box); elm_entry_single_line_set(entry, EINA_TRUE); elm_entry_scrollable_set(entry, EINA_TRUE); elm_scroller_policy_set(entry, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO); elm_object_part_text_set(entry, "elm.guide", g_input_keyboard_data.guide_text); - elm_entry_entry_set(entry, g_input_keyboard_data.default_text); + elm_entry_entry_set(entry, g_input_keyboard_data.default_text); elm_entry_cursor_end_set(entry); evas_object_size_hint_weight_set(entry, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(entry, EVAS_HINT_FILL, EVAS_HINT_FILL); @@ -263,16 +153,16 @@ void create_fullscreen_editor(void *data) evas_object_resize(ad->naviframe, 360, 360); evas_object_show(ad->naviframe); - Elm_Object_Item *nf_item = elm_naviframe_item_push(ad->naviframe, NULL, NULL, NULL, box, "empty"); - elm_naviframe_item_pop_cb_set(nf_item, custom_back_cb, NULL); + Elm_Object_Item *nf_item = elm_naviframe_item_push(ad->naviframe, NULL, NULL, NULL, box, "empty"); + elm_naviframe_item_pop_cb_set(nf_item, custom_back_cb, NULL); } -bool input_keyboard_launch_with_ui(Evas_Object *window, void *data) { +bool input_keyboard_launch(Evas_Object *window, void *data) { if (window == NULL) { PRINTFUNC(DLOG_ERROR, "Can not get window"); return false; } - create_fullscreen_editor(data); - return true; + create_fullscreen_editor(data); + return true; } diff --git a/src/w-input-selector.cpp b/src/w-input-selector.cpp index ea4a41b..33befa9 100755 --- a/src/w-input-selector.cpp +++ b/src/w-input-selector.cpp @@ -186,31 +186,27 @@ static void _keyboard_clicked_cb(void *data, Evas_Object * obj, void *event_info if (!ad) return; - if (app_data->app_type == APP_TYPE_KEYBOARD_FROM_SMS) - input_keyboard_launch(ad->win_main); - else - input_keyboard_launch_with_ui(ad->win_main, data); + input_keyboard_launch(ad->win_main, data); } static void __bt_connection_result_cb(app_control_h request, app_control_h reply, app_control_result_e result, void *user_data) { - char *val = NULL; - - if (reply == NULL) { - PRINTFUNC(DLOG_ERROR, "service_h is NULL"); - return; - } - - app_control_get_extra_data(reply, "__BT_CONNECTION__", &val); - if (val) { - if ( strcmp(val, "Connected") == 0 ) { - PRINTFUNC(DLOG_ERROR, "BT Connected"); - } else { - PRINTFUNC(DLOG_ERROR, "BT Not Connected"); - } - - free(val); - } + char *val = NULL; + + if (reply == NULL) { + PRINTFUNC(DLOG_ERROR, "service_h is NULL"); + return; + } + + app_control_get_extra_data(reply, "__BT_CONNECTION__", &val); + if (val) { + if ( strcmp(val, "Connected") == 0 ) { + PRINTFUNC(DLOG_ERROR, "BT Connected"); + } else { + PRINTFUNC(DLOG_ERROR, "BT Not Connected"); + } + free(val); + } } @@ -227,14 +223,9 @@ static void __ise_smartreply_gl_sel(void *data, Evas_Object *obj, void *event_in char *reply = input_smartreply_get_nth_item(index); if (reply) { input_smartreply_send_feedback(reply); - if(app_data->reply_type == REPLY_APP_CONTROL){ - reply_to_sender_by_appcontrol((void*)app_data, reply, "smartreply"); - free(reply); - } else { - reply_to_sender_by_callback(reply, "smartreply"); - free(reply); - elm_exit(); - } + reply_to_sender_by_callback(reply, "smartreply"); + free(reply); + elm_exit(); } } } @@ -285,19 +276,15 @@ static void __ise_template_gl_sel(void *data, Evas_Object *obj, void *event_info //@ToDo : should call reply function when any template string is selected and confirmed. // Here reply string will be template_list[index].text.c_str(); if( index < template_list.size()) { - if(app_data->reply_type == REPLY_APP_CONTROL){ - reply_to_sender_by_appcontrol((void*)app_data, gettext(template_list[index].text.c_str()), "template"); - } else { - reply_to_sender_by_callback(gettext(template_list[index].text.c_str()), "template"); - elm_exit(); - } + reply_to_sender_by_callback(gettext(template_list[index].text.c_str()), "template"); + elm_exit(); } } } static Evas_Object * __ise_gl_3button_content_get(void *data, Evas_Object *obj, const char *part) { - if (!strcmp(part, "elm.icon.1") || (!strcmp(part, "elm.icon.2")) || (!strcmp(part, "elm.icon.3"))) { + if (!strcmp(part, "elm.icon.1") || (!strcmp(part, "elm.icon.2")) || (!strcmp(part, "elm.icon.3"))) { Evas_Object* btn = elm_button_add(obj); evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, EVAS_HINT_FILL); @@ -518,78 +505,6 @@ void set_source_caller_app_id(app_control_h app_control) } } -void reply_to_sender_by_appcontrol(void *data, const char *value, const char *type) -{ - PRINTFUNC(DLOG_DEBUG, ""); - - int ret; - char *app_id; - - app_control_h app_control; - - App_Data *appdata = (App_Data *)data; - - if(!appdata){ - PRINTFUNC(DLOG_ERROR, "Null pointer"); - return; - } - - ret = app_control_create(&app_control); - if (ret != APP_CONTROL_ERROR_NONE) { - PRINTFUNC(DLOG_ERROR, "Can not create app_control : %d", ret); - return; - } - - app_id = g_input_keyboard_data.app_id; - if (app_id == NULL) { - PRINTFUNC(DLOG_INFO, "app id is undefined, use defualt"); - app_id = "com.samsung.message.appcontrol.compose"; - } - - if(!strcmp(app_id, "com.samsung.message.appcontrol.compose")){ - app_id = "com.samsung.msg-send"; - } - - app_control_set_app_id(app_control, app_id); - app_control_set_operation(app_control, APP_CONTROL_OPERATION_DEFAULT); -/* - ret = app_control_set_window(app_control, - elm_win_xwindow_get(appdata->win_main)); - if (ret != APP_CONTROL_ERROR_NONE) { - PRINTFUNC(DLOG_ERROR, "Can not app control set window : %d", ret); - app_control_destroy(app_control); - return; - } -*/ - if (g_input_keyboard_data.data_array && g_input_keyboard_data.data_array_len > 0) { - app_control_add_extra_data_array(app_control, - "selector_keyboard_data_array", - (const char**)(g_input_keyboard_data.data_array), - g_input_keyboard_data.data_array_len); - } - - app_control_add_extra_data(app_control, "selector_send_data_array", "sending_popup"); - - if (value) - app_control_add_extra_data(app_control, "selected_context", value); - - if (type) - app_control_add_extra_data(app_control, "reply_type", type); - - set_source_caller_app_id(app_control); - - ret = app_control_send_launch_request(app_control, - _app_control_send_reply_cb, - NULL); - - if (ret != APP_CONTROL_ERROR_NONE) - PRINTFUNC(DLOG_ERROR, "Can not launch app_control: %d", ret); - - app_control_destroy(app_control); - - return; -} - void reply_to_sender_by_callback(const char *value, const char *type) { PRINTFUNC(DLOG_DEBUG, ""); @@ -1228,25 +1143,9 @@ void _app_service(app_control_h service, void* user_data) int ret; bool b_ret; char *context = NULL; - char *app_id = NULL; app_control_clone(&(app_data->source_app_control), service); - app_data->reply_type = REPLY_APP_NORMAL; - ret = app_control_get_extra_data(service, "selector_keyboard_app_id", &app_id); - if (ret == APP_CONTROL_ERROR_NONE) { - PRINTFUNC(DLOG_DEBUG, "app_id = %s", app_id); - } - - if(app_id){ - if(!strcmp(app_id, "com.samsung.message.appcontrol.compose") || !strcmp(app_id, "com.samsung.wemail-send")) { - app_data->reply_type = REPLY_APP_CONTROL; - } else { - app_data->reply_type = REPLY_APP_NORMAL; - } - } - if (app_id) - free(app_id); bool is_type_reply = false; ret = app_control_get_extra_data(service, APP_CONTROL_DATA_INPUT_TYPE, &context); @@ -1264,11 +1163,6 @@ void _app_service(app_control_h service, void* user_data) input_keyboard_init(service); _keyboard_clicked_cb((void *)app_data, NULL, NULL); goto ACTIVATE; - } else if (!strcmp(context, "keyboard_input_from_sms")) { - app_data->app_type = APP_TYPE_KEYBOARD_FROM_SMS; - input_keyboard_init(service); - _keyboard_clicked_cb((void *)app_data, NULL, NULL); - goto ACTIVATE; } else if (!strcmp(context, "input_reply")) { app_data->app_type = APP_TYPE_REPLY; is_type_reply = true; diff --git a/src/w-input-stt-voice.cpp b/src/w-input-stt-voice.cpp index ed41fc0..1fd68c9 100755 --- a/src/w-input-stt-voice.cpp +++ b/src/w-input-stt-voice.cpp @@ -480,14 +480,10 @@ static void on_confirm_button_clicked_cb(void *data, Evas_Object *obj, void *eve PRINTFUNC(DLOG_DEBUG, "result_text = %s", result_text.c_str()); input_smartreply_send_feedback(result_text.c_str()); - if(app_data->reply_type == REPLY_APP_CONTROL){ - reply_to_sender_by_appcontrol((void*)app_data, result_text.c_str(), "voice"); - } else { - reply_to_sender_by_callback(result_text.c_str(), "voice"); - destroy_voice(); - powerUnlock(); - elm_exit(); - } + reply_to_sender_by_callback(result_text.c_str(), "voice"); + destroy_voice(); + powerUnlock(); + elm_exit(); return; } @@ -1765,22 +1761,7 @@ static Evas_Object *create_fullview(Evas_Object *parent, VoiceData *r_voicedata) panel = elm_panel_add(panel_layout); elm_panel_orient_set(panel, ELM_PANEL_ORIENT_LEFT); elm_layout_theme_set(panel, "panel", "left_confirm", "default"); - if(app_data->source_app_control){ - int ret; - char *app_id = NULL; - ret = app_control_get_extra_data(app_data->source_app_control, "selector_keyboard_app_id", &app_id); - if (ret == APP_CONTROL_ERROR_NONE) { - PRINTFUNC(DLOG_DEBUG, "app_id = %s", app_id); - } - - if(app_id){ - if(!strcmp(app_id, "com.samsung.message.appcontrol.compose") - || !strcmp(app_id, "com.samsung.wemail-send")){ - elm_layout_theme_set(panel, "panel", "left_sending", "default"); - } - free(app_id); - } - } + elm_layout_theme_set(panel, "panel", "left_sending", "default"); elm_layout_signal_callback_add(panel, "cue,clicked", "elm", _panel_cue_clicked_cb, (void *) voicedata); evas_object_show(panel); -- 2.7.4