From: Jihoon Kim Date: Fri, 10 Apr 2020 11:29:47 +0000 (+0900) Subject: Fixed an issue sending errors during synchronization X-Git-Tag: accepted/tizen/5.5/unified/20200413.131043~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F46%2F230546%2F5;p=platform%2Fcore%2Fuifw%2Fcapi-ui-sticker.git Fixed an issue sending errors during synchronization Change-Id: I24d6009d2bf039b42780ff62c0f1dcf423a0af16 Signed-off-by: Jihoon Kim --- diff --git a/receiver/src/ft.cpp b/receiver/src/ft.cpp index 55c3f38..eb4e297 100644 --- a/receiver/src/ft.cpp +++ b/receiver/src/ft.cpp @@ -87,6 +87,7 @@ static int rec_file_cnt_in_group = 0; static int total_file_count_in_group = 0; static int sync_success_cnt = 0; static gboolean job_progress = FALSE; +static int sync_complete_flags = 0; static void save_last_sync_time() { @@ -100,7 +101,7 @@ static void save_last_sync_time() } } -static void set_sync_complete() +static void set_sync_first_complete() { int complete_flags = 0; if (vconf_get_int(VCONFKEY_STICKER_SYNC_COMPLETE, &complete_flags) == 0 && complete_flags == 0) { @@ -110,7 +111,11 @@ static void set_sync_complete() else LOGW("Fail to set sync complete"); } +} +static void set_sync_complete() +{ + set_sync_first_complete(); save_last_sync_time(); } @@ -571,6 +576,60 @@ static void quit() service_app_exit(); } +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: + { + response_to_app = "success"; + if (current_request.category == string("arsticker")) + sync_complete_flags |= VCONFKEY_STICKER_FEATURE_AREMOJI; + else if (current_request.category == string("bitmoji")) + sync_complete_flags |= VCONFKEY_STICKER_FEATURE_BITMOJI; + } + break; + case SYNC_START_RSP_NO_STICKER: + response_to_app = "no_sticker"; + break; + default: + response_to_app = "unknown_error"; + break; + } + + LOGD("result code : %d, sync complete flag : %d", result_code, sync_complete_flags); + +#ifdef VCONFKEY_STICKER_SUPPORTED_FEATURE + if (vconf_get_int(VCONFKEY_STICKER_SUPPORTED_FEATURE, &feature_flag) != 0) + { + LOGW("Failed to read support feature"); + return; + } + + LOGD("feature : %d, current request category : %s", feature_flag, current_request.category.c_str()); + if (feature_flag == VCONFKEY_STICKER_FEATURE_AREMOJI || + feature_flag == VCONFKEY_STICKER_FEATURE_BITMOJI) + { + LOGD("only standalone sync mode"); + send_message("sync_start_response", response_to_app.c_str()); + } + else { + if (current_request.category == string("arsticker")) + { + if (result_code == SYNC_START_RSP_SUCCESS) + send_message("sync_start_response", response_to_app.c_str()); + } + else if (current_request.category == string("bitmoji")) + { + if (sync_complete_flags == 0 || + sync_complete_flags == VCONFKEY_STICKER_FEATURE_BITMOJI) + send_message("sync_start_response", response_to_app.c_str()); + } + } +#endif +} + void on_data_received(sap_socket_h socket, unsigned short int channel_id, unsigned int payload_length, void *buffer, void *user_data) /* message exchange on_receive callback (sap_agent_data_received_cb) */ @@ -640,24 +699,11 @@ 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); - string response_to_app; - switch (result_code) { - case SYNC_START_RSP_SUCCESS: - response_to_app = "success"; - break; - case SYNC_START_RSP_NO_STICKER: - response_to_app = "no_sticker"; - break; - default: - response_to_app = "unknown_error"; - break; - } - - send_message("sync_start_response", response_to_app.c_str()); + send_sync_start_response(result_code); if (result_code != SYNC_START_RSP_SUCCESS) { - set_sync_progressing(FALSE); if (!process_request_queue()) { + set_sync_progressing(FALSE); if (result_code == SYNC_START_RSP_NO_STICKER) save_last_sync_time();