TizenRefApp-8552 Implement retransmission of message 61/130961/3
authorOleksander Kostenko <o.kostenko@samsung.com>
Wed, 24 May 2017 14:47:40 +0000 (17:47 +0300)
committerOleksander Kostenko <o.kostenko@samsung.com>
Fri, 26 May 2017 07:17:30 +0000 (10:17 +0300)
Change-Id: I98477bd7d2f7ad7b84e4b6d11d69b79524e06595
Signed-off-by: Oleksander Kostenko <o.kostenko@samsung.com>
src/Conversation/Controller/inc/ConvList.h
src/Conversation/Controller/inc/ConvListItem.h
src/Conversation/Controller/src/ConvList.cpp
src/Conversation/Controller/src/ConvListItem.cpp
src/Conversation/View/inc/ConvListViewItem.h
src/Conversation/View/src/ConvListViewItem.cpp

index 9fd840c421cd7dfeb1f30a1de4fbfb56cb023614..5822475e2ba8de919e6f7fc95f922e09b446ba81 100644 (file)
@@ -95,6 +95,7 @@ namespace Msg {
             void demoteItem(ConvListItem &item); // move down existing item
             void clear();
             void markAsRead();
+            void resendMsg(ConvListItem &listItem);
 
         private:
             bool m_IsDeleteMode;
index e04db946d3c84d2a870e5b19806bd3aa7e6a122f..b0f970ddb124a7dc9e0b8c88c224b177ee304d44 100644 (file)
@@ -48,6 +48,8 @@ namespace Msg {
             void updateStatus();
             void updateLangInfo();
             void updateTime();
+            void setActionEventFlag(bool isAction = true);
+            bool getActionEventFlag() const;
 
         protected:
             Evas_Object *getBubbleContent() override;
@@ -81,6 +83,7 @@ namespace Msg {
             WorkingDirRef m_WorkingDir;
             BubbleEntityFactory &m_BubbleEntityFactory;
             FileViewer m_FileViewer;
+            bool m_ActionEventFlag;
     };
 }
 
index abb637a2deebc5be232b509c467cee523cf3f462..aa0411334a8759ec58808d6704566bff44d2638a 100644 (file)
@@ -292,11 +292,27 @@ void ConvList::markAsRead()
         getMsgStorage().setReadStatus(m_ThreadId);
 }
 
+void ConvList::resendMsg(ConvListItem &listItem)
+{
+    MSG_LOG("");
+    MessageRef msg = getMsgStorage().getMessage(listItem.getMsgId());
+    if (msg)
+        App::getInst().getMsgEngine().getTransport().sendMessage(msg);
+}
+
 void ConvList::onListItemSelected(ListItem &listItem)
 {
     MSG_LOG("");
     if (dynamic_cast<ConvReplyListItem*>(&listItem) && m_pListener)
         m_pListener->onReplyButtonClicked(*this);
+
+    auto *convItem = dynamic_cast<ConvListItem*>(&listItem);
+    if (convItem) {
+        if (convItem->getStatusType() == ConvListViewItem::FailedStatus && !convItem->getActionEventFlag())
+            resendMsg(*convItem);
+
+        convItem->setActionEventFlag(false);
+    }
 }
 
 void ConvList::onListItemLongPressed(ListItem &listItem)
index c6f28a91166be7b7d30ac38cd153785f56c0d1a7..a0e87c22975af8b93b413b7b9f1e2058f659224d 100644 (file)
@@ -46,6 +46,7 @@ ConvListItem::ConvListItem(const MsgConversationItem &item,
     , m_Type(item.getType())
     , m_WorkingDir(workingDir)
     , m_BubbleEntityFactory(bubbleEntityFactory)
+    , m_ActionEventFlag(false)
 {
     prepareContent(item);
     updateViewStatus();
@@ -110,6 +111,16 @@ void ConvListItem::updateLangInfo()
     updateTime();
 }
 
+void ConvListItem::setActionEventFlag(bool isAction)
+{
+    m_ActionEventFlag = isAction;
+}
+
+bool ConvListItem::getActionEventFlag() const
+{
+    return m_ActionEventFlag;
+}
+
 void ConvListItem::showMobileDataOffPopup()
 {
     ToastPopup::toast(msgt("WDS_MSG_TPOP_UNABLE_TO_RETRIEVE_MESSAGE_MOBILE_DATA_OFF_ABB"), nullptr);
@@ -184,10 +195,13 @@ void ConvListItem::onAction(BubbleViewItem &item)
     MSG_LOG("");
     if (auto *audio = dynamic_cast<BubbleAudioEntity*>(&item.getEntity())) {
         audio->clickHandler();
+        setActionEventFlag();
     } else {
         std::string filePath = item.getEntity().getFilePath();
-        if (!filePath.empty())
+        if (!filePath.empty()) {
+            setActionEventFlag();
             m_FileViewer.launchWithCopy(filePath);
+        }
     }
 }
 
index f0cda3a45b2b99f9b75b63f409976696a60a8f8b..4025af13fa328394012c07b26577acdfe5b2ff55 100644 (file)
@@ -39,6 +39,7 @@ namespace Msg {
 
             void setCheckedState(bool state, bool updateUi) override;
             void setInfoStatus(InfoStatusType statusType);
+            InfoStatusType getStatusType() const;
 
         protected:
             virtual Evas_Object *getBubbleContent() = 0;
index 1e836016de86f72f02a7b784dafab7bcef39a897..6dc5ad27915d3b1f5c88b21a080b115f89f92fe3 100644 (file)
@@ -63,6 +63,11 @@ void ConvListViewItem::setInfoStatus(InfoStatusType statusType)
     }
 }
 
+ConvListViewItem::InfoStatusType ConvListViewItem::getStatusType() const
+{
+    return m_Status;
+}
+
 std::string ConvListViewItem::getText(ListItem &item, const char *part)
 {
     if (m_Status == NoneStatus || m_Type == Received) {