From 56549abbd3c454b0a0b0ce816e1c72c4bc987bbd Mon Sep 17 00:00:00 2001 From: "sungwook79.park" Date: Fri, 2 Jun 2017 17:38:20 +0900 Subject: [PATCH] Add smartreply feature Change-Id: I70c7ccfacb4e8da428a96e9f55167b9676d0db17 Signed-off-by: sungwook79.park --- CMakeLists.txt | 2 + inc/w-input-smartreply.h | 49 ++++ packaging/org.tizen.inputdelegator.spec | 1 + src/w-input-selector.cpp | 206 +++++++++++++- src/w-input-smartreply.cpp | 462 ++++++++++++++++++++++++++++++++ 5 files changed, 718 insertions(+), 2 deletions(-) create mode 100644 inc/w-input-smartreply.h create mode 100644 src/w-input-smartreply.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 85287b4..95b2d21 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,6 +14,7 @@ SET(INPUTDELEGATOR_SRCS src/WInputSttMicEffect.cpp src/w-input-stt-voice.cpp src/w-input-template.cpp + src/w-input-smartreply.cpp ) SET(INPUTDELEGATOR_PACKAGE ${PROJECT_NAME}) @@ -49,6 +50,7 @@ SET(PKGS_CHECK_MODULES sqlite3 capi-media-audio-io capi-system-info + smartreply ) diff --git a/inc/w-input-smartreply.h b/inc/w-input-smartreply.h new file mode 100644 index 0000000..619116f --- /dev/null +++ b/inc/w-input-smartreply.h @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef _W_INPUT_SMARTREPLY_H_ +#define _W_INPUT_SMARTREPLY_H_ + +#include +#include + +typedef void (*input_smartreply_changed)(void *user_data); + + +bool input_smartreply_init(app_control_h app_control); + +void input_smartreply_deinit(void); + +const char *input_smartreply_get_lang(void); + +bool input_smartreply_get_reply(void); + +bool input_smartreply_get_reply_async(void); + +int input_smartreply_get_reply_num(void); + +char *input_smartreply_get_nth_item(int index, int *type); + +bool input_smartreply_send_feedback(const char *str); + +void input_smartreply_set_notify(input_smartreply_changed callback, + void *user_data); + +void input_smartreply_unset_notify(void); + +bool input_smartreply_is_enabled(void); + +#endif diff --git a/packaging/org.tizen.inputdelegator.spec b/packaging/org.tizen.inputdelegator.spec index 5d55508..33bf2d9 100755 --- a/packaging/org.tizen.inputdelegator.spec +++ b/packaging/org.tizen.inputdelegator.spec @@ -41,6 +41,7 @@ BuildRequires: pkgconfig(db-util) BuildRequires: pkgconfig(sqlite3) BuildRequires: pkgconfig(capi-media-audio-io) BuildRequires: pkgconfig(capi-system-info) +BuildRequires: pkgconfig(smartreply) %if %{enable_log_manager} BuildRequires: pkgconfig(bundle) diff --git a/src/w-input-selector.cpp b/src/w-input-selector.cpp index 010d98b..d6feeec 100755 --- a/src/w-input-selector.cpp +++ b/src/w-input-selector.cpp @@ -30,6 +30,7 @@ #include "w-input-keyboard.h" #include "w-input-stt-ise.h" #include "w-input-emoticon.h" +#include "w-input-smartreply.h" #include @@ -44,6 +45,7 @@ InputTypeData g_input_type_data; static Elm_Object_Item *it_empty; static Elm_Object_Item *it_title; +static unsigned int g_smartreply_item_size = 0; /* Current Smartreply item size */ static unsigned int g_template_item_size = 0; /* Current Template item size */ Evas_Coord last_step; // 0 ~ 9 for gesture, 10~11 for rotary @@ -89,11 +91,14 @@ Evas_Object* _create_genlist(Evas_Object* parent); void _create_genlist_items(void* user_data); void _create_header_items(void *user_data); void _update_genlist_items(void *user_data); +unsigned int _update_smartreply_items(void *user_data); unsigned int _update_template_items(void *user_data); static void _popup_close_cb(void *data, Evas_Object *obj, void *event_info); static void _popup_back_cb(void *data, Evas_Object *obj, void *event_info); static void input_type_deinit(void); +bool __compare_string(const char * src, const char * dst); + void _init_app_data(App_Data* app_data) { app_data->win_main = NULL; @@ -168,6 +173,12 @@ static void _stt_clicked_cb(void *data, Evas_Object * obj, void *event_info) ise_show_stt_popup(ad); } +static void _input_smartreply_notify_cb(void *user_data) +{ + ecore_main_loop_iterate(); + _update_genlist_items((void *)app_data); +} + static void _input_template_notify_cb(void *user_data) { _update_genlist_items((void *)app_data); @@ -197,6 +208,27 @@ static void _keyboard_clicked_cb(void *data, Evas_Object * obj, void *event_info input_keyboard_launch(ad->win_main, data); } +static void __ise_smartreply_gl_sel(void *data, Evas_Object *obj, void *event_info) +{ + App_Data* app_data = (App_Data*) data; + Elm_Object_Item *item = (Elm_Object_Item *) event_info; + + if (item) { + elm_genlist_item_selected_set(item, EINA_FALSE); + + int index = (intptr_t) elm_object_item_data_get(item); + + int type; + char *reply = input_smartreply_get_nth_item(index, &type); + if (reply) { + input_smartreply_send_feedback(reply); + reply_to_sender_by_callback(reply, "smartreply"); + free(reply); + elm_exit(); + } + } +} + static void __ise_template_gl_sel(void *data, Evas_Object *obj, void *event_info) { Elm_Object_Item *item = (Elm_Object_Item *) event_info; @@ -407,6 +439,23 @@ static Evas_Object * __ise_gl_3button_content_get(void *data, Evas_Object *obj, return NULL; } +static char * __ise_smartreply_gl_text_get(void *data, Evas_Object *obj, const char *part) +{ + if(!strcmp(part, "elm.text")) { + int index; + char *reply = NULL; + index = (intptr_t)data; + if (index < 0) + return NULL; + + reply = input_smartreply_get_nth_item(index, NULL); + if (reply == NULL) + return NULL; + + return reply; + } + return NULL; +} static void __ise_gl_lang_changed(void *data, Evas_Object *obj, void *event_info) { @@ -771,6 +820,11 @@ void _update_genlist_items(void *user_data) _create_header_items(user_data); + if (input_smartreply_is_enabled()) + g_smartreply_item_size = _update_smartreply_items(user_data); + else + g_smartreply_item_size = 0; + g_template_item_size = _update_template_items(user_data); /* Update genlist item position */ @@ -778,11 +832,111 @@ void _update_genlist_items(void *user_data) elm_genlist_item_show(item, ELM_GENLIST_ITEM_SCROLLTO_MIDDLE); } +unsigned int _update_smartreply_items(void *user_data) +{ + App_Data* app_data; + + Elm_Object_Item *first; + Elm_Object_Item *menu; + Elm_Object_Item *pos; + + unsigned int i = 0; + unsigned int len = 0; + unsigned int item_size = 0; + + app_data = (App_Data *)user_data; + + if (app_data == NULL) { + PRINTFUNC(DLOG_ERROR, "Can not get app_data"); + return item_size; + } + + if (app_data->genlist == NULL) { + /* smartreply will update when genlist is exist only */ + PRINTFUNC(DLOG_ERROR, "Can not get getlist"); + return item_size; + } + + /* Move to smartreply */ + first = elm_genlist_first_item_get(app_data->genlist); + menu = elm_genlist_item_next_get(first); + + if (input_smartreply_is_enabled() == false) + return item_size; + + /* Append newly added smartreply list */ + len = input_smartreply_get_reply_num(); + + if (len > 0) { + const std::vector template_list = input_template_get_list(); + + Elm_Genlist_Item_Class *itc; + + itc = elm_genlist_item_class_new(); + itc->item_style = "1text"; + itc->func.text_get = __ise_smartreply_gl_text_get; + itc->func.content_get = NULL; + itc->func.state_get = NULL; + itc->func.del = NULL; + + pos = menu; + + for (i = 0; i < len; i++) { + char *reply = "hello"; + unsigned int j; + bool matched; + + matched = false; + + int type; + reply = input_smartreply_get_nth_item(i, &type); + if (reply == NULL) + continue; + PRINTFUNC(DLOG_DEBUG, "SmartReply = [%d]%s", i, reply); + + + for (j = 0; j < template_list.size(); j++) { + const char *template_str; + + if (template_list[j].use_gettext) + template_str = gettext(template_list[j].text.c_str()); + else + template_str = template_list[j].text.c_str(); + + if (!__compare_string(reply, template_str)) { + matched = true; + break; + } + } + + if (matched == true) + continue; + + pos = elm_genlist_item_append(app_data->genlist, + itc, + (void *)(uintptr_t)i, + NULL, + ELM_GENLIST_ITEM_NONE, + __ise_smartreply_gl_sel, + app_data); + + item_size++; + if (item_size >= 3) + break; + } + elm_genlist_item_class_free(itc); + } + return item_size; +} + + unsigned int _update_template_items(void *user_data) { App_Data* app_data; Elm_Object_Item *first; + Elm_Object_Item *menu; + Elm_Object_Item *pos; unsigned int i = 0; unsigned int item_size = 0; @@ -803,7 +957,20 @@ unsigned int _update_template_items(void *user_data) first = elm_genlist_first_item_get(app_data->genlist); if (first == NULL) return 0; - elm_genlist_item_next_get(first); + menu = elm_genlist_item_next_get(first); + + pos = menu; + /* move to smartreply next if it need */ + if (input_smartreply_is_enabled()) { + unsigned int j = 0; + + for (j = 0; j < g_smartreply_item_size; j++) { + if (pos == NULL) + break; + + pos = elm_genlist_item_next_get(pos); + } + } /* Append New Template list */ const std::vector template_list = input_template_get_list(); @@ -820,7 +987,7 @@ unsigned int _update_template_items(void *user_data) itc->func.del = NULL; for (i = 0; i < template_list.size(); i++) { - elm_genlist_item_append(app_data->genlist, + pos = elm_genlist_item_append(app_data->genlist, itc, (void *)(uintptr_t)i, NULL, @@ -835,6 +1002,34 @@ unsigned int _update_template_items(void *user_data) return item_size; } +bool __compare_string(const char * smart_str, const char * template_str) +{ + int src_len = 0; + int dst_len = 0; + bool ret = true; + + if(!smart_str||!template_str) + return ret; + + src_len = strlen(smart_str); + dst_len = strlen(template_str); + + if(smart_str[src_len-1] == '.') + src_len--; + + while(template_str[dst_len-1] == ' ') + dst_len--; + if(template_str[dst_len-1] == '.') + dst_len--; + + dst_len = (dst_len > src_len)? dst_len : src_len; + + if(!strncmp(smart_str, template_str, (size_t)dst_len)) + ret = false; + + return (ret); +} + bool _app_create(void* user_data) { int width = 1000, height = 1000; @@ -957,6 +1152,12 @@ void _app_service(app_control_h service, void* user_data) input_keyboard_init(service); + input_smartreply_init(service); + input_smartreply_set_notify(_input_smartreply_notify_cb, NULL); + + if (input_smartreply_is_enabled()) + input_smartreply_get_reply_async(); + input_template_init(service); input_template_set_notify(_input_template_notify_cb, NULL); @@ -997,6 +1198,7 @@ void _app_terminate(void* user_data) free(app_data->shared_res_path); input_keyboard_deinit(); + input_smartreply_deinit(); input_template_unset_notify(); input_template_deinit(); diff --git a/src/w-input-smartreply.cpp b/src/w-input-smartreply.cpp new file mode 100644 index 0000000..aae5a0e --- /dev/null +++ b/src/w-input-smartreply.cpp @@ -0,0 +1,462 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "Debug.h" + +#include +#include +#include +#include + +#include +#include +//#include +#include + +#include "w-input-smartreply.h" + +#ifdef SUPPORT_SMART_ACTION +#include "w-input-smartaction.h" +#endif + +#ifndef INPUT_SMARTREPLY_VCONF +#define INPUT_SMARTREPLY_VCONF "db/wms/smart_reply" +#endif + + +typedef struct _InputSmartreplyData InputSmartreplyData; + +struct _InputSmartreplyData +{ + char *caller_id; + char *sender; + char *message; + char *lang; + + int enabled; + + input_smartreply_changed callback; + void *user_data; + + smartreply_reply_h *candidate_list; + int candidate_list_len; + bool enable_location; +}; + + +static void _input_smartreply_get_reply_callback(int handle, int error, + smartreply_reply_h* candidate_list, int length); +/* Disable smartreply on/off feature +static void _input_smartreply_vconf_changed(keynode_t *key, void *data); +*/ + + +static InputSmartreplyData *g_input_smartreply_data = NULL; + +static void _input_smartreply_get_reply_callback(int handle, int error, + smartreply_reply_h* candidate_list, int length) +{ + if (g_input_smartreply_data == NULL) { + PRINTFUNC(DLOG_ERROR, "InputSmartreplyData uninitialized"); + return; + } + + if (g_input_smartreply_data == NULL) { + PRINTFUNC(DLOG_ERROR, "InputSmartreplyData uninitialized"); + return; + } + + if (g_input_smartreply_data->candidate_list) { + int ret; + + ret = smartreply_service_destory_list(g_input_smartreply_data->candidate_list); + if (ret != SMARTREPLY_ERROR_NONE) + PRINTFUNC(DLOG_ERROR, "can not destroy list : %d", ret); + } + + if (error != SMARTREPLY_ERROR_NONE) { + PRINTFUNC(DLOG_ERROR, "can not get candidate list : %d", error); + + g_input_smartreply_data->candidate_list = NULL; + g_input_smartreply_data->candidate_list_len = 0; + + return; + } + + g_input_smartreply_data->candidate_list = candidate_list; + g_input_smartreply_data->candidate_list_len = length; + + if (g_input_smartreply_data->callback) + g_input_smartreply_data->callback(g_input_smartreply_data->user_data); +} + +static bool _smartreply_check_here_map_support(void) +{ + return true; +} + +/* Disable smartreply on/off feature +static void _input_smartreply_vconf_changed(keynode_t *key, void *data) +{ + int enabled = 0; + + if (g_input_smartreply_data == NULL) { + PRINTFUNC(DLOG_ERROR, "InputSmartreplyData uninitialized"); + return; + } + + enabled = vconf_keynode_get_int(key); + if (g_input_smartreply_data->enabled == enabled) + return; + + g_input_smartreply_data->enabled = enabled; + + if (g_input_smartreply_data->enabled && g_input_smartreply_data->candidate_list == NULL) { + input_smartreply_get_reply_async(); + return; + } + + if (g_input_smartreply_data->callback) + g_input_smartreply_data->callback(g_input_smartreply_data->user_data); +} +*/ + +bool input_smartreply_init(app_control_h app_control) +{ + int ret; + + char *caller_id = NULL; + char *sender = NULL; + char *message = NULL; + + /* Disable smartreply on/off feature + int enabled = 0; + */ + + ret = app_control_get_extra_data(app_control, + "template_context", &message); + + if (ret != APP_CONTROL_ERROR_NONE) { + PRINTFUNC(DLOG_WARN, "Can not get template_context %d", ret); + return false; + } + + ret = app_control_get_caller(app_control, &caller_id); + + if (ret != APP_CONTROL_ERROR_NONE) + PRINTFUNC(DLOG_WARN, "Can not get caller id %d", ret); + + ret = app_control_get_extra_data(app_control, + "template_sender", &sender); + + if (ret != APP_CONTROL_ERROR_NONE) + PRINTFUNC(DLOG_WARN, "Can not get template_sender %d", ret); + + if (g_input_smartreply_data == NULL) { + g_input_smartreply_data = (InputSmartreplyData *)calloc(1, sizeof(InputSmartreplyData)); + if (g_input_smartreply_data == NULL) { + PRINTFUNC(DLOG_ERROR, "Can not alloc InputSmartreplyData"); + if (message) + free(message); + + if (caller_id) + free(caller_id); + + if (sender) + free(sender); + + return false; + } + } + + if (g_input_smartreply_data->caller_id) + free(g_input_smartreply_data->caller_id); + + if (g_input_smartreply_data->sender) + free(g_input_smartreply_data->sender); + + if (g_input_smartreply_data->message) + free(g_input_smartreply_data->message); + + if (g_input_smartreply_data->lang) + free(g_input_smartreply_data->lang); + + if (g_input_smartreply_data->candidate_list) { + ret = smartreply_service_destory_list(g_input_smartreply_data->candidate_list); + if (ret != SMARTREPLY_ERROR_NONE) + PRINTFUNC(DLOG_ERROR, "can not destroy list : %d", ret); + } + + g_input_smartreply_data->caller_id = caller_id; + g_input_smartreply_data->sender = sender; + g_input_smartreply_data->message = message; + g_input_smartreply_data->lang = NULL; + + g_input_smartreply_data->enabled = 1; + + g_input_smartreply_data->callback = NULL; + g_input_smartreply_data->user_data = NULL; + + g_input_smartreply_data->candidate_list = NULL; + g_input_smartreply_data->candidate_list_len = 0; + + g_input_smartreply_data->enable_location = _smartreply_check_here_map_support(); + + + /* Disable smartreply on/off feature + ret = vconf_get_int(INPUT_SMARTREPLY_VCONF, &enabled); + if (ret == -1) + PRINTFUNC(DLOG_ERROR, "can not get vconf : %s", INPUT_SMARTREPLY_VCONF); + + g_input_smartreply_data->enabled = enabled; + + ret = vconf_notify_key_changed(INPUT_SMARTREPLY_VCONF, + _input_smartreply_vconf_changed, NULL); + if (ret == -1) + PRINTFUNC(DLOG_ERROR, "Can not create vconf notify : %s", INPUT_SMARTREPLY_VCONF); + */ + + return true; +} + +void input_smartreply_deinit(void) +{ + if (g_input_smartreply_data == NULL) { + PRINTFUNC(DLOG_WARN, "InputSmartreplyData uninitialized"); + return; + } + + if (g_input_smartreply_data->caller_id) + free(g_input_smartreply_data->caller_id); + + if (g_input_smartreply_data->sender) + free(g_input_smartreply_data->sender); + + if (g_input_smartreply_data->message) + free(g_input_smartreply_data->message); + + + if (g_input_smartreply_data->candidate_list) { + int ret; + + ret = smartreply_service_destory_list(g_input_smartreply_data->candidate_list); + if (ret != SMARTREPLY_ERROR_NONE) + PRINTFUNC(DLOG_ERROR, "can not destroy list : %d", ret); + } + + input_smartreply_unset_notify(); + + /* Disable smartreply on/off feature + vconf_ignore_key_changed(INPUT_SMARTREPLY_VCONF, + _input_smartreply_vconf_changed); + */ + + free(g_input_smartreply_data); + g_input_smartreply_data = NULL; + + return; +} + +bool input_smartreply_get_reply(void) +{ + int ret; + + smartreply_reply_h *candidate_list = NULL; + int candidate_list_len = 0; + + if (g_input_smartreply_data == NULL) { + PRINTFUNC(DLOG_ERROR, "InputSmartreplyData uninitialized"); + return false; + } + + if (g_input_smartreply_data->message == NULL) { + PRINTFUNC(DLOG_ERROR, "message is empty"); + return false; + } + + if (g_input_smartreply_data->enabled == 0) { + PRINTFUNC(DLOG_WARN, "Smartreply is disabled"); + return false; + } + + ret = smartreply_service_get_replies(g_input_smartreply_data->caller_id, + g_input_smartreply_data->sender, + g_input_smartreply_data->message, + &candidate_list, + &candidate_list_len); + + if (ret != SMARTREPLY_ERROR_NONE) { + PRINTFUNC(DLOG_ERROR, "Can not get replies : %d", ret); + return false; + } + + if (g_input_smartreply_data->candidate_list) { + ret = smartreply_service_destory_list(g_input_smartreply_data->candidate_list); + if (ret != SMARTREPLY_ERROR_NONE) + PRINTFUNC(DLOG_ERROR, "can not destroy list : %d", ret); + } + + g_input_smartreply_data->candidate_list = candidate_list; + g_input_smartreply_data->candidate_list_len = candidate_list_len; + + return true; +} + +bool input_smartreply_get_reply_async(void) +{ + int ret; + + if (g_input_smartreply_data == NULL) { + PRINTFUNC(DLOG_ERROR, "InputSmartreplyData uninitialized"); + return false; + } + + if (g_input_smartreply_data->message == NULL) { + PRINTFUNC(DLOG_ERROR, "message is empty"); + return false; + } + + if (g_input_smartreply_data->enabled == 0) { + PRINTFUNC(DLOG_WARN, "Smartreply is disabled"); + return false; + } + + ret = smartreply_service_get_replies_async(g_input_smartreply_data->caller_id, + g_input_smartreply_data->sender, + g_input_smartreply_data->message, + _input_smartreply_get_reply_callback); + + return true; +} + +int input_smartreply_get_reply_num(void) +{ + if (g_input_smartreply_data == NULL) { + PRINTFUNC(DLOG_ERROR, "InputSmartreplyData uninitialized"); + return 0; + } + + if (g_input_smartreply_data->enabled == 0) { + PRINTFUNC(DLOG_WARN, "Smartreply is disabled"); + return 0; + } + + return g_input_smartreply_data->candidate_list_len; +} + +char *input_smartreply_get_nth_item(int index, int *type) +{ + int ret; + char *message = NULL; + + if (g_input_smartreply_data == NULL) { + PRINTFUNC(DLOG_ERROR, "InputSmartreplyData uninitialized"); + return NULL; + } + + if (g_input_smartreply_data->candidate_list == NULL) { + PRINTFUNC(DLOG_ERROR, "Can not get candidate list"); + return NULL; + } + + if (g_input_smartreply_data->enabled == 0) { + PRINTFUNC(DLOG_WARN, "Smartreply is disabled"); + return NULL; + } + + + ret = smartreply_service_get_nth_reply_message(g_input_smartreply_data->candidate_list, + index, + &message); + + if (ret != SMARTREPLY_ERROR_NONE) { + PRINTFUNC(DLOG_ERROR, "Can not get message from index %d : %d", index, ret); + return NULL; + } + + return message; +} + +bool input_smartreply_send_feedback(const char *str) +{ + int ret; + + if (g_input_smartreply_data == NULL) { + PRINTFUNC(DLOG_ERROR, "InputSmartreplyData uninitialized"); + return false; + } + + if (str == NULL) { + PRINTFUNC(DLOG_ERROR, "str is empty"); + return false; + } + + ret = smartreply_service_record_user_reply(g_input_smartreply_data->caller_id, + g_input_smartreply_data->sender, + g_input_smartreply_data->message, + str); + + if (ret != SMARTREPLY_ERROR_NONE) { + PRINTFUNC(DLOG_ERROR, "Can not send feedback : %d", ret); + return false; + } + + return true; +} + + + +void input_smartreply_set_notify(input_smartreply_changed callback, + void *user_data) +{ + if (callback == NULL) { + PRINTFUNC(DLOG_ERROR, "empty callback function"); + return; + } + + if (g_input_smartreply_data == NULL) { + PRINTFUNC(DLOG_WARN, "InputSmartreplyData uninitialized"); + return; + } + + g_input_smartreply_data->callback = callback; + g_input_smartreply_data->user_data = user_data; +} + + +void input_smartreply_unset_notify(void) +{ + if (g_input_smartreply_data == NULL) { + PRINTFUNC(DLOG_WARN, "InputSmartreplyData uninitialized"); + return; + } + + g_input_smartreply_data->callback = NULL; + g_input_smartreply_data->user_data = NULL; +} + +bool input_smartreply_is_enabled(void) +{ + if (g_input_smartreply_data == NULL) { + PRINTFUNC(DLOG_WARN, "InputSmartreplyData uninitialized"); + return false; + } + + if (g_input_smartreply_data->enabled) + return true; + + return false; +} -- 2.7.4