M module-apps/application-call/data/CallAppStyle.hpp => module-apps/application-call/data/CallAppStyle.hpp +8 -1
@@ 1,4 1,4 @@
-// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
+// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#pragma once
@@ 84,6 84,13 @@ namespace callAppStyle
inline constexpr auto w = 240U;
inline constexpr auto h = 20U;
} // namespace durationLabel
+ namespace enteredDigitsLabel
+ {
+ inline constexpr auto x = 120U;
+ inline constexpr auto y = 360U;
+ inline constexpr auto w = 240U;
+ inline constexpr auto h = 20U;
+ } // namespace enteredDigitsLabel
namespace iconsBox
{
inline constexpr auto y = 411U;
M module-apps/application-call/presenter/CallPresenter.cpp => module-apps/application-call/presenter/CallPresenter.cpp +12 -0
@@ 43,6 43,8 @@ namespace app::call
auto view = getView();
auto callState = model->getState();
+ view->setEnteredNumberVisible(false);
+
switch (callState) {
case app::call::CallState::Incoming: {
view->updateDuration(utils::translate(callAppStyle::strings::iscalling));
@@ 58,6 60,7 @@ namespace app::call
}
case app::call::CallState::Active: {
view->updateDuration(utils::time::Duration(model->getTime()).str());
+ view->setEnteredNumberVisible(true);
view->setActiveCallLayout();
break;
}
@@ 144,6 147,10 @@ namespace app::call
bool CallWindowContract::Presenter::handleDigitButton(const uint32_t &digit)
{
+ auto digitChar = static_cast<char>(digit);
+ if (isCallInProgress() && isProvidedCharValid(digitChar)) {
+ getView()->updateEnteredNumber(digitChar);
+ }
model->transmitDtmfTone(digit);
return true;
}
@@ 204,5 211,10 @@ namespace app::call
{
model->clear();
}
+ bool CallWindowContract::Presenter::isProvidedCharValid(const char digitChar)
+ {
+ // Return true if the character comes from the phone's numeric keypad
+ return (std::isdigit(digitChar) || digitChar == '*' || digitChar == '#');
+ }
} // namespace app::call
M module-apps/application-call/presenter/CallPresenter.hpp => module-apps/application-call/presenter/CallPresenter.hpp +15 -12
@@ 15,17 15,19 @@ namespace app::call
class View
{
public:
- virtual void updateDuration(const UTF8 &text, bool isVisible = true) = 0;
- virtual void refreshWindow() = 0;
- virtual void setNavBarForActiveCall() = 0;
- virtual void setNavBarForIncomingCall() = 0;
- virtual void clearNavBar() = 0;
- virtual void setIncomingCallLayout(bool isValidCallerId) = 0;
- virtual void setActiveCallLayout() = 0;
- virtual void setCallEndedLayout(bool delayedClose = true) = 0;
- virtual void updateNumber(const UTF8 &text) = 0;
- virtual gui::SpeakerIconState getSpeakerIconState() = 0;
- virtual void setSpeakerIconState(const gui::SpeakerIconState &icon) = 0;
+ virtual void updateDuration(const UTF8 &text, bool isVisible = true) = 0;
+ virtual void updateEnteredNumber(const char &text, bool isVisible = true) = 0;
+ virtual void setEnteredNumberVisible(bool isVisible) = 0;
+ virtual void refreshWindow() = 0;
+ virtual void setNavBarForActiveCall() = 0;
+ virtual void setNavBarForIncomingCall() = 0;
+ virtual void clearNavBar() = 0;
+ virtual void setIncomingCallLayout(bool isValidCallerId) = 0;
+ virtual void setActiveCallLayout() = 0;
+ virtual void setCallEndedLayout(bool delayedClose = true) = 0;
+ virtual void updateNumber(const UTF8 &text) = 0;
+ virtual gui::SpeakerIconState getSpeakerIconState() = 0;
+ virtual void setSpeakerIconState(const gui::SpeakerIconState &icon) = 0;
virtual ~View() noexcept = default;
};
@@ 58,12 60,13 @@ namespace app::call
void processCurrentRouting(const audio::Profile::Type &routingType);
void attachCallbacks();
void clearModel();
+ bool isCallInProgress();
private:
std::shared_ptr<app::call::AbstractCallModel> model;
UTF8 getCallerId();
bool isIncomingCall();
- bool isCallInProgress();
+ bool isProvidedCharValid(const char digitChar);
};
};
} // namespace app::call
M module-apps/application-call/test/mock/CallPresenterMocks.hpp => module-apps/application-call/test/mock/CallPresenterMocks.hpp +2 -0
@@ 16,6 16,8 @@ namespace app::call
{
duration = text;
};
+ void updateEnteredNumber(const char &text, bool isVisible = true) override{};
+ void setEnteredNumberVisible(bool isVisible) override{};
void refreshWindow() override
{
windowRefreshed = true;
M module-apps/application-call/windows/CallWindow.cpp => module-apps/application-call/windows/CallWindow.cpp +28 -0
@@ 67,6 67,17 @@ namespace gui
durationLabel->setAlignment(
gui::Alignment(gui::Alignment::Horizontal::Center, gui::Alignment::Vertical::Bottom));
+ enteredDigitsLabel = new gui::Label(
+ this, enteredDigitsLabel::x, enteredDigitsLabel::y, enteredDigitsLabel::w, enteredDigitsLabel::h);
+ enteredDigitsLabel->setFilled(false);
+ enteredDigitsLabel->setBorderColor(gui::ColorNoColor);
+ enteredDigitsLabel->setEdges(gui::RectangleEdge::None);
+ enteredDigitsLabel->setTextEllipsisType(gui::TextEllipsis::Left);
+ enteredDigitsLabel->setFont(style::window::font::mediumbold);
+ enteredDigitsLabel->setAlignment(
+ gui::Alignment(gui::Alignment::Horizontal::Center, gui::Alignment::Vertical::Bottom));
+ enteredDigitsLabel->setCursorStartPosition(CursorStartPosition::DocumentEnd);
+
numberLabel = new gui::Label(this, numberLabel::x, numberLabel::y, numberLabel::w, numberLabel::h);
numberLabel->setFilled(false);
numberLabel->setBorderColor(gui::ColorNoColor);
@@ 154,6 165,23 @@ namespace gui
}
}
+ void CallWindow::updateEnteredNumber(const char &newCharacter, bool isVisible)
+ {
+ if (enteredDigitsLabel != nullptr && isVisible) {
+ auto newText = enteredDigitsLabel->getText();
+ newText.insert(&newCharacter);
+ enteredDigitsLabel->setText(newText);
+ enteredDigitsLabel->setVisible(isVisible);
+ }
+ }
+
+ void CallWindow::setEnteredNumberVisible(bool isVisible)
+ {
+ if (enteredDigitsLabel != nullptr) {
+ enteredDigitsLabel->setVisible(isVisible);
+ }
+ }
+
void CallWindow::onBeforeShow([[maybe_unused]] ShowMode mode, SwitchData *data)
{
presenter.buildLayout();
M module-apps/application-call/windows/CallWindow.hpp => module-apps/application-call/windows/CallWindow.hpp +4 -0
@@ 33,6 33,8 @@ namespace gui
gui::Label *numberLabel = nullptr;
// used to inform user about call state of call and display duration of call
gui::Label *durationLabel = nullptr;
+ // used to inform user about provided numbers during the call
+ gui::Label *enteredDigitsLabel = nullptr;
gui::HBox *iconsBox = nullptr;
gui::SendSmsIcon *sendSmsIcon = nullptr;
@@ 59,6 61,8 @@ namespace gui
void refreshWindow() override;
void updateDuration(const UTF8 &text, bool isVisible = true) override;
+ void updateEnteredNumber(const char &newCharacter, bool isVisible = true) override;
+ void setEnteredNumberVisible(bool isVisible) override;
void setNavBarForActiveCall() override;
void setNavBarForIncomingCall() override;
void clearNavBar() override;
M pure_changelog.md => pure_changelog.md +1 -0
@@ 25,6 25,7 @@
* Added confirmation window when closing an app with unsaved changes.
* Added preserving message text and recipient number when closing new message window.
* Added confirmation window when switching to tethering from an app with unsaved changes.
+* Added displaying number entered on the keypad during a call
### Changed / Improved