summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Dolzhenko <d.dolzhenko@samsung.com>2017-10-23 14:49:20 +0300
committerDenis Dolzhenko <d.dolzhenko@samsung.com>2017-10-23 15:21:01 +0300
commit3d93f4f8608cbb3b3992232697a062d4e59d3979 (patch)
tree3a0c3f180097571e976d468773dbceb3d40133b8
parent776174ca7521d07399b17def58c9154894d09add (diff)
downloadmessage-3d93f4f8608cbb3b3992232697a062d4e59d3979.tar.gz
message-3d93f4f8608cbb3b3992232697a062d4e59d3979.tar.bz2
message-3d93f4f8608cbb3b3992232697a062d4e59d3979.zip
TizenRefApp-9668 Implement image sendingtizen_4.0.IoT.p2_releasesubmit/tizen_4.0/20171024.072906
Change-Id: Ia8f288456a3c1430e53378b02d5896c7f2371fbb Signed-off-by: Denis Dolzhenko <d.dolzhenko@samsung.com>
-rw-r--r--src/Common/AppControl/inc/InputSelector.h1
-rw-r--r--src/Common/AppControl/src/InputSelector.cpp5
-rw-r--r--src/Composer/Controller/inc/MsgInputController.h1
-rw-r--r--src/Composer/Controller/src/MsgInputController.cpp22
-rw-r--r--src/Composer/Controller/src/MsgSenderController.cpp16
5 files changed, 28 insertions, 17 deletions
diff --git a/src/Common/AppControl/inc/InputSelector.h b/src/Common/AppControl/inc/InputSelector.h
index 103f44b..2b9063a 100644
--- a/src/Common/AppControl/inc/InputSelector.h
+++ b/src/Common/AppControl/inc/InputSelector.h
@@ -76,6 +76,7 @@ namespace Msg {
virtual void onKeyboardReply(const std::string &text, int cursorPos) {};
virtual void onTemplateReply(const std::string &text) {};
virtual void onVoiceReply(const std::string &text, const std::list<std::string> &filePath) {};
+ virtual void onImageReply(const std::list<std::string> &filePath) {};
virtual void onEmoticonReply(const std::string &emoticon) {};
};
}
diff --git a/src/Common/AppControl/src/InputSelector.cpp b/src/Common/AppControl/src/InputSelector.cpp
index a62a65a..c8991fe 100644
--- a/src/Common/AppControl/src/InputSelector.cpp
+++ b/src/Common/AppControl/src/InputSelector.cpp
@@ -24,7 +24,7 @@ InputSelector::InputSelector()
{
setOperation(APP_CONTROL_OPERATION_GET_INPUT);
addExtraData("return_key_type", "DONE");
- setMime("text/plain");
+ setMime("*/*");
}
InputSelector::~InputSelector()
@@ -103,6 +103,9 @@ void InputSelector::onReply(app_control_h request, app_control_h reply, app_cont
m_pListener->onVoiceReply(text, fileList);
} else if (replyType == "template") {
m_pListener->onTemplateReply(text);
+ } else if (replyType == "image") {
+ auto fileList = AppControlUtils::getExtraDataArray(reply, APP_CONTROL_DATA_PATH);
+ m_pListener->onImageReply(fileList);
}
}
}
diff --git a/src/Composer/Controller/inc/MsgInputController.h b/src/Composer/Controller/inc/MsgInputController.h
index 87f832e..26e4853 100644
--- a/src/Composer/Controller/inc/MsgInputController.h
+++ b/src/Composer/Controller/inc/MsgInputController.h
@@ -68,6 +68,7 @@ namespace Msg {
void onKeyboardReply(const std::string &text, int cursorPos) override;
void onVoiceReply(const std::string &text, const std::list<std::string> &fileList) override;
void onEmoticonReply(const std::string &emoticon) override;
+ void onImageReply(const std::list<std::string> &fileList) override;
void onTerminate(InputSelector &) override;
private:
diff --git a/src/Composer/Controller/src/MsgInputController.cpp b/src/Composer/Controller/src/MsgInputController.cpp
index ac8722d..1717404 100644
--- a/src/Composer/Controller/src/MsgInputController.cpp
+++ b/src/Composer/Controller/src/MsgInputController.cpp
@@ -104,8 +104,11 @@ bool MsgInputController::launchTextInputView(const std::string &text)
void MsgInputController::notifyOnSendRequest()
{
- if (m_pListener)
- m_pListener->onSendRequest(*this);
+ if (m_pListener) {
+ bool isEmpty = m_InputData.files.empty() && m_InputData.text.empty();
+ if (!isEmpty)
+ m_pListener->onSendRequest(*this);
+ }
}
void MsgInputController::onDestroy(MsgBodyFrame &frame)
@@ -151,14 +154,15 @@ void MsgInputController::onEmoticonReply(const std::string &emoticon)
void MsgInputController::onVoiceReply(const std::string &text, const std::list<std::string> &fileList)
{
MSG_LOG("");
+ m_InputData.files = fileList;
+ m_InputData.text = text;
+ notifyOnSendRequest();
+}
- // TODO: Dummy file for test
- #if (0)
- std::string file = PathUtils::getResourcePath("dummy_res/1.mp3");
- m_InputData.files.push_back(file);
- m_InputData.files = fileList;
- #endif
-
+void MsgInputController::onImageReply(const std::list<std::string> &fileList)
+{
+ MSG_LOG("");
+ m_InputData.files = fileList;
notifyOnSendRequest();
}
diff --git a/src/Composer/Controller/src/MsgSenderController.cpp b/src/Composer/Controller/src/MsgSenderController.cpp
index 592950b..b870377 100644
--- a/src/Composer/Controller/src/MsgSenderController.cpp
+++ b/src/Composer/Controller/src/MsgSenderController.cpp
@@ -108,10 +108,15 @@ void MsgSenderController::setText(std::string text)
bool MsgSenderController::addFile(const std::string &file)
{
- std::string newFilePath = m_WorkingDir->addFile(file);
- bool isValid = !newFilePath.empty();
- if (isValid)
- m_Files.push_back(std::move(newFilePath));
+ bool isValid = FileUtils::isExists(file);
+ if (isValid) {
+ std::string newFilePath = m_WorkingDir->addFile(file);
+ isValid = !newFilePath.empty();
+ if (isValid)
+ m_Files.push_back(std::move(newFilePath));
+ } else {
+ MSG_LOG_ERROR("File path is not valid: ", file);
+ }
return isValid;
}
@@ -389,9 +394,7 @@ std::vector<MessageRef> MsgSenderController::createMessage()
return {};
}
- MSG_LOG("");
if (m_Files.empty()) {
- MSG_LOG("");
// Text messages:
auto textList = MsgUtils::splitUtf8String(m_Text, maxMsgSize);
for (auto &&text : textList) {
@@ -405,7 +408,6 @@ std::vector<MessageRef> MsgSenderController::createMessage()
}
}
} else {
- MSG_LOG("");
// Create MMS:
auto mms = msgEngine.getComposer().createMms();
if (mms) {