From: Soonmin Jung Date: Tue, 5 Feb 2013 13:06:23 +0000 (+0900) Subject: Fix N_SE-24338, mms draft message issue X-Git-Tag: 2.1b_release~2^2~16^2~18 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;ds=sidebyside;h=61011275cd3c37aa3a0bd8a52b77076aa09cc5dd;p=apps%2Fcore%2Fpreloaded%2Fmessage-app.git Fix N_SE-24338, mms draft message issue Reason : draft mms message didn't be updated because msgid is not used Fix : draft mms messge is updated by using msgid when update is required Change-Id: Ice23bd5eb80895597c99d132ee223e5c4921499d --- diff --git a/composer/include/msg-ui-composer-bubble.h b/composer/include/msg-ui-composer-bubble.h index f2e898d..842330f 100755 --- a/composer/include/msg-ui-composer-bubble.h +++ b/composer/include/msg-ui-composer-bubble.h @@ -239,6 +239,7 @@ typedef struct _MSG_BUBBLE_DATA { int copy_id; int resend_id; int retrieve_id; + int draft_msg_id; int check_cnt; int media_chk_cnt; int del_index; diff --git a/composer/include/msg-ui-composer-data.h b/composer/include/msg-ui-composer-data.h index 499c7e4..dbbab43 100755 --- a/composer/include/msg-ui-composer-data.h +++ b/composer/include/msg-ui-composer-data.h @@ -466,6 +466,7 @@ typedef struct _MSG_COMPOSER_DATA_S { int ly_body_h; int send_check_exception_type; + int msg_id; char *working_path; /* setting data */ diff --git a/composer/include/msg-ui-composer-message.h b/composer/include/msg-ui-composer-message.h index 36385ce..e86aabe 100755 --- a/composer/include/msg-ui-composer-message.h +++ b/composer/include/msg-ui-composer-message.h @@ -87,10 +87,10 @@ COMPOSER_RETURN_TYPE_E msg_ui_composer_message_mms_set_media(const char *file_pa COMPOSER_RETURN_TYPE_E msg_ui_composer_message_mms_set_page_duration(int nPage, int duration); /* save send*/ -COMPOSER_RETURN_TYPE_E msg_ui_composer_save_message(msg_handle_t msg_handle); +COMPOSER_RETURN_TYPE_E msg_ui_composer_save_message(msg_handle_t msg_handle, int msg_id); COMPOSER_RETURN_TYPE_E msg_ui_composer_get_message_data(MSG_COMPOSER_VIEW_DATA_S *cd); -COMPOSER_RETURN_TYPE_E msg_ui_composer_message_make_and_send(msg_handle_t msg_handle, msg_thread_id_t *tid); +COMPOSER_RETURN_TYPE_E msg_ui_composer_message_make_and_send(msg_handle_t msg_handle, int msg_id, msg_thread_id_t *tid); msg_struct_t msg_ui_composer_message_make_preview(msg_handle_t msg_handle); COMPOSER_RETURN_TYPE_E msg_ui_composer_message_set_loaded_data(void *composer_data, bool set_recipient); diff --git a/composer/src/bubble/msg-ui-composer-bubble-callback.c b/composer/src/bubble/msg-ui-composer-bubble-callback.c index 28e26b9..657a0de 100755 --- a/composer/src/bubble/msg-ui-composer-bubble-callback.c +++ b/composer/src/bubble/msg-ui-composer-bubble-callback.c @@ -810,7 +810,12 @@ void msg_ui_bubble_msg_storage_change_cb(msg_handle_t handle, msg_storage_change break; case MSG_STORAGE_CHANGE_UPDATE : - msg_ui_bubble_item_data_update(BubbleData, conv); + if (msg_id == BubbleData->draft_msg_id) { + BubbleData->draft_msg_id = 0; + msg_ui_bubble_list_append(BubbleData, conv); + } else { + msg_ui_bubble_item_data_update(BubbleData, conv); + } break; diff --git a/composer/src/bubble/msg-ui-composer-bubble-list.c b/composer/src/bubble/msg-ui-composer-bubble-list.c index acf3f81..a4bfba8 100755 --- a/composer/src/bubble/msg-ui-composer-bubble-list.c +++ b/composer/src/bubble/msg-ui-composer-bubble-list.c @@ -1913,6 +1913,10 @@ void msg_ui_bubble_list_load(PMSG_BUBBLE_DATA bubble_data) D_MSG("last draft msgid is %d", msg_id); cd->loading_draft = true; + /* change composer mode */ + cd->composer_mode = MSG_COMPOSER_MODE_EDIT; + cd->msg_id = msg_id; + bubble_data->draft_msg_id = msg_id; msg_ui_composer_message_init(); msg_ui_composer_message_load_message(cd->msg_handle, msg_id); diff --git a/composer/src/bubble/msg-ui-composer-bubble-main.c b/composer/src/bubble/msg-ui-composer-bubble-main.c index f8aa8b4..ff729ca 100755 --- a/composer/src/bubble/msg-ui-composer-bubble-main.c +++ b/composer/src/bubble/msg-ui-composer-bubble-main.c @@ -279,6 +279,7 @@ void msg_ui_bubble_init_bubble_list(PMSG_BUBBLE_DATA bubble_data) bubble_data->copy_id = 0; bubble_data->resend_id = 0; bubble_data->retrieve_id = 0; + bubble_data->draft_msg_id = 0; if (bubble_data->load_animator) { ecore_animator_del(bubble_data->load_animator); diff --git a/composer/src/message/msg-ui-composer-message.c b/composer/src/message/msg-ui-composer-message.c index a58c66f..6b66a7c 100755 --- a/composer/src/message/msg-ui-composer-message.c +++ b/composer/src/message/msg-ui-composer-message.c @@ -426,7 +426,7 @@ COMPOSER_RETURN_TYPE_E msg_ui_composer_release_message() return COMPOSER_RETURN_SUCCESS; } -static COMPOSER_RETURN_TYPE_E __msg_ui_composer_make_sms_message(msg_handle_t msg_handle) +static COMPOSER_RETURN_TYPE_E __msg_ui_composer_make_sms_message(msg_handle_t msg_handle, int msg_id) { MSG_UI_ENTER(MSG_UI_LEVEL_DEBUG); @@ -436,6 +436,15 @@ static COMPOSER_RETURN_TYPE_E __msg_ui_composer_make_sms_message(msg_handle_t ms } int err = MSG_SUCCESS; + + /* set msgid */ + if (msg_id) { + D_MSG("msg_id = %d", msg_id); + if (msg_set_int_value(msg_data->msgInfo, MSG_MESSAGE_ID_INT, msg_id) != MSG_SUCCESS) { + MSG_UI_DEBUG(MSG_UI_LEVEL_ASSERT, "[ASSERT] set msgId error"); + } + } + /* set message type to SMS */ if (msg_set_int_value(msg_data->msgInfo, MSG_MESSAGE_TYPE_INT, MSG_TYPE_SMS) != MSG_SUCCESS) { MSG_UI_DEBUG(MSG_UI_LEVEL_ASSERT, "[ASSERT]msg_ui_comp_core_set_message_type error !!"); @@ -621,7 +630,7 @@ static COMPOSER_RETURN_TYPE_E __msg_ui_composer_make_mms_body(msg_handle_t msg_h return COMPOSER_RETURN_SUCCESS; } -static COMPOSER_RETURN_TYPE_E __msg_ui_composer_make_mms_message(msg_handle_t msg_handle) +static COMPOSER_RETURN_TYPE_E __msg_ui_composer_make_mms_message(msg_handle_t msg_handle, int msg_id) { MSG_UI_ENTER(MSG_UI_LEVEL_DEBUG); @@ -635,6 +644,14 @@ static COMPOSER_RETURN_TYPE_E __msg_ui_composer_make_mms_message(msg_handle_t ms ui_mms_data = msg_data->mms_data; + /* set msgid */ + if (msg_id) { + D_MSG("msg_id = %d", msg_id); + if (msg_set_int_value(msg_data->msgInfo, MSG_MESSAGE_ID_INT, msg_id) != MSG_SUCCESS) { + MSG_UI_DEBUG(MSG_UI_LEVEL_ASSERT, "[ASSERT] set msgId error"); + } + } + /* set msg type to MMS */ if (msg_set_int_value(msg_data->msgInfo, MSG_MESSAGE_TYPE_INT, MSG_TYPE_MMS) != MSG_SUCCESS) { MSG_UI_DEBUG(MSG_UI_LEVEL_ASSERT, "[ASSERT] set message type[MMS] error"); @@ -761,7 +778,7 @@ msg_struct_t msg_ui_composer_message_make_preview(msg_handle_t msg_handle) return NULL; } - if (__msg_ui_composer_make_mms_message(msg_handle) + if (__msg_ui_composer_make_mms_message(msg_handle, 0) != COMPOSER_RETURN_SUCCESS) { MSG_UI_DEBUG(MSG_UI_LEVEL_ERR, "[ERROR] make mms message error !!!"); return NULL; @@ -771,7 +788,7 @@ msg_struct_t msg_ui_composer_message_make_preview(msg_handle_t msg_handle) return msg_data->msgInfo; } -COMPOSER_RETURN_TYPE_E msg_ui_composer_message_make_and_send(msg_handle_t msg_handle, msg_thread_id_t *tid) +COMPOSER_RETURN_TYPE_E msg_ui_composer_message_make_and_send(msg_handle_t msg_handle, int msg_id, msg_thread_id_t *tid) { MSG_UI_ENTER(MSG_UI_LEVEL_DEBUG); @@ -789,10 +806,10 @@ COMPOSER_RETURN_TYPE_E msg_ui_composer_message_make_and_send(msg_handle_t msg_ha /* 2. make message */ if (msg_data->msg_type == COMPOSER_MSG_TYPE_SMS) { - if (__msg_ui_composer_make_sms_message(msg_handle) != COMPOSER_RETURN_SUCCESS) + if (__msg_ui_composer_make_sms_message(msg_handle, msg_id) != COMPOSER_RETURN_SUCCESS) ret = COMPOSER_RETURN_FAIL; } else if (msg_data->msg_type == COMPOSER_MSG_TYPE_MMS) { - if (__msg_ui_composer_make_mms_message(msg_handle) != COMPOSER_RETURN_SUCCESS) + if (__msg_ui_composer_make_mms_message(msg_handle, msg_id) != COMPOSER_RETURN_SUCCESS) ret = COMPOSER_RETURN_FAIL; } else { MSG_UI_DEBUG(MSG_UI_LEVEL_ASSERT, "[ASSERT] invalid message type"); @@ -818,7 +835,7 @@ COMPOSER_RETURN_TYPE_E msg_ui_composer_message_make_and_send(msg_handle_t msg_ha return ret; } -COMPOSER_RETURN_TYPE_E msg_ui_composer_save_message(msg_handle_t msg_handle) +COMPOSER_RETURN_TYPE_E msg_ui_composer_save_message(msg_handle_t msg_handle, int msg_id) { MSG_UI_ENTER(MSG_UI_LEVEL_DEBUG); @@ -836,10 +853,10 @@ COMPOSER_RETURN_TYPE_E msg_ui_composer_save_message(msg_handle_t msg_handle) /* 2. make message */ if (msg_data->msg_type == COMPOSER_MSG_TYPE_SMS) { - if (__msg_ui_composer_make_sms_message(msg_handle) != COMPOSER_RETURN_SUCCESS) + if (__msg_ui_composer_make_sms_message(msg_handle, msg_id) != COMPOSER_RETURN_SUCCESS) ret = COMPOSER_RETURN_FAIL; } else if (msg_data->msg_type == COMPOSER_MSG_TYPE_MMS) { - if (__msg_ui_composer_make_mms_message(msg_handle) != COMPOSER_RETURN_SUCCESS) + if (__msg_ui_composer_make_mms_message(msg_handle, msg_id) != COMPOSER_RETURN_SUCCESS) ret = COMPOSER_RETURN_FAIL; } else { MSG_UI_DEBUG(MSG_UI_LEVEL_ASSERT, "[ASSERT] invalid message type"); @@ -851,7 +868,10 @@ COMPOSER_RETURN_TYPE_E msg_ui_composer_save_message(msg_handle_t msg_handle) msg_struct_t sendOpt = msg_create_struct(MSG_STRUCT_SENDOPT); msg_set_bool_value(sendOpt, MSG_SEND_OPT_SETTING_BOOL, false); - ret = msg_add_message(msg_handle, msg_data->msgInfo, sendOpt); + if (!msg_id) + ret = msg_add_message(msg_handle, msg_data->msgInfo, sendOpt); + else + ret = msg_update_message(msg_handle, msg_data->msgInfo, sendOpt); msg_release_struct(&sendOpt); } diff --git a/composer/src/ui-composer/msg-ui-composer-body-callback.c b/composer/src/ui-composer/msg-ui-composer-body-callback.c index 261650f..7d24827 100755 --- a/composer/src/ui-composer/msg-ui-composer-body-callback.c +++ b/composer/src/ui-composer/msg-ui-composer-body-callback.c @@ -516,7 +516,7 @@ void msg_ui_composer_body_make_and_send_message(void *data, int check_exception_ } /*Send message*/ - COMPOSER_RETURN_TYPE_E ret = msg_ui_composer_message_make_and_send(cd->msg_handle, &tid); + COMPOSER_RETURN_TYPE_E ret = msg_ui_composer_message_make_and_send(cd->msg_handle, cd->msg_id, &tid); /* reset region info */ MSG_COMPOSER_BODY_S *body_data = &cd->body_data; @@ -551,6 +551,7 @@ void msg_ui_composer_body_make_and_send_message(void *data, int check_exception_ } cd->composer_mode = MSG_COMPOSER_MODE_NORMAL; + cd->msg_id = 0; } else { bool is_closed = false; @@ -578,8 +579,10 @@ void msg_ui_composer_body_make_and_send_message(void *data, int check_exception_ } } - if (!is_closed) + if (!is_closed) { cd->composer_mode = MSG_COMPOSER_MODE_NORMAL; + cd->msg_id = 0; + } goto error_return; } diff --git a/composer/src/ui-composer/msg-ui-composer-main.c b/composer/src/ui-composer/msg-ui-composer-main.c index 1e9626d..29f3361 100755 --- a/composer/src/ui-composer/msg-ui-composer-main.c +++ b/composer/src/ui-composer/msg-ui-composer-main.c @@ -459,8 +459,10 @@ static void __msg_ui_composer_bundle_data_process(MSG_COMPOSER_VIEW_DATA_S *cd, bool set_recipient = false; int msg_id = atoi(bundle_txt); - if (cd->composer_mode == MSG_COMPOSER_MODE_EDIT) + if (cd->composer_mode == MSG_COMPOSER_MODE_EDIT) { + cd->msg_id = msg_id; set_recipient = true; + } msg_ui_composer_message_init(); msg_ui_composer_message_load_message(cd->msg_handle, msg_id); @@ -881,7 +883,7 @@ void msg_ui_composer_reset_request(MSG_COMPOSER_VIEW_DATA_S *cd, service_h svc_h msg_ui_composer_message_init(); if (msg_ui_composer_get_message_data(cd) == COMPOSER_RETURN_SUCCESS) { - msg_ui_composer_save_message(cd->msg_handle); + msg_ui_composer_save_message(cd->msg_handle, cd->msg_id); } msg_ui_composer_message_destroy(); @@ -939,7 +941,7 @@ void msg_ui_composer_reset_request(MSG_COMPOSER_VIEW_DATA_S *cd, service_h svc_h msg_ui_composer_message_init(); if (msg_ui_composer_get_message_data(cd) == COMPOSER_RETURN_SUCCESS) { - msg_ui_composer_save_message(cd->msg_handle); + msg_ui_composer_save_message(cd->msg_handle, cd->msg_id); } msg_ui_composer_message_destroy(); @@ -1121,7 +1123,7 @@ static void __msg_composer_auto_save_and_delete_msg(MSG_COMPOSER_VIEW_DATA_S *cd if (msg_ui_composer_get_message_data(cd) == COMPOSER_RETURN_SUCCESS) { D_MSG("save draft message"); - msg_ui_composer_save_message(cd->msg_handle); + msg_ui_composer_save_message(cd->msg_handle, cd->msg_id); /* show saved ticker popup */ msg_ui_composer_common_tickernoti(cd, COMPOSER_TICKERNOTI_AUTO_SAVED); }