TizenRefApp-9291 Message bubble is not displayed when empty message sent to Emulator 24/149924/3 submit/tizen_4.0/20170914.090539
authorEvgen Servetnik <e.servetnik@samsung.com>
Wed, 13 Sep 2017 13:50:39 +0000 (16:50 +0300)
committerDenis Dolzhenko <d.dolzhenko@samsung.com>
Wed, 13 Sep 2017 14:56:13 +0000 (14:56 +0000)
Change-Id: If810d763405e934a813d64d7a3ab24ffdc3ec56d
Signed-off-by: Evgen Servetnik <e.servetnik@samsung.com>
src/Conversation/ConvList/Controller/inc/BubbleEntityFactory.h
src/Conversation/ConvList/Controller/inc/ConvListItem.h
src/Conversation/ConvList/Controller/src/BubbleEntityFactory.cpp
src/Conversation/ConvList/Controller/src/ConvListItem.cpp

index 775a661..dade8d9 100644 (file)
@@ -42,6 +42,7 @@ namespace Msg {
                        BubbleEntity *createEntity(const std::string &filePath, BubbleBgViewItem::BgType bgType, Message::Direction direction);
                        BubbleEntity *createEntity(const MsgConvMedia &msgMedia, BubbleBgViewItem::BgType bgType, Message::Direction direction);
                        BubbleTextEntity *createTextEntity(std::string text, BubbleBgViewItem::BgType bgType, Message::Direction direction);
+                       BubbleTextEntity *createEmptyEntity(BubbleBgViewItem::BgType bgType, Message::Direction direction);
                        BubbleDownloadButtonEntity *createDownloadButtonEntity();
 
                private:
index 6a5a270..e6e5c99 100644 (file)
@@ -129,6 +129,8 @@ namespace Msg {
                        // IBubbleViewItemListener
                        virtual void onAction(BubbleViewItem &item);
 
+                       bool hasAttachments() const;
+
                private:
                        IConvListItemListener *m_pListener;
                        App &m_App;
index 4882a5a..9385300 100644 (file)
@@ -68,6 +68,11 @@ BubbleTextEntity *BubbleEntityFactory::createTextEntity(std::string text, Bubble
        return text.empty() ? nullptr : new BubbleTextEntity(bgType, direction, std::move(text));
 }
 
+BubbleTextEntity *BubbleEntityFactory::createEmptyEntity(BubbleBgViewItem::BgType bgType, Message::Direction direction)
+{
+       return new BubbleTextEntity(bgType, direction, {});
+}
+
 BubbleDownloadButtonEntity *BubbleEntityFactory::createDownloadButtonEntity()
 {
        return new BubbleDownloadButtonEntity;
index aefd920..e4cdb6d 100644 (file)
@@ -255,6 +255,9 @@ void ConvListItem::update(const MsgConversationItem &item)
                                addEntity(m_BubbleEntityFactory.createEntity(media, bgType, m_Direction));
                }
        }
+       if(m_BubbleEntityList.empty())
+               addEntity(m_BubbleEntityFactory.createEmptyEntity(bgType, Message::Direction::MD_Received));
+
 }
 
 void ConvListItem::shareContent()
@@ -347,12 +350,22 @@ void ConvListItem::showPopup()
        m_IsDraft ? showDraftListPopup() : showMainListPopup();
 }
 
+bool ConvListItem::hasAttachments() const
+{
+       for (auto &&iter: m_BubbleEntityList) {
+               if (!iter->getFilePath().empty())
+                       return true;
+       }
+       return false;
+}
+
 void ConvListItem::showMainListPopup()
 {
        auto &listPopup = m_App.getPopupManager().getPopupList(this);
        listPopup.setTitle(msg("IDS_MSGF_BODY_MESSAGE_OPTIONS"));
 
        std::string msgText = getAllMsgText();
+       bool hasAttach = hasAttachments();
 
        if (m_NetworkStatus == Message::NS_Send_Fail)
                listPopup.appendItem(msg("IDS_MSG_OPT_RESEND"), POPUPLIST_ITEM_PRESSED_CB(ConvListItem, onResendItemPressed), this);
@@ -367,7 +380,7 @@ void ConvListItem::showMainListPopup()
        if (!msgText.empty())
                listPopup.appendItem(msg("IDS_MSG_OPT_COPY_TEXT"), POPUPLIST_ITEM_PRESSED_CB(ConvListItem, onCopyTextItemPressed), this);
 
-       if (!m_IsRestrictedByDpm) {
+       if (!m_IsRestrictedByDpm  && (hasAttach || !msgText.empty())) {
                listPopup.appendItem(msg("IDS_MSGF_OPT_FORWARD"), POPUPLIST_ITEM_PRESSED_CB(ConvListItem, onForwardItemPressed), this);
                listPopup.appendItem(msg("IDS_COM_BUTTON_SHARE"), POPUPLIST_ITEM_PRESSED_CB(ConvListItem, onShareItemPressed), this);
        }