Modified to send show_notification message when mobile is disconnected 56/232556/4
authorInHong Han <inhong1.han@samsung.com>
Wed, 6 May 2020 08:41:37 +0000 (17:41 +0900)
committerInHong Han <inhong1.han@samsung.com>
Wed, 6 May 2020 12:00:40 +0000 (21:00 +0900)
Change-Id: I8013592edbb13703a0d1553295d49d86430de47b

receiver/inc/sticker_request.h
receiver/src/ft.cpp

index 583bd9a..9fa6f2e 100644 (file)
@@ -23,7 +23,8 @@ using namespace std;
 
 typedef enum {
     REQUEST_TYPE_SYNC,
-    REQUEST_TYPE_FEATURE_REQ
+    REQUEST_TYPE_FEATURE_REQ,
+    REQUEST_TYPE_SHOW_NOTIFICATION
 } request_type;
 
 struct StickerRequest {
index ae52546..b375757 100644 (file)
@@ -492,6 +492,16 @@ void send_disconnect_message()
 void request_show_sync_notification()
 {
     JsonObject *j_object = NULL;
+
+    if (!priv_data.socket) {
+        job_progress = TRUE;
+        StickerRequest pending_request;
+        pending_request.req_type = REQUEST_TYPE_SHOW_NOTIFICATION;
+        ReqQueue.push(pending_request);
+        LOGI("Push show notification request");
+        return;
+    }
+
     j_object = json_object_new();
     if (j_object == NULL) {
         LOGE("json object create error");
@@ -503,6 +513,8 @@ void request_show_sync_notification()
 
     if (_send_json_data(j_object) == FALSE) {
         LOGE("Failed to send STICKER_REQUEST_NOTI_REQ");
+    } else {
+        job_progress = TRUE;
     }
 
     json_object_unref(j_object);
@@ -586,6 +598,11 @@ static bool process_request_queue()
         if (request_sticker_data(request.mode.c_str(), request.category.c_str(), request.type.c_str()))
             ReqQueue.pop();
     }
+    else if (request.req_type == REQUEST_TYPE_SHOW_NOTIFICATION) {
+        LOGD("[Request to show notification]");
+        request_show_sync_notification();
+        ReqQueue.pop();
+    }
 
     return true;
 }