TizenRefApp-8645 [Call UI] Implement Voice Mail identify in CallerInfo 97/133497/1
authorIgor Olshevskyi <i.olshevskyi@samsung.com>
Thu, 8 Jun 2017 13:09:19 +0000 (16:09 +0300)
committerIgor Olshevskyi <i.olshevskyi@samsung.com>
Mon, 12 Jun 2017 11:15:28 +0000 (14:15 +0300)
Change-Id: Ia66bb96f0ebcf8af66ab86ac2229456d8ca79c39

inc/model/ICallInfo.h
inc/presenters/CallInfoPresenter.h
inc/resources.h
src/model/CallInfo.cpp
src/model/CallInfo.h
src/presenters/CallInfoPresenter.cpp
src/resources.cpp

index 7c1d4fd952a3abf636e3841f06cf69025ab6bc17..f0f0ba8e5a41b5c2a2eaa77a42b703e50c09aecb 100644 (file)
@@ -31,6 +31,7 @@ namespace callui {
                virtual bool isEmergency() const = 0;
                virtual bool isHDVoice() const = 0;
                virtual bool isForwarded() const = 0;
+               virtual bool isVoiceMailNumber() const = 0;
                virtual int getConferenceMemberCount() const = 0;
                virtual const ConfMemberList &getConferenceMemberList() const = 0;
        };
index eb869783c2f4316bd6aa59ef45871c7435695643..eb9a9f3585d4f5dfdc0149586ca44b8c83ec24aa 100644 (file)
@@ -66,16 +66,15 @@ namespace callui {
                ucl::Result updateSubText();
                ucl::Result updateMainTxt();
 
-               std::string getNumberSubText(const ICallInfoWCRef &callInfo) const;
+               std::string getNumberSubText(const ICallInfoSCRef &callInfo) const;
                std::string getIncomingCallSubText() const;
                std::string getOutgoingCallSubText() const;
                std::string getDuringCallSubText() const;
                std::string getEndCallSubText() const;
 
-               std::string generateMainTxt(const ICallInfoWCRef &callInfo);
+               std::string generateMainTxt(const ICallInfoSCRef &callInfo);
 
-               void displayMainTxt(const std::string &text) const;
-               void displaySubTxt(const std::string &text) const;
+               void displayMainTxt(const ICallInfoSCRef &info, const std::string &text) const;
 
        private:
                ucl::LayoutSRef m_widget;
@@ -87,7 +86,6 @@ namespace callui {
                ICallInfoSCRef m_heldCallInfo;
                ICallInfoSCRef m_endCallInfo;
                CallStatusSRef m_callStatus;
-               bool m_isEmergency;
                bool m_isSubTxtEnable;
                bool m_needModifyCallStatus;
        };
index 9fe4910b9ca5546e7cb34387065a42d96d84230f..a6983eeb31361ec717e7c5fe82e46b0e470fccad 100644 (file)
@@ -35,6 +35,7 @@ namespace callui {
        extern const ucl::TString STR_CONFERENCE_CALL;
        extern const ucl::TString STR_UNKNOWN;
        extern const ucl::TString STR_EMERGENCY_CALL;
+       extern const ucl::TString STR_VOICEMAIL;
 
        extern const ucl::TString STR_INCOMING_CALL;
        extern const ucl::TString STR_DIALING_CALL;
index 7341675b4d4823cd9439134c390a15e4aba8444b..2119de3e8579f896615438b8a94a8d326e52853f 100644 (file)
@@ -67,6 +67,7 @@ namespace callui {
                m_isEmergency(false),
                m_isHDVoice(false),
                m_isForwarded(false),
+               m_isVoiceMailNumber(false),
                m_confMemberCount(0)
        {
        }
@@ -92,31 +93,43 @@ namespace callui {
 
        Result CallInfo::prepare(CallClient &client, cm_call_data_h callData)
        {
-               Result res = convertCMResult(cm_call_data_get_call_id(callData, &m_callId));
+               Result res = convertCMResult(
+                               cm_call_data_get_call_id(callData, &m_callId));
                FAIL_RETURN(res, "cm_call_data_get_call_id() failed!");
 
                char *number = nullptr;
-               res = convertCMResult(cm_call_data_get_call_number(callData, &number));
+               res = convertCMResult(
+                               cm_call_data_get_call_number(callData, &number));
                FAIL_RETURN(res, "cm_call_data_get_call_number() failed!");
                m_phoneNum = nz(number);
                // XXX: According to documentation it must be free, but it leads to crash
 //             free(number);
 
                gboolean isEmergency;
-               res = convertCMResult(cm_call_data_is_emergency_call(callData, &isEmergency));
+               res = convertCMResult(
+                               cm_call_data_is_emergency_call(callData, &isEmergency));
                FAIL_RETURN(res, "cm_call_data_is_emergency_call() failed!");
                m_isEmergency = isEmergency;
 
                int hdIconState = 0;
-               res = convertCMResult(cm_call_data_get_hd_icon_state(callData, &hdIconState));
+               res = convertCMResult(
+                               cm_call_data_get_hd_icon_state(callData, &hdIconState));
                FAIL_RETURN(res, "cm_call_data_get_hd_icon_state() failed!");
                m_isHDVoice = hdIconState;
 
-               res = convertCMResult(cm_call_data_get_start_time(callData, &m_startTime));
+               gboolean isVoiceMailNumber;
+               res = convertCMResult(
+                               cm_call_data_is_voicemail_number(callData, &isVoiceMailNumber));
+               FAIL_RETURN(res, "cm_call_data_is_voicemail_number() failed!");
+               m_isVoiceMailNumber = isVoiceMailNumber;
+
+               res = convertCMResult(
+                               cm_call_data_get_start_time(callData, &m_startTime));
                FAIL_RETURN(res, "cm_call_data_get_start_time() failed!");
 
                int personId = -1;
-               res = convertCMResult(cm_call_data_get_person_id(callData, &personId));
+               res = convertCMResult(
+                               cm_call_data_get_person_id(callData, &personId));
                FAIL_RETURN(res, "cm_call_data_get_person_id() failed!");
 
                if (personId >= 0) {
@@ -205,6 +218,11 @@ namespace callui {
                return m_isForwarded;
        }
 
+       bool CallInfo::isVoiceMailNumber() const
+       {
+               return m_isVoiceMailNumber;
+       }
+
        int CallInfo::getConferenceMemberCount() const
        {
                return m_confMemberCount;
index b3b9aff3a8ab4d70be8f017409aafd67c0ae1d5a..5a0d57e29ba069eb777ec57654121691ad10a59a 100644 (file)
@@ -39,6 +39,7 @@ namespace callui {
                virtual bool isEmergency() const override final;
                virtual bool isHDVoice() const override final;
                virtual bool isForwarded() const override final;
+               virtual bool isVoiceMailNumber() const override final;
                virtual int getConferenceMemberCount() const override final;
                virtual const ConfMemberList &getConferenceMemberList() const override final;
 
@@ -57,6 +58,7 @@ namespace callui {
                bool m_isEmergency;
                bool m_isHDVoice;
                bool m_isForwarded;
+               bool m_isVoiceMailNumber;
                int m_confMemberCount;
                ConfMemberList m_confMemberList;
        };
index 1e49f044068afcf110423d984bba28e511a3e2af..58cef09d05bbedc60a1e92712dd0fb807d6e95e9 100644 (file)
@@ -126,7 +126,6 @@ namespace callui {
                        CallMode mode):
                        Presenter(rc),
                        m_mode(mode),
-                       m_isEmergency(false),
                        m_isSubTxtEnable(false),
                        m_needModifyCallStatus(false)
        {
@@ -206,7 +205,8 @@ namespace callui {
                }
        }
 
-       Result CallInfoPresenter::update(CallMode mode, const ICallManagerSRef &cm)
+       Result CallInfoPresenter::update(CallMode mode,
+                       const ICallManagerSRef &cm)
        {
                m_needModifyCallStatus = false;
                if (mode != m_mode || mode == CallMode::DURING) {
@@ -215,13 +215,13 @@ namespace callui {
 
                m_mode = mode;
                initCallInfos(cm);
-               m_isEmergency = false;
                m_isSubTxtEnable = false;
 
                return update();
        }
 
-       std::string CallInfoPresenter::getNumberSubText(const ICallInfoWCRef &callInfo) const
+       std::string CallInfoPresenter::getNumberSubText(
+                       const ICallInfoSCRef &callInfo) const
        {
                if (!callInfo) {
                        FAIL_RETURN_VALUE(RES_FAIL, "", "callInfo is NULL!");
@@ -252,7 +252,13 @@ namespace callui {
                        if (displStr.empty()) {
                                displStr = STR_UNKNOWN.translate();
                        }
-                       return TString{STR_CALL_WITH_PS_WILL_END.translate()}.format(displStr.c_str());
+                       return TString{STR_CALL_WITH_PS_WILL_END.translate()}.
+                                       format(displStr.c_str());
+               }
+
+               if (m_incomCallInfo->isVoiceMailNumber() ||
+                               m_incomCallInfo->isEmergency()){
+                       return "";
                }
 
                return getNumberSubText(m_incomCallInfo);
@@ -265,12 +271,14 @@ namespace callui {
                        if (m_heldCallInfo) {
                                return STR_CALL_ON_HOLD.translate();
                        } else if (confMemberCount > 1) {
-                               return TString{STR_WITH_PD_PEOPLE.translate()}.format(confMemberCount);
+                               return TString{STR_WITH_PD_PEOPLE.translate()}.
+                                               format(confMemberCount);
                        }
                } else if (m_heldCallInfo) {
                        auto confMemberCount = m_heldCallInfo->getConferenceMemberCount();
                        if (confMemberCount > 1) {
-                               return TString{STR_WITH_PD_PEOPLE.translate()}.format(confMemberCount);
+                               return TString{STR_WITH_PD_PEOPLE.translate()}.
+                                               format(confMemberCount);
                        }
                } else {
                        ELOG("Invalid call data");
@@ -287,7 +295,8 @@ namespace callui {
 
                auto confMemberCount = m_endCallInfo->getConferenceMemberCount();
                if (confMemberCount > 1) {
-                       return TString{STR_WITH_PD_PEOPLE.translate()}.format(confMemberCount);
+                       return TString{STR_WITH_PD_PEOPLE.translate()}.
+                                       format(confMemberCount);
                }
 
                return "";
@@ -312,7 +321,8 @@ namespace callui {
                label->setText(tmp);
 
                elm_label_slide_mode_set(*label, ELM_LABEL_SLIDE_MODE_AUTO);
-               elm_label_wrap_width_set(*label, ELM_SCALE_SIZE(impl::SUB_TXT_WIDTH));
+               elm_label_wrap_width_set(*label,
+                               ELM_SCALE_SIZE(impl::SUB_TXT_WIDTH));
                elm_label_slide_duration_set(*label, duration);
                elm_label_slide_go(*label);
 
@@ -417,7 +427,8 @@ namespace callui {
                return RES_OK;
        }
 
-       std::string CallInfoPresenter::generateMainTxt(const ICallInfoWCRef &callInfo)
+       std::string CallInfoPresenter::generateMainTxt(
+                       const ICallInfoSCRef &callInfo)
        {
                if (!callInfo) {
                        LOG_RETURN_VALUE(RES_FAIL, "", "callInfo is NULL");
@@ -428,10 +439,13 @@ namespace callui {
                }
 
                if (callInfo->isEmergency()) {
-                       m_isEmergency = true;
                        return STR_EMERGENCY_CALL.translate();
                }
 
+               if (callInfo->isVoiceMailNumber()) {
+                       return STR_VOICEMAIL.translate();
+               }
+
                std::string mainTxt;
                auto contactInfo = callInfo->getContactInfo();
                if (contactInfo) {
@@ -447,7 +461,8 @@ namespace callui {
                return mainTxt;
        }
 
-       void CallInfoPresenter::displayMainTxt(const std::string &text) const
+       void CallInfoPresenter::displayMainTxt(const ICallInfoSCRef &info,
+                       const std::string &text) const
        {
                m_widget->setText(text.c_str(), impl::PART_TXT_MAIN);
 
@@ -463,7 +478,7 @@ namespace callui {
 
                        m_widget->emit(impl::SIGN_CALLER_ID_DISABLE, impl::SRC_TXT_1LINE);
 
-                       if (m_isEmergency) {
+                       if (info->isEmergency()) {
                                m_widget->emit(impl::SIGN_EMERGENCY_MODE, impl::SRC_TXT_1LINE);
                        }
 
@@ -500,33 +515,41 @@ namespace callui {
        Result CallInfoPresenter::updateMainTxt()
        {
                std::string mainTxt;
+
+               ICallInfoSCRef info;
+
                switch (m_mode) {
                case CallMode::INCOMING:
-                       mainTxt = generateMainTxt(m_incomCallInfo);
+                       info = m_incomCallInfo;
                        break;
                case CallMode::OUTGOING:
-                       mainTxt = generateMainTxt(m_activeCallInfo);
+                       info = m_activeCallInfo;
                        break;
                case CallMode::DURING:
                        if (m_activeCallInfo) {
-                               mainTxt = generateMainTxt(m_activeCallInfo);
+                               info = m_activeCallInfo;
                        } else if (m_heldCallInfo) {
-                               mainTxt = generateMainTxt(m_heldCallInfo);
+                               info = m_heldCallInfo;
                        }
                        break;
                case CallMode::END:
-                       mainTxt = generateMainTxt(m_endCallInfo);
+                       info = m_endCallInfo;
                        break;
                default:
                        LOG_RETURN(RES_FAIL, "Unknown mode");
                        break;
                }
+               if (!info) {
+                       LOG_RETURN(RES_FAIL, "info is NULL");
+               }
+
+               mainTxt = generateMainTxt(info);
 
                if (mainTxt.empty()) {
                        LOG_RETURN(RES_FAIL, "Main text is empty");
                }
 
-               displayMainTxt(mainTxt);
+               displayMainTxt(info, mainTxt);
 
                return RES_OK;
        }
index fdd8f187857d519e37191bb1adeb334d87b3ec91..e2258e7d2766aff998cce3b5dc5c41f7c71a0273 100644 (file)
@@ -30,6 +30,7 @@ namespace callui {
        const ucl::TString STR_CONFERENCE_CALL {"Conference call"};
        const ucl::TString STR_UNKNOWN {"Unknown"};
        const ucl::TString STR_EMERGENCY_CALL {"Emergency call"};
+       const ucl::TString STR_VOICEMAIL {"Voicemail"};
 
        const ucl::TString STR_INCOMING_CALL {"Incoming call"};
        const ucl::TString STR_DIALING_CALL {"Dialing"};