From 44a70e104dfe9581720f387bdfd3436ca7dfd5ad Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Tue, 8 Jan 2019 18:55:37 +0900 Subject: [PATCH] Add connection error message Change-Id: Ibf37850a6ee651b0f86465a630040592be697890 Signed-off-by: Jihoon Kim --- client/autofill.c | 9 +++++++++ client/autofill_auth.c | 5 +++++ client/autofill_fill_request.c | 5 +++++ include/autofill_private.h | 2 ++ 4 files changed, 21 insertions(+) diff --git a/client/autofill.c b/client/autofill.c index fdd0df9..b5220e0 100644 --- a/client/autofill.c +++ b/client/autofill.c @@ -190,6 +190,8 @@ static void __on_connected(rpc_port_proxy_AutofillAppPort_h h, void *user_data) return; } + ah->connected = true; + LOGI("connected"); rpc_port_AutofillAppPort_autofill_fill_response_received_cb_h fill_response_received_cb = rpc_port_AutofillAppPort_autofill_fill_response_received_cb_create(__fill_response_recv_cb, false, ah); rpc_port_AutofillAppPort_autofill_auth_info_received_cb_h auth_info_received_cb = rpc_port_AutofillAppPort_autofill_auth_info_received_cb_create(__auth_info_recv_cb, false, ah); @@ -209,6 +211,8 @@ static void __on_disconnected(rpc_port_proxy_AutofillAppPort_h h, void *user_dat autofill_h ah = user_data; if (ah) { + ah->connected = false; + if (ah && ah->connection_callback) ah->connection_callback(ah, AUTOFILL_CONNECTION_STATUS_DISCONNECTED, ah->connection_userdata); @@ -336,6 +340,11 @@ EXPORT_API int autofill_commit(autofill_h ah, autofill_save_view_info_h vi) return AUTOFILL_ERROR_OPERATION_FAILED; } + if (!ah->connected) { + LOGW("[ERROR] Not connected"); + return AUTOFILL_ERROR_OPERATION_FAILED; + } + rpc_port_autofill_save_view_info_create(&vih); rpc_port_autofill_save_view_info_set_view_id(vih, vi->view_id); diff --git a/client/autofill_auth.c b/client/autofill_auth.c index d238b63..9fdf7f9 100644 --- a/client/autofill_auth.c +++ b/client/autofill_auth.c @@ -49,6 +49,11 @@ EXPORT_API int autofill_auth_info_request(autofill_h ah, autofill_view_info_h vi return AUTOFILL_ERROR_OPERATION_FAILED; } + if (!ah->connected) { + LOGW("[ERROR] Not connected"); + return AUTOFILL_ERROR_OPERATION_FAILED; + } + LOGD("app id : %s, view id : %s", vi->app_id, vi->view_id); rpc_port_autofill_view_info_create(&vih); diff --git a/client/autofill_fill_request.c b/client/autofill_fill_request.c index 8dec709..8c8b091 100644 --- a/client/autofill_fill_request.c +++ b/client/autofill_fill_request.c @@ -47,6 +47,11 @@ EXPORT_API int autofill_fill_request(autofill_h ah, autofill_view_info_h vi) return AUTOFILL_ERROR_OPERATION_FAILED; } + if (!ah->connected) { + LOGW("[ERROR] Not connected"); + return AUTOFILL_ERROR_OPERATION_FAILED; + } + Eina_List *l; autofill_item_h it; diff --git a/include/autofill_private.h b/include/autofill_private.h index 3ca6f28..6a465cb 100644 --- a/include/autofill_private.h +++ b/include/autofill_private.h @@ -26,6 +26,8 @@ struct autofill_s { unsigned int context_id; + bool connected; + autofill_connection_status_changed_cb connection_callback; void *connection_userdata; -- 2.7.4