TizenRefApp-8362 Implement navigation after sent message 80/124780/1
authorDenis Dolzhenko <d.dolzhenko@samsung.com>
Wed, 12 Apr 2017 10:24:04 +0000 (13:24 +0300)
committerDenis Dolzhenko <d.dolzhenko@samsung.com>
Wed, 12 Apr 2017 10:24:04 +0000 (13:24 +0300)
Change-Id: I650cc8793aa788ba346741f1bf1e97bc79df80a5
Signed-off-by: Denis Dolzhenko <d.dolzhenko@samsung.com>
src/Common/Controller/inc/App.h
src/Common/Controller/inc/NaviFrameController.h
src/Common/Controller/src/App.cpp
src/Common/Controller/src/NaviFrameController.cpp
src/Composer/Controller/inc/MsgBodyFrame.h
src/Composer/Controller/src/MsgBodyFrame.cpp
src/Conversation/Controller/src/ConvListItem.cpp
src/MsgThread/Controller/inc/MsgThreadFrame.h
src/MsgThread/Controller/src/MsgThreadFrame.cpp

index 082120b3d208df9c402436e064baa39dedd42b65..fe271fb44f4666cea69ddf0e8106843ef38f8f9a 100644 (file)
@@ -40,6 +40,7 @@ namespace Msg {
             void addListener(IAppListener &l);
             void removeListener(IAppListener &l);
             bool isPause() const;
+            bool isTerminating() const;
             void updateActiveNotifPolicy();
 
             Window &getWindow();
@@ -90,6 +91,7 @@ namespace Msg {
             std::list<IAppListener*> m_Listeners;
             NaviFrameController *m_pNaviFrame;
             bool m_IsPause;
+            bool m_IsTerminating;
             bool m_NeedToCloseApp;
     };
 
index 1e10858091a78b112acf5440bda97a1468f5f7d6..ea3ba8e7e5f025ec3501133425a8f09d55cbac0c 100644 (file)
@@ -38,7 +38,12 @@ namespace Msg {
              * @param[in] frame FrameController for pop
              */
             void pop(FrameController &frame);
-            using NaviFrameView::pop;
+
+            /**
+             * @brief Pops top item from Naviframe.
+             * @param[in] count of frames for pop.
+             */
+            void pop(int count);
 
             /**
              * @brief Executes app control command of default type.
index 773fae85d9936f091a375d083011369624841cbe..961bc532ebe2f7445f949dd69ef9841d669d020f 100644 (file)
@@ -55,6 +55,7 @@ App::App()
     , m_pSysSettingsManager(nullptr)
     , m_pNaviFrame(nullptr)
     , m_IsPause(true)
+    , m_IsTerminating(false)
     , m_NeedToCloseApp(true)
 {
     MSG_ASSERT(!appInstance, "Previous instance of application is not null");
@@ -81,6 +82,7 @@ App &App::getInst()
 void App::exit()
 {
     // TODO: Temporary solution
+    m_IsTerminating = true;
     terminate();
 /*
     if (m_NeedToCloseApp)
@@ -228,6 +230,11 @@ bool App::isPause() const
     return m_IsPause;
 }
 
+bool App::isTerminating() const
+{
+    return m_IsTerminating;
+}
+
 void App::addTheme(const std::string &themePath)
 {
     std::string path = PathUtils::getResourcePath(themePath);
index c4822137bfa8f684ed0b3c7a40b606a0242dd722..0f1bf9d2c31838846193f0e7b31102fd6951db93 100644 (file)
@@ -28,6 +28,7 @@
 #include "ToastPopup.h"
 
 #include <memory>
+#include <algorithm>
 
 using namespace Msg;
 
@@ -53,6 +54,15 @@ void NaviFrameController::pop(FrameController &frame)
     }
 }
 
+void NaviFrameController::pop(int count)
+{
+    for (int i = 0; i < count; ++i) {
+        auto *frame = getTopFrame();
+        if (frame)
+            pop(*frame);
+    }
+}
+
 void NaviFrameController::destroy()
 {
     NaviFrameView::destroy();
index 6a553793afbaa4ca79cb98da3e5fd4ed97f017b8..19a73fdb2437ea0a26c54438ce3fc068412319f9 100644 (file)
@@ -54,6 +54,7 @@ namespace Msg {
             bool read(Message &msg);
             bool readBody(Message &msg);
             bool readAddress(Message &msg);
+            void navigateAfterSent();
 
             // Popup:
             void showMaxCharactersPopup();
index 09e5b44c3d9bb38120f433c58b0e5b110176e08c..c152e5c81371420940e13bd181487baa3225bbee 100644 (file)
@@ -24,6 +24,7 @@
 #include "MsgEngine.h"
 #include "SystemSettingsManager.h"
 #include "PopupManager.h"
+#include "ConvFrame.h"
 
 using namespace Msg;
 
@@ -160,6 +161,21 @@ void MsgBodyFrame::sendMsg()
     }
 }
 
+void MsgBodyFrame::navigateAfterSent()
+{
+    // Close composer: BodyFrame, RecipFrame
+    getParent().pop(2);
+
+    if (!App::getInst().isTerminating()) {
+        // Navigate to ConvFrame
+        if (m_ThreadId.isValid()) {
+            auto *conv = new ConvFrame(getParent());
+            conv->setThreadId(m_ThreadId);
+            getParent().push(*conv);
+        }
+    }
+}
+
 void MsgBodyFrame::showMaxCharactersPopup()
 {
     ToastPopup::toast(msgt("WDS_WIFI_TPOP_MAXIMUM_NUMBER_OF_CHARACTERS_REACHED"));
@@ -314,17 +330,19 @@ void MsgBodyFrame::onMsgTransportSentStatus(const MsgSentStatus &status)
     MSG_LOG("Id = ", id);
     MSG_LOG("Network status = ", networkStatus);
 
-    if (m_pSendingPopup &&
-        m_ReqtId == id &&
-        networkStatus != Message::NS_Send_Pending &&
-        networkStatus != Message::NS_Sending) {
+    if (m_pSendingPopup && m_ReqtId == id && networkStatus != Message::NS_Sending) {
         if (networkStatus == Message::NS_Send_Success) {
             m_pSendingPopup->setIcon(IconTextPopup::CheckIcon);
             m_pSendingPopup->setText(msgt("WDS_WNOTI_TPOP_SENT_ABB"));
+            m_pSendingPopup->setTimeOut();
         } else if (networkStatus == Message::NS_Send_Fail) {
             m_pSendingPopup->setIcon(IconTextPopup::FailedIcon);
             m_pSendingPopup->setText(msgt("WDS_MSG_TPOP_SENDING_FAILED_ABB"));
+            m_pSendingPopup->setTimeOut();
+        } else if (networkStatus != Message::NS_Send_Pending) {
+            m_pSendingPopup->destroy();
+            showSentWhenServiceBecomesAvailablePopup();
         }
-        m_pSendingPopup->setTimeOut();
+        navigateAfterSent();
     }
 }
index 41314cc8e38f486312d3195090ae4d4f8852f3ee..e8c33a9d581f4106e692ffea66a82328b30efabd 100644 (file)
@@ -72,6 +72,7 @@ void ConvListItem::updateViewStatus()
         break;
 
     case Message::NS_Sending:
+    case Message::NS_Send_Pending:
         setInfoStatus(ConvListViewItem::ProgressStatus);
         break;
 
index 9422175e41d921e8bfefd4fbcbe5799065c01775..02c75085f3cf6b1773bf0620cfc40fbfa4dd844b 100644 (file)
@@ -55,6 +55,7 @@ namespace Msg {
 
             void showSelectPopup();
             void navigateToConvFrame(ThreadId id);
+            void navigateToComposeFrame();
 
         private:
             // NaviFrameItem:
index b20a2286cc01df1bc01cb387faaf178207d145d2..461a4faed8ab3088e8dcd5c14ad739c697bae9f2 100644 (file)
@@ -177,6 +177,12 @@ void MsgThreadFrame::navigateToConvFrame(ThreadId id)
     getParent().push(*frame);
 }
 
+void MsgThreadFrame::navigateToComposeFrame()
+{
+    auto *recipFrame = new RecipFrame(getParent());
+    getParent().push(*recipFrame);
+}
+
 void MsgThreadFrame::onAttached(ViewItem &item)
 {
     MSG_LOG("");
@@ -229,8 +235,7 @@ void MsgThreadFrame::onDeselectAllButtonClicked(CtxPopupItem &item)
 void MsgThreadFrame::onNewMessageClicked(MoreOption &obj)
 {
     MSG_LOG("");
-    auto *recipFrame = new RecipFrame(getParent());
-    getParent().push(*recipFrame);
+    navigateToComposeFrame();
 }
 
 void MsgThreadFrame::onDeleteClicked(MoreOption &obj)
@@ -273,6 +278,7 @@ void MsgThreadFrame::onItemChecked(ThreadListItem &item)
 void MsgThreadFrame::onComposeButtonClicked(ThreadList &list)
 {
     MSG_LOG("");
+    navigateToComposeFrame();
 }
 
 void MsgThreadFrame::onContactsButtonClicked(ThreadList &list)