Add connection error message 78/196978/2
authorJihoon Kim <jihoon48.kim@samsung.com>
Tue, 8 Jan 2019 09:55:37 +0000 (18:55 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Tue, 8 Jan 2019 09:57:35 +0000 (18:57 +0900)
Change-Id: Ibf37850a6ee651b0f86465a630040592be697890
Signed-off-by: Jihoon Kim <jihoon48.kim@samsung.com>
client/autofill.c
client/autofill_auth.c
client/autofill_fill_request.c
include/autofill_private.h

index fdd0df9..b5220e0 100644 (file)
@@ -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);
 
index d238b63..9fdf7f9 100644 (file)
@@ -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);
index 8dec709..8c8b091 100644 (file)
@@ -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;
 
index 3ca6f28..6a465cb 100644 (file)
@@ -26,6 +26,8 @@ struct autofill_s {
 
     unsigned int context_id;
 
+    bool connected;
+
     autofill_connection_status_changed_cb connection_callback;
     void *connection_userdata;