Set sync complete vconf value after completing to sync 59/232659/1
authorJihoon Kim <jihoon48.kim@samsung.com>
Thu, 7 May 2020 04:31:14 +0000 (13:31 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Thu, 7 May 2020 04:40:39 +0000 (13:40 +0900)
Change-Id: I29048342acd2076f550332a559c6a310a784a7ed
Signed-off-by: Jihoon Kim <jihoon48.kim@samsung.com>
receiver/src/ft.cpp

index 0d8fade..29450fa 100644 (file)
@@ -741,6 +741,30 @@ on_data_received(sap_socket_h socket, unsigned short int channel_id, unsigned in
 
         if (result_code != SYNC_START_RSP_SUCCESS) {
             if (!process_request_queue()) {
+#ifdef VCONFKEY_STICKER_SUPPORTED_FEATURE
+                int feature_flag = 0;
+
+                if (vconf_get_int(VCONFKEY_STICKER_SUPPORTED_FEATURE, &feature_flag) == 0)
+                {
+                    LOGD("feature : %d, current request category : %s", feature_flag, current_request.category.c_str());
+                    if (feature_flag & VCONFKEY_STICKER_FEATURE_BITMOJI)
+                    {
+                        if (current_request.category == string("bitmoji"))
+                        {
+                            /* other sticker group(s) has been synchronized completely */
+                            if (sync_success_cnt > 0) {
+                                set_sync_complete();
+                            }
+                        }
+                    }
+                }
+                else {
+                    LOGW("Failed to read support feature");
+                }
+#else
+                LOGW("No vconf supported feature");
+#endif /* VCONFKEY_STICKER_SUPPORTED_FEATURE */
+
                 set_sync_progressing(FALSE);
                 if (result_code == SYNC_START_RSP_NO_STICKER)
                     save_last_sync_time();
@@ -815,18 +839,44 @@ on_data_received(sap_socket_h socket, unsigned short int channel_id, unsigned in
         json_object_set_string_member(j_object, "msgId", STICKER_SEND_STOP_RSP);
         json_object_set_int_member(j_object, "tID", t_id);
 
-        if (reason == "complete" && rec_file_cnt_in_group == file_len) {
-            int feature_flag = 0;
-
+        if (reason == "complete") {
+            if (rec_file_cnt_in_group == file_len) {
 #ifdef VCONFKEY_STICKER_SUPPORTED_FEATURE
-            set_sync_complete();
-            set_sync_progressing(FALSE);
+                int feature_flag = 0;
+
+                if (vconf_get_int(VCONFKEY_STICKER_SUPPORTED_FEATURE, &feature_flag) == 0)
+                {
+                    LOGD("feature : %d, current request category : %s", feature_flag, current_request.category.c_str());
+                    if (feature_flag == VCONFKEY_STICKER_FEATURE_AREMOJI)
+                    {
+                        if (current_request.category == string("arsticker"))
+                        {
+                            set_sync_complete();
+                            set_sync_progressing(FALSE);
+                        }
+                    }
+                    else if (feature_flag & VCONFKEY_STICKER_FEATURE_BITMOJI)
+                    {
+                        if (current_request.category == string("bitmoji"))
+                        {
+                            set_sync_complete();
+                            set_sync_progressing(FALSE);
+                        }
+                    }
+                }
+                else {
+                    LOGW("Failed to read support feature");
+                }
 #else
-            LOGW("No vconf supported feature");
+                LOGW("No vconf supported feature");
 #endif /* VCONFKEY_STICKER_SUPPORTED_FEATURE */
 
-            json_object_set_string_member(j_object, "result", "success");
-            sync_success_cnt++;
+                json_object_set_string_member(j_object, "result", "success");
+                sync_success_cnt++;
+            }
+            else {
+                json_object_set_string_member(j_object, "result", "failure");
+            }
         }
         else {
             json_object_set_string_member(j_object, "result", "failure");