add code to block active notification when receving msg in activated conversation 00/87100/5 accepted/tizen/common/20160928.164205 accepted/tizen/ivi/20160929.001850 accepted/tizen/mobile/20160929.001745 accepted/tizen/wearable/20160929.001857 submit/tizen/20160928.053937
authorKyeonghun Lee <kh9090.lee@samsung.com>
Tue, 6 Sep 2016 09:49:46 +0000 (18:49 +0900)
committerKyeonghun Lee <kh9090.lee@samsung.com>
Mon, 26 Sep 2016 01:26:46 +0000 (10:26 +0900)
Change-Id: I689e5fa1ac00620df9539f6bd724cf911e946e59
Signed-off-by: Kyeonghun Lee <kh9090.lee@samsung.com>
framework/deliver-handler/MsgDeliverHandler.cpp
manager/src/msg-manager-notification.cpp

index 5bb1559..0674164 100755 (executable)
@@ -238,7 +238,7 @@ msg_error_t MsgHandleIncomingMsg(MSG_MESSAGE_INFO_S *pMsgInfo, bool *pSendNoti)
 
        MsgDisplayUnlock();
 
-       //Add Phone Log Data
+       /* Add Phone Log Data */
        if ((err == MSG_SUCCESS) &&
                (pMsgInfo->folderId == MSG_INBOX_ID || pMsgInfo->folderId == MSG_SPAMBOX_ID) &&
                (pMsgInfo->msgType.mainType == MSG_SMS_TYPE) &&
@@ -246,11 +246,21 @@ msg_error_t MsgHandleIncomingMsg(MSG_MESSAGE_INFO_S *pMsgInfo, bool *pSendNoti)
 #ifndef MSG_CONTACTS_SERVICE_NOT_SUPPORTED
                MSG_DEBUG("Enter MsgAddPhoneLog() : pMsg->folderId [%d]", pMsgInfo->folderId);
                MsgAddPhoneLog(pMsgInfo);
-#endif //MSG_CONTACTS_SERVICE_NOT_SUPPORTED
+#endif /* MSG_CONTACTS_SERVICE_NOT_SUPPORTED */
        }
 
-       // Auto delete
-       //MsgStoAutoDeleteConversation(pMsgInfo->threadId);
+       int activated_conv_id = -1;
+       MsgSettingGetInt(VCONFKEY_MESSAGE_ACTIVATED_CONVERSATION_ID, &activated_conv_id);
+
+       if (activated_conv_id > 0 && (unsigned int)activated_conv_id == pMsgInfo->threadId) {
+               MSG_WARN("Update message read status of current activated thread. [%d]", pMsgInfo->threadId);
+               err = MsgStoUpdateReadStatus(pMsgInfo->msgId, true);
+               if (err != MSG_SUCCESS)
+                       MSG_ERR("MsgStoUpdateReadStatus() is failed. err = %d", err);
+       }
+       /* Auto delete
+       MsgStoAutoDeleteConversation(pMsgInfo->threadId);
+       */
 
        MSG_END();
 
index 23a09ec..ea65124 100644 (file)
@@ -85,6 +85,7 @@ typedef struct _msg_mgr_noti_info_s
        app_control_h           svc_h;
        app_control_h           active_noti_svc_h[MSG_ACTIVE_NOTI_BUTTON_NUM];
        msg_message_id_t                msg_id;
+       int                     conv_id;
        unsigned char           extra_data;
        int             sim_idx;
        int                     active_noti_button_num;
@@ -1708,6 +1709,7 @@ int getLatestMsgInfo(MSG_MGR_NOTI_INFO_S *noti_info, bool isForInstantMessage)
                                "(CASE WHEN B.DPM_RESTRICTED = 0 THEN B.SUBJECT ELSE \"restricted message\" END), "
                                "(CASE WHEN B.DPM_RESTRICTED = 0 THEN B.MSG_TEXT ELSE \"restricted message\" END), "
                                "B.MAIN_TYPE, "
+                               "B.CONV_ID, "
                                "(COUNT(DISTINCT(CASE WHEN B.MAIN_TYPE = %d THEN B.MSG_ID END))) AS SMS_UNREAD_CNT, "
                                "(COUNT(DISTINCT(CASE WHEN B.MAIN_TYPE = %d THEN B.MSG_ID END))) AS MMS_UNREAD_CNT, "
                                "(CASE WHEN B.MAIN_TYPE = %d AND B.NETWORK_STATUS = %d THEN (SELECT C.MSG_SIZE FROM %s C WHERE B.MSG_ID = C.MSG_ID) ELSE -1 END) "
@@ -1752,9 +1754,9 @@ int getLatestMsgInfo(MSG_MGR_NOTI_INFO_S *noti_info, bool isForInstantMessage)
                }
 
                if (row_cnt > 0) {
-                       smsUnreadCnt = atoi(db_res[col_cnt+6]);
-                       mmsUnreadCnt = atoi(db_res[col_cnt+7]);
-                       msgSize = atoi(db_res[col_cnt+8]);
+                       smsUnreadCnt = atoi(db_res[col_cnt+7]);
+                       mmsUnreadCnt = atoi(db_res[col_cnt+8]);
+                       msgSize = atoi(db_res[col_cnt+9]);
 
                        noti_info->count = smsUnreadCnt + mmsUnreadCnt;
 
@@ -1765,6 +1767,8 @@ int getLatestMsgInfo(MSG_MGR_NOTI_INFO_S *noti_info, bool isForInstantMessage)
 
                                noti_info->msg_id = (msg_message_id_t)atoi(db_res[col_cnt+2]);
 
+                               noti_info->conv_id = atoi(db_res[col_cnt+6]);
+
                                mainType = (unsigned char)atoi(db_res[col_cnt+5]);
 
                                if (mainType == MSG_MMS_TYPE) {
@@ -2554,10 +2558,26 @@ void createInfoData(MSG_MGR_NOTI_INFO_S *noti_info, msg_mgr_active_notification_
                addServiceExtraData(noti_info->svc_h, "msgId", noti_info->msg_id);
                addServiceExtraData(noti_info->svc_h, "http://tizen.org/appcontrol/data/notification", "new_message");
 
-               noti_info->applist = NOTIFICATION_DISPLAY_APP_ALL^NOTIFICATION_DISPLAY_APP_TICKER;
-
                if (noti_info->active_noti_button_num == 0)
                        noti_info->active_noti_button_num = 3;
+
+               int activated_conv_id = -1;
+               vconf_get_int(VCONFKEY_MESSAGE_ACTIVATED_CONVERSATION_ID, &activated_conv_id);
+
+               if (activated_conv_id == -1) {
+                       noti_info->applist = NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY|NOTIFICATION_DISPLAY_APP_LOCK|NOTIFICATION_DISPLAY_APP_INDICATOR;
+               } else if (activated_conv_id == 0) {
+                       noti_info->active_noti_button_num = 0;
+                       noti_info->applist = NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY|NOTIFICATION_DISPLAY_APP_LOCK|NOTIFICATION_DISPLAY_APP_INDICATOR|NOTIFICATION_DISPLAY_APP_TICKER;
+               } else if (activated_conv_id > 0){
+                       noti_info->active_noti_button_num = 0;
+
+                       if (activated_conv_id != noti_info->conv_id)
+                               noti_info->applist = NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY|NOTIFICATION_DISPLAY_APP_LOCK|NOTIFICATION_DISPLAY_APP_INDICATOR|NOTIFICATION_DISPLAY_APP_TICKER;
+                       else
+                               MSG_MGR_WARN("No adding Notification : activated conv id [%d] / notification conv id [%d]", activated_conv_id, noti_info->conv_id);
+               }
+
                break;
        }
        case MSG_MGR_NOTI_TYPE_CB: {