Fix the issue no_sticker message was not delivered after OOBE 13/233513/1
authorInHong Han <inhong1.han@samsung.com>
Fri, 15 May 2020 06:27:31 +0000 (15:27 +0900)
committerInHong Han <inhong1.han@samsung.com>
Fri, 15 May 2020 06:29:19 +0000 (15:29 +0900)
Change-Id: I83fde1a99c224f25b345d05a00918fd3143e8dba

receiver/src/ft.cpp

index 4e03352..1ab77b0 100644 (file)
@@ -634,7 +634,7 @@ static void send_sync_start_response(int result_code)
     int feature_flag = 0;
     string response_to_app;
     switch (result_code) {
-        case SYNC_START_RSP_SUCCESS || SYNC_START_RSP_BITMOJI_ALL_DELETE:
+        case SYNC_START_RSP_SUCCESS:
         {
             response_to_app = "success";
             if (current_request.category == string("arsticker"))
@@ -646,6 +646,18 @@ static void send_sync_start_response(int result_code)
         case SYNC_START_RSP_NO_STICKER:
             response_to_app = "no_sticker";
             break;
+        case SYNC_START_RSP_BITMOJI_ALL_DELETE:
+        {
+            int is_synced = 0;
+            if (vconf_get_int(VCONFKEY_STICKER_SYNC_COMPLETE, &is_synced) != 0)
+                LOGW("Failed to read sync completion");
+
+            if (is_synced == VCONFKEY_STICKER_SYNC_COMPLETE_NONE)
+                response_to_app = "no_sticker";
+            else
+                response_to_app = "success";
+            break;
+        }
         default:
             response_to_app = "unknown_error";
             break;
@@ -752,9 +764,8 @@ on_data_received(sap_socket_h socket, unsigned short int channel_id, unsigned in
         int result_code = json_object_get_int_member(root_obj, "resultCode");
         LOGD("result : %s, resultCode : %d", result.c_str(), result_code);
 
-        send_sync_start_response(result_code);
-
         if(result_code == SYNC_START_RSP_SUCCESS) {
+            send_sync_start_response(result_code);
             if (current_request.category == string("bitmoji")) {
                 LOGD("Delete all bitmoji stickers");
                 if (create_sticker_provider_handle() == STICKER_ERROR_NONE) {
@@ -762,7 +773,15 @@ on_data_received(sap_socket_h socket, unsigned short int channel_id, unsigned in
                     destroy_sticker_provider_handle();
                 }
             }
-        } else if (result_code == SYNC_START_RSP_NO_STICKER) {
+        } else {
+            if (result_code == SYNC_START_RSP_BITMOJI_ALL_DELETE) {
+                LOGD("Delete all bitmoji stickers");
+                if (create_sticker_provider_handle() == STICKER_ERROR_NONE) {
+                    delete_all_bitmoji_stickers();
+                    destroy_sticker_provider_handle();
+                }
+            }
+
             if (!process_request_queue()) {
 #ifdef VCONFKEY_STICKER_SUPPORTED_FEATURE
                 int feature_flag = 0;
@@ -788,25 +807,12 @@ on_data_received(sap_socket_h socket, unsigned short int channel_id, unsigned in
                 LOGW("No vconf supported feature");
 #endif /* VCONFKEY_STICKER_SUPPORTED_FEATURE */
 
+                send_sync_start_response(result_code);
                 set_sync_progressing(FALSE);
                 save_last_sync_time();
 
                 quit();
             }
-        } else if (result_code == SYNC_START_RSP_BITMOJI_ALL_DELETE) {
-            LOGD("Delete all bitmoji stickers");
-            if (create_sticker_provider_handle() == STICKER_ERROR_NONE) {
-                delete_all_bitmoji_stickers();
-                destroy_sticker_provider_handle();
-            }
-
-            set_sync_progressing(FALSE);
-            save_last_sync_time();
-
-            if (!process_request_queue()) {
-                sync_success_cnt = 0;
-                quit();
-            }
         }
     } else if (msg_id == STICKER_SEND_START_REQ) {
         LOGD("msg : %s", msg_id.c_str());