change UX concept for notification 54/97854/3
authorintae, jeon <intae.jeon@samsung.com>
Wed, 9 Nov 2016 00:54:38 +0000 (09:54 +0900)
committerintae, jeon <intae.jeon@samsung.com>
Fri, 18 Nov 2016 00:12:32 +0000 (09:12 +0900)
Change-Id: Icb2f4beacee793f21fd2b4be2e1c404594abd68d
Signed-off-by: intae, jeon <intae.jeon@samsung.com>
email-core/email-core-utils.c

index e473f20..71b280c 100755 (executable)
@@ -1751,6 +1751,17 @@ FINISH_OFF:
        return err;
 }
 
+static  gboolean __on_timer_delete_notification(gpointer userdata)
+{
+       int private_id = (int)userdata;
+       notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
+       if ((noti_err = notification_delete_by_priv_id(NATIVE_EMAIL_APPLICATION_PKG, NOTIFICATION_TYPE_NOTI, private_id)) != NOTIFICATION_ERROR_NONE) {
+               EM_DEBUG_EXCEPTION("notification delete fail!!");
+       }
+
+       return false;
+}
+
 INTERNAL_FUNC int emcore_add_notification_for_send(char *multi_user_name, int account_id, int mail_id, email_action_t action, int sending_error, unsigned long display)
 {
        EM_DEBUG_FUNC_BEGIN("account_id: %d, mail_id: %d, action:%d", account_id, mail_id, action);
@@ -1763,7 +1774,7 @@ INTERNAL_FUNC int emcore_add_notification_for_send(char *multi_user_name, int ac
        notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
        emstorage_mail_tbl_t *p_mail_data = NULL;
        emstorage_account_tbl_t *account_tbl = NULL;
-
+       int private_id = 0;
        /* For service bundle */
        char buf[256] = {0,};
        app_control_h service = NULL;
@@ -1815,39 +1826,45 @@ INTERNAL_FUNC int emcore_add_notification_for_send(char *multi_user_name, int ac
                goto FINISH_OFF;
        }
 
-       /* Create service bundle */
+
        app_control_create(&service);
        if (!service) {
                EM_DEBUG_EXCEPTION("service create failed");
        }
 
-       snprintf(buf, sizeof(buf), "%d", 12);
-       app_control_add_extra_data(service, "RUN_TYPE", buf);
-       snprintf(buf, sizeof(buf), "%d", account_id);
-       app_control_add_extra_data(service, "ACCOUNT_ID", buf);
-       snprintf(buf, sizeof(buf), "%d", p_mail_data->mail_id);
-       app_control_add_extra_data(service, "MAIL_ID", buf);
-       snprintf(buf, sizeof(buf), "%d", p_mail_data->mailbox_id);
-       app_control_add_extra_data(service, "MAILBOX_ID", buf);
-       snprintf(buf, sizeof(buf), "%d", sending_error);
-       app_control_add_extra_data(service, "SENDING_ERROR", buf);
-       if (sending_error == EMAIL_ERROR_NONE) {
-               if (action == EMAIL_ACTION_SEND_MAIL)
-                       snprintf(buf, sizeof(buf), "%s", __NOTI_SENT);
-               else if (action == EMAIL_ACTION_SENDING_MAIL)
-                       snprintf(buf, sizeof(buf), "%s", __NOTI_SENDING);
-       } else {
-               snprintf(buf, sizeof(buf), "%s", __NOTI_SENT_FAIL);
-       }
-       app_control_add_extra_data(service, "NOTI_TYPE", buf);
-       app_control_set_app_id(service, NATIVE_EMAIL_APPLICATION_PKG);
+       /* Create service bundle */
+       if (sending_error != EMAIL_ERROR_NONE || action == EMAIL_ACTION_SENDING_MAIL) {
 
-       app_control_to_bundle(service, &b);
-       noti_err = notification_set_execute_option(noti, NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH, NULL, NULL, b);
-       if (noti_err != NOTIFICATION_ERROR_NONE) {
-               EM_DEBUG_EXCEPTION("notification_set_execute_option failed [%d]", noti_err);
-               err = EMAIL_ERROR_SYSTEM_FAILURE;
-               goto FINISH_OFF;
+               snprintf(buf, sizeof(buf), "%d", 12);
+               app_control_add_extra_data(service, "RUN_TYPE", buf);
+               snprintf(buf, sizeof(buf), "%d", account_id);
+               app_control_add_extra_data(service, "ACCOUNT_ID", buf);
+               snprintf(buf, sizeof(buf), "%d", p_mail_data->mail_id);
+               app_control_add_extra_data(service, "MAIL_ID", buf);
+               snprintf(buf, sizeof(buf), "%d", p_mail_data->mailbox_id);
+               app_control_add_extra_data(service, "MAILBOX_ID", buf);
+
+               app_control_set_app_id(service, NATIVE_EMAIL_APPLICATION_PKG);
+
+
+               snprintf(buf, sizeof(buf), "%d", sending_error);
+               app_control_add_extra_data(service, "SENDING_ERROR", buf);
+               if (sending_error == EMAIL_ERROR_NONE) {
+                       if (action == EMAIL_ACTION_SENDING_MAIL)
+                               snprintf(buf, sizeof(buf), "%s", __NOTI_SENDING);
+               } else {
+                       snprintf(buf, sizeof(buf), "%s", __NOTI_SENT_FAIL);
+               }
+               app_control_add_extra_data(service, "NOTI_TYPE", buf);
+               app_control_set_app_id(service, NATIVE_EMAIL_APPLICATION_PKG);
+
+               app_control_to_bundle(service, &b);
+               noti_err = notification_set_execute_option(noti, NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH, NULL, NULL, b);
+               if (noti_err != NOTIFICATION_ERROR_NONE) {
+                       EM_DEBUG_EXCEPTION("notification_set_execute_option failed [%d]", noti_err);
+                       err = EMAIL_ERROR_SYSTEM_FAILURE;
+                       goto FINISH_OFF;
+               }
        }
 
        switch (action) {
@@ -1914,6 +1931,8 @@ INTERNAL_FUNC int emcore_add_notification_for_send(char *multi_user_name, int ac
 
                switch (sending_error) {
                case EMAIL_ERROR_NONE:
+                        notification_set_property(noti,NOTIFICATION_PROP_DISABLE_AUTO_DELETE);
+
                        if ((noti_err = notification_set_text(noti,
                                                                                                NOTIFICATION_TEXT_TYPE_CONTENT,
                                                                                                "Email Sent",
@@ -1967,12 +1986,16 @@ INTERNAL_FUNC int emcore_add_notification_for_send(char *multi_user_name, int ac
                        goto FINISH_OFF;
                }
 
-               if ((noti_err = notification_insert(noti, NULL)) != NOTIFICATION_ERROR_NONE) {
+               if ((noti_err = notification_insert(noti, &private_id)) != NOTIFICATION_ERROR_NONE) {
                        EM_DEBUG_EXCEPTION("notification_insert failed [%d]", noti_err);
                        err = EMAIL_ERROR_NOTI;
                        goto FINISH_OFF;
                }
 
+               if (sending_error == EMAIL_ERROR_NONE) {
+                       g_timeout_add_seconds(3, __on_timer_delete_notification, private_id);
+               }
+
                break;
 
        case EMAIL_ACTION_SENDING_MAIL: