~aleteoryx/muditaos

3b24ac9e903b7d75ca9e2a09d6317df4e32efaef — Lefucjusz 2 years ago 674a768
[MOS-1047] Fix calling abort() in EnterNumberWindow

* Removed call to abort() method in case
EnterNumberWindow's SwitchData handler
receives message that can't be handled,
what caused the phone to crash.
* Unify ApplicationCall window names
definitions.
* Code cleanup.
M module-apps/application-call/ApplicationCall.cpp => module-apps/application-call/ApplicationCall.cpp +59 -53
@@ 28,14 28,18 @@
#include <cassert>
#include <memory>

namespace app
namespace
{
    constexpr auto applicationCallStackSize = 1024 * 8;
}

namespace app
{
    ApplicationCall::ApplicationCall(std::string name,
                                     std::string parent,
                                     StatusIndicators statusIndicators,
                                     StartInBackground startInBackground)
        : Application(name, parent, statusIndicators, startInBackground, app::call_stack_size)
        : Application(std::move(name), std::move(parent), statusIndicators, startInBackground, applicationCallStackSize)
    {
        using namespace gui::status_bar;



@@ 58,11 62,11 @@ namespace app
            return actionNotHandled();
        });
        addActionReceiver(manager::actions::Dial, [this](auto &&data) {
            switchWindow(window::name_enterNumber, std::forward<decltype(data)>(data));
            switchWindow(gui::window::name::enter_number, std::forward<decltype(data)>(data));
            return actionHandled();
        });
        addActionReceiver(manager::actions::EmergencyDial, [this](auto &&data) {
            switchWindow(app::window::name_emergencyCall, std::forward<decltype(data)>(data));
            switchWindow(gui::window::name::emergency_call, std::forward<decltype(data)>(data));
            return actionHandled();
        });
        addActionReceiver(manager::actions::NotAnEmergencyNotification, [this](auto &&data) {


@@ 72,49 76,49 @@ namespace app
            return actionHandled();
        });

        addActionReceiver(manager::actions::NoSimNotification, [this](auto &&data) {
        addActionReceiver(manager::actions::NoSimNotification, [this]([[maybe_unused]] auto &&data) {
            showNotificationAndRestartCallFlow(NotificationType::Info, utils::translate("app_call_no_sim"));
            return actionHandled();
        });
        addActionReceiver(manager::actions::NoNetworkConnectionNotification, [this](auto &&data) {
        addActionReceiver(manager::actions::NoNetworkConnectionNotification, [this]([[maybe_unused]] auto &&data) {
            showNotificationAndRestartCallFlow(NotificationType::Info,
                                               utils::translate("app_call_no_network_connection"));
            return actionHandled();
        });
        addActionReceiver(manager::actions::CallRequestGeneralErrorNotification, [this](auto &&data) {
        addActionReceiver(manager::actions::CallRequestGeneralErrorNotification, [this]([[maybe_unused]] auto &&data) {
            showNotificationAndRestartCallFlow(NotificationType::Failure,
                                               utils::translate("app_call_call_request_failed"));
            return actionHandled();
        });
        addActionReceiver(manager::actions::CallRejectedByOfflineNotification, [this](auto &&data) {
        addActionReceiver(manager::actions::CallRejectedByOfflineNotification, [this]([[maybe_unused]] auto &&data) {
            showNotificationAndRestartCallFlow(NotificationType::Info, utils::translate("app_call_offline"));
            return actionHandled();
        });
        addActionReceiver(manager::actions::ActivateCall, [this](auto &&data) {
            switchWindow(window::name_call);
        addActionReceiver(manager::actions::ActivateCall, [this]([[maybe_unused]] auto &&data) {
            switchWindow(gui::window::name::call);
            return actionHandled();
        });
        addActionReceiver(manager::actions::HandleOutgoingCall, [this](auto &&data) {
            switchWindow(window::name_call);
        addActionReceiver(manager::actions::HandleOutgoingCall, [this]([[maybe_unused]] auto &&data) {
            switchWindow(gui::window::name::call);
            return actionHandled();
        });
        addActionReceiver(manager::actions::HandleIncomingCall, [this](auto &&data) {
        addActionReceiver(manager::actions::HandleIncomingCall, [this]([[maybe_unused]] auto &&data) {
            callModel->setState(call::CallState::Incoming);
            auto window = getCurrentWindow();
            if (window->getName() != app::window::name_call) {
            const auto window = getCurrentWindow();
            if (window->getName() != gui::window::name::call) {
                LOG_INFO("Switch to call window");
                switchWindow(app::window::name_call);
                switchWindow(gui::window::name::call);
            }
            return actionHandled();
        });
        addActionReceiver(manager::actions::HandleCallerId, [this](auto &&data) {
            auto callParams = static_cast<app::manager::actions::CallParams *>(data.get());
            const auto callParams = static_cast<app::manager::actions::CallParams *>(data.get());
            callModel->setPhoneNumber(callParams->getNumber());
            callModel->setState(call::CallState::Incoming);
            auto window = getCurrentWindow();
            if (window->getName() != app::window::name_call) {
                LOG_INFO("Switch to call window");
                switchWindow(app::window::name_call);
            const auto window = getCurrentWindow();
            if (window->getName() != gui::window::name::call) {
                LOG_INFO("Switching to call window");
                switchWindow(gui::window::name::call);
            }
            return actionHandled();
        });


@@ 145,7 149,7 @@ namespace app
    // Invoked upon receiving data message
    sys::MessagePointer ApplicationCall::DataReceivedHandler(sys::DataMessage *msgl, sys::ResponseMessage *resp)
    {
        auto retMsg = Application::DataReceivedHandler(msgl);
        const auto retMsg = Application::DataReceivedHandler(msgl);
        // if message was handled by application's template there is no need to process further.
        auto response = dynamic_cast<sys::ResponseMessage *>(retMsg.get());
        assert(response);


@@ 158,49 162,48 @@ namespace app
    // Invoked during initialization
    sys::ReturnCodes ApplicationCall::InitHandler()
    {

        auto ret = Application::InitHandler();
        const auto ret = Application::InitHandler();
        if (ret != sys::ReturnCodes::Success) {
            return ret;
        }

        connect(typeid(cellular::CallDurationNotification), [&](sys::Message *request) {
            auto message = static_cast<cellular::CallDurationNotification *>(request);
            const auto message = static_cast<cellular::CallDurationNotification *>(request);
            callModel->setTime(message->callDuration);
            return sys::MessageNone{};
        });

        connect(typeid(cellular::CallActiveNotification), [&](sys::Message *request) {
        connect(typeid(cellular::CallActiveNotification), [&]([[maybe_unused]] sys::Message *request) {
            callModel->setState(app::call::CallState::Active);
            return sys::MessageNone{};
        });

        connect(typeid(cellular::CallMissedNotification), [&](sys::Message *request) {
        connect(typeid(cellular::CallMissedNotification), [&]([[maybe_unused]] sys::Message *request) {
            callModel->setState(app::call::CallState::Missed);
            app::manager::Controller::switchBack(this);
            return sys::MessageNone{};
        });

        connect(typeid(cellular::CallEndedNotification), [&](sys::Message *request) {
        connect(typeid(cellular::CallEndedNotification), [&]([[maybe_unused]] sys::Message *request) {
            callModel->setState(app::call::CallState::Ended);
            switchWindow(app::window::name_call);
            switchWindow(gui::window::name::call);
            return sys::MessageNone{};
        });

        connect(typeid(cellular::IsCallActive), [&](sys::Message *request) {
        connect(typeid(cellular::IsCallActive), [&]([[maybe_unused]] sys::Message *request) {
            return std::make_shared<cellular::IsCallActiveResponse>(callModel->getState() != call::CallState::None);
        });

        connect(typeid(cellular::CallStartedNotification), [&](sys::Message *request) {
            auto message = static_cast<cellular::CallStartedNotification *>(request);
            const auto message = static_cast<cellular::CallStartedNotification *>(request);
            callModel->setPhoneNumber(message->getNumber());
            callModel->setState(app::call::CallState::Outgoing);
            switchWindow(app::window::name_call);
            switchWindow(gui::window::name::call);
            return sys::MessageNone{};
        });

        connect(typeid(AudioRoutingNotification), [this](sys::Message *request) {
            auto message = static_cast<AudioRoutingNotification *>(request);
            const auto message = static_cast<AudioRoutingNotification *>(request);
            return handleRoutingNotification(message);
        });



@@ 217,18 220,22 @@ namespace app

    void ApplicationCall::createUserInterface()
    {
        windowsFactory.attach(app::window::name_enterNumber, [](ApplicationCommon *app, const std::string &name) {
            return std::make_unique<gui::EnterNumberWindow>(app, static_cast<ApplicationCall *>(app));
        });
        windowsFactory.attach(app::window::name_call, [this](ApplicationCommon *app, const std::string &name) {
            return std::make_unique<gui::CallWindow>(app, *callPresenter);
        });
        windowsFactory.attach(app::window::name_emergencyCall, [](ApplicationCommon *app, const std::string &name) {
            return std::make_unique<gui::EmergencyCallWindow>(app, static_cast<ApplicationCall *>(app));
        });
        windowsFactory.attach(app::window::name_dialogConfirm, [](ApplicationCommon *app, const std::string &name) {
            return std::make_unique<gui::DialogConfirm>(app, name);
        });
        windowsFactory.attach(
            gui::window::name::enter_number, [](ApplicationCommon *app, [[maybe_unused]] const std::string &name) {
                return std::make_unique<gui::EnterNumberWindow>(app, static_cast<ApplicationCall *>(app));
            });
        windowsFactory.attach(gui::window::name::call,
                              [this](ApplicationCommon *app, [[maybe_unused]] const std::string &name) {
                                  return std::make_unique<gui::CallWindow>(app, *callPresenter);
                              });
        windowsFactory.attach(
            gui::window::name::emergency_call, [](ApplicationCommon *app, [[maybe_unused]] const std::string &name) {
                return std::make_unique<gui::EmergencyCallWindow>(app, static_cast<ApplicationCall *>(app));
            });
        windowsFactory.attach(gui::window::name::call_dialog_confirm,
                              [](ApplicationCommon *app, const std::string &name) {
                                  return std::make_unique<gui::DialogConfirm>(app, name);
                              });
        attachPopups({gui::popup::ID::Volume,
                      gui::popup::ID::Tethering,
                      gui::popup::ID::PhoneModes,


@@ 242,14 249,14 @@ namespace app
    {
        auto metaData =
            std::make_unique<gui::DialogMetadataMessage>(gui::DialogMetadata{"", icon, text, "", std::move(action)});
        switchWindow(app::window::name_dialogConfirm, gui::ShowMode::GUI_SHOW_INIT, std::move(metaData));
        switchWindow(gui::window::name::call_dialog_confirm, gui::ShowMode::GUI_SHOW_INIT, std::move(metaData));
        return true;
    }

    auto ApplicationCall::showNotificationAndRestartCallFlow(NotificationType type, const std::string &text) -> bool
    {
        auto buttonAction = [=]() -> bool { return conditionalReturnToPreviousView(); };
        auto icon         = type == NotificationType::Info ? "info_128px_W_G" : "fail_128px_W_G";
        const auto buttonAction = [=]() -> bool { return conditionalReturnToPreviousView(); };
        const auto icon         = type == NotificationType::Info ? "info_128px_W_G" : "fail_128px_W_G";
        callModel->clear();
        return showNotification(buttonAction, icon, text);
    }


@@ 259,7 266,7 @@ namespace app

    void ApplicationCall::handleEmergencyCallEvent(const std::string &number)
    {
        auto state = callModel->getState();
        const auto state = callModel->getState();
        if (state != call::CallState::None) {
            LOG_WARN("Cannot call in %s state", c_str(state));
            return;


@@ 275,7 282,7 @@ namespace app

    void ApplicationCall::handleCallEvent(const std::string &number, ExternalRequest isExternalRequest)
    {
        auto state = callModel->getState();
        const auto state = callModel->getState();
        if (state != call::CallState::None) {
            LOG_WARN("Cannot call in %s state", c_str(state));
            return;


@@ 286,7 293,7 @@ namespace app

    void ApplicationCall::handleAddContactEvent(const std::string &number)
    {
        LOG_INFO("add contact information");
        LOG_INFO("Add contact information");

        auto numberView    = utils::PhoneNumber(number).getView();
        auto searchResults = DBServiceAPI::MatchContactByPhoneNumber(this, numberView);


@@ 310,11 317,10 @@ namespace app

    sys::MessagePointer ApplicationCall::handleRoutingNotification(AudioRoutingNotification *message)
    {
        if (auto window = getCurrentWindow(); window->getName() == app::window::name_call) {
        if (const auto window = getCurrentWindow(); window->getName() == gui::window::name::call) {
            const auto currentRouting = message->profileType;
            callPresenter->processCurrentRouting(currentRouting);
        }
        return sys::MessageNone{};
    }

} // namespace app

M module-apps/application-call/data/CallSwitchData.hpp => module-apps/application-call/data/CallSwitchData.hpp +4 -6
@@ 1,4 1,4 @@
// Copyright (c) 2017-2021, 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


@@ 6,12 6,10 @@
#include "SwitchData.hpp"

#include <PhoneNumber.hpp>

#include <string>

namespace app
{

    class CallSwitchData : public gui::SwitchData
    {
      public:


@@ 28,7 26,7 @@ namespace app
        utils::PhoneNumber::View phoneNumber;

      public:
        CallSwitchData(const utils::PhoneNumber::View &phoneNumber, Type type = Type::UNDEFINED)
        explicit CallSwitchData(const utils::PhoneNumber::View &phoneNumber, Type type = Type::UNDEFINED)
            : SwitchData(descriptionStr), type(type), phoneNumber(phoneNumber){};

        const Type &getType() const


@@ 48,7 46,7 @@ namespace app
      public:
        static constexpr auto descriptionStr = "EnterNumberSwitchData";

        EnterNumberData(const std::string &phoneNumber) : SwitchData(descriptionStr), phoneNumber(phoneNumber)
        explicit EnterNumberData(const std::string &phoneNumber) : SwitchData(descriptionStr), phoneNumber(phoneNumber)
        {}

        const std::string &getPhoneNumber() const


@@ 60,7 58,7 @@ namespace app
    class ExecuteCallData : public CallSwitchData
    {
      public:
        ExecuteCallData(const utils::PhoneNumber::View &phoneNumber)
        explicit ExecuteCallData(const utils::PhoneNumber::View &phoneNumber)
            : CallSwitchData(phoneNumber, app::CallSwitchData::Type::EXECUTE_CALL){};
    };
} /* namespace app */

M module-apps/application-call/include/application-call/ApplicationCall.hpp => module-apps/application-call/include/application-call/ApplicationCall.hpp +3 -13
@@ 5,6 5,7 @@

#include <application-call/model/CallModel.hpp>
#include <application-call/presenter/CallPresenter.hpp>
#include <application-call/windows/WindowNames.hpp>
#include <Timers/TimerHandle.hpp>
#include <service-cellular/CellularMessage.hpp>
#include <service-evtmgr/ServiceEventManagerName.hpp>


@@ 17,18 18,7 @@

namespace app
{
    inline constexpr auto name_call       = "ApplicationCall";
    inline constexpr auto call_stack_size = 8192U;

    namespace window
    {
        inline constexpr auto name_enterNumber       = gui::name::window::main_window;
        inline constexpr auto name_call              = "CallWindow";
        inline constexpr auto name_emergencyCall     = "EmergencyCallWindow";
        inline constexpr auto name_duplicatedContact = "DuplicatedContactWindow";
        inline constexpr auto name_dialogConfirm     = "DialogConfirm";
        inline constexpr auto name_number            = "NumberWindow";
    } // namespace window
    inline constexpr auto name_call = "ApplicationCall";

    class EnterNumberWindowInterface
    {


@@ 56,7 46,7 @@ namespace app
        sys::ReturnCodes InitHandler() override;
        sys::MessagePointer handleAppClose(sys::Message *msgl) override;

        sys::ReturnCodes SwitchPowerModeHandler(const sys::ServicePowerMode mode) override final
        sys::ReturnCodes SwitchPowerModeHandler([[maybe_unused]] const sys::ServicePowerMode mode) override final
        {
            return sys::ReturnCodes::Success;
        }

M module-apps/application-call/windows/CallWindow.cpp => module-apps/application-call/windows/CallWindow.cpp +6 -6
@@ 27,7 27,7 @@ namespace gui
    using namespace app::call;

    CallWindow::CallWindow(app::ApplicationCommon *app, app::call::CallWindowContract::Presenter &presenter)
        : gui::AppWindow{app, app::window::name_call}, presenter{presenter}
        : gui::AppWindow{app, gui::window::name::call}, presenter{presenter}
    {
        presenter.attach(this);
        presenter.attachCallbacks();


@@ 79,7 79,7 @@ namespace gui
        iconsBox->setEdges(RectangleEdge::None);

        microphoneIcon                    = new MicrophoneIcon(iconsBox);
        microphoneIcon->activatedCallback = [=](gui::Item &item) {
        microphoneIcon->activatedCallback = [=]([[maybe_unused]] gui::Item &item) {
            microphoneIcon->setNext();
            LOG_INFO("Microphone %s", static_cast<bool>(microphoneIcon->get()) ? "activated" : "deactivated");



@@ 89,7 89,7 @@ namespace gui
        };

        speakerIcon                    = new SpeakerIcon(iconsBox);
        speakerIcon->activatedCallback = [=](gui::Item &item) {
        speakerIcon->activatedCallback = [=]([[maybe_unused]] gui::Item &item) {
            speakerIcon->setNext();
            LOG_INFO("Speaker %s", static_cast<bool>(speakerIcon->get()) ? "activated" : "deactivated");



@@ 154,11 154,11 @@ namespace gui
        }
    }

    void CallWindow::onBeforeShow(ShowMode mode, SwitchData *data)
    void CallWindow::onBeforeShow([[maybe_unused]] ShowMode mode, SwitchData *data)
    {
        presenter.buildLayout();

        if (auto switchData = dynamic_cast<SMSTemplateSent *>(data); switchData != nullptr) {
        if (const auto switchData = dynamic_cast<SMSTemplateSent *>(data); switchData != nullptr) {
            presenter.hangUpCall();
            presenter.sendSms(switchData->getText());
            return;


@@ 208,7 208,7 @@ namespace gui

    void CallWindow::connectTimerOnExit()
    {
        timerCallback = [this](Item &, sys::Timer &timer) {
        timerCallback = [this]([[maybe_unused]] Item &item, [[maybe_unused]] sys::Timer &timer) {
            LOG_DEBUG("Delayed exit timer callback");
            presenter.handleDelayedViewClose();
            application->popCurrentWindow();

M module-apps/application-call/windows/CallWindow.hpp => module-apps/application-call/windows/CallWindow.hpp +0 -1
@@ 69,5 69,4 @@ namespace gui
        gui::SpeakerIconState getSpeakerIconState() override;
        void setSpeakerIconState(const gui::SpeakerIconState &icon) override;
    };

} /* namespace gui */

M module-apps/application-call/windows/EmergencyCallWindow.cpp => module-apps/application-call/windows/EmergencyCallWindow.cpp +2 -2
@@ 1,4 1,4 @@
// Copyright (c) 2017-2021, 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

#include "CallAppStyle.hpp"


@@ 10,7 10,7 @@ namespace gui
{

    EmergencyCallWindow::EmergencyCallWindow(app::ApplicationCommon *app, app::EnterNumberWindowInterface *interface)
        : NumberWindow(app, interface, app::window::name_emergencyCall)
        : NumberWindow(app, interface, gui::window::name::emergency_call)
    {
        buildInterface();
    }

M module-apps/application-call/windows/EmergencyCallWindow.hpp => module-apps/application-call/windows/EmergencyCallWindow.hpp +1 -3
@@ 1,4 1,4 @@
// Copyright (c) 2017-2021, 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


@@ 7,7 7,6 @@

namespace gui
{

    class EmergencyCallWindow : public NumberWindow
    {
      public:


@@ 19,5 18,4 @@ namespace gui
        void buildInterface() override;
        status_bar::Configuration configureStatusBar(status_bar::Configuration appConfiguration) override;
    };

} /* namespace gui */

M module-apps/application-call/windows/EnterNumberWindow.cpp => module-apps/application-call/windows/EnterNumberWindow.cpp +6 -7
@@ 30,13 30,13 @@ namespace gui
        navBar->setText(nav_bar::Side::Center, utils::translate("common_add"));
        navBar->setText(nav_bar::Side::Right, utils::translate("app_call_clear"));

        auto iconsBox = new HBox(
        const auto iconsBox = new HBox(
            this, style::window::default_left_margin, iconsBox::y, style::window::default_body_width, iconsBox::h);
        iconsBox->setAlignment(Alignment(Alignment::Horizontal::Center, Alignment::Vertical::Top));
        iconsBox->setEdges(RectangleEdge::None);

        newContactIcon                    = new gui::AddContactIcon(iconsBox);
        newContactIcon->activatedCallback = [=](gui::Item &item) { return addNewContact(); };
        newContactIcon->activatedCallback = [=]([[maybe_unused]] gui::Item &item) { return addNewContact(); };
        setFocusItem(newContactIcon);

        iconsBox->resizeItems();


@@ 62,7 62,7 @@ namespace gui
        }

        if (data->getDescription() == app::EnterNumberData::descriptionStr) {
            auto *callData = dynamic_cast<app::EnterNumberData *>(data);
            const auto callData = dynamic_cast<app::EnterNumberData *>(data);
            assert(callData != nullptr);

            initFormatterInput(callData->getPhoneNumber());


@@ 70,10 70,10 @@ namespace gui
            application->refreshWindow(RefreshModes::GUI_REFRESH_FAST);
        }
        else if (data->getDescription() == app::CallSwitchData::descriptionStr) {
            auto *callData = dynamic_cast<app::CallSwitchData *>(data);
            const auto callData = dynamic_cast<app::CallSwitchData *>(data);
            assert(callData != nullptr);

            auto &phoneNumber = callData->getPhoneNumber();
            const auto &phoneNumber = callData->getPhoneNumber();

            initFormatterInput(phoneNumber.getEntered());
            setNumberLabel(phoneNumber.getFormatted());


@@ 84,8 84,7 @@ namespace gui
            }
        }
        else {
            LOG_ERROR("Unhandled switch data");
            abort();
            LOG_ERROR("Unhandled switch data: %s", data->getDescription().c_str());
        }

        return true;

M module-apps/application-call/windows/EnterNumberWindow.hpp => module-apps/application-call/windows/EnterNumberWindow.hpp +2 -3
@@ 1,4 1,4 @@
// Copyright (c) 2017-2021, 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


@@ 15,7 15,7 @@ namespace gui
      public:
        EnterNumberWindow(app::ApplicationCommon *app,
                          app::EnterNumberWindowInterface *interface,
                          std::string windowName = app::window::name_enterNumber);
                          std::string windowName = gui::window::name::enter_number);
        ~EnterNumberWindow() override = default;

        auto handleSwitchData(SwitchData *data) -> bool override;


@@ 26,5 26,4 @@ namespace gui

        auto addNewContact() -> bool;
    };

} /* namespace gui */

M module-apps/application-call/windows/NumberWindow.hpp => module-apps/application-call/windows/NumberWindow.hpp +2 -2
@@ 1,4 1,4 @@
// Copyright (c) 2017-2021, 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


@@ 26,7 26,7 @@ namespace gui

        NumberWindow(app::ApplicationCommon *app,
                     app::EnterNumberWindowInterface *interface,
                     std::string windowName = app::window::name_number);
                     std::string windowName = gui::window::name::number);

        auto onInput(const InputEvent &inputEvent) -> bool override;
        [[nodiscard]] auto getEnteredNumber() const noexcept -> const std::string &;

A module-apps/application-call/windows/WindowNames.hpp => module-apps/application-call/windows/WindowNames.hpp +15 -0
@@ 0,0 1,15 @@
// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#pragma once

#include <AppWindowConstants.hpp>

namespace gui::window::name
{
    inline constexpr auto enter_number        = gui::name::window::main_window;
    inline constexpr auto call                = "CallWindow";
    inline constexpr auto emergency_call      = "EmergencyCallWindow";
    inline constexpr auto call_dialog_confirm = "DialogConfirm";
    inline constexpr auto number              = "NumberWindow";
} // namespace gui::window::name

M module-apps/application-calllog/include/application-calllog/ApplicationCallLog.hpp => module-apps/application-calllog/include/application-calllog/ApplicationCallLog.hpp +4 -5
@@ 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


@@ 9,13 9,12 @@

namespace app
{

    inline constexpr auto CallLogAppStr = "ApplicationCallLog";
    inline constexpr auto name_calllog = "ApplicationCallLog";

    class ApplicationCallLog : public Application
    {
      public:
        ApplicationCallLog(std::string name                    = CallLogAppStr,
        ApplicationCallLog(std::string name                    = name_calllog,
                           std::string parent                  = {},
                           StatusIndicators statusIndicators   = StatusIndicators{},
                           StartInBackground startInBackground = {false});


@@ 25,7 24,7 @@ namespace app
        sys::ReturnCodes InitHandler() override;
        sys::ReturnCodes DeinitHandler() override;

        sys::ReturnCodes SwitchPowerModeHandler(const sys::ServicePowerMode mode) override final
        sys::ReturnCodes SwitchPowerModeHandler([[maybe_unused]] const sys::ServicePowerMode mode) override final
        {
            return sys::ReturnCodes::Success;
        }

M module-apps/application-desktop/windows/DesktopMainWindow.cpp => module-apps/application-desktop/windows/DesktopMainWindow.cpp +9 -10
@@ 16,6 16,12 @@

#include <memory>

namespace
{
    constexpr auto pageFirstNotificationIdx = 0;
    constexpr auto pageLastNotificationIdx  = style::notifications::model::maxNotificationsPerPage - 1;
} // namespace

namespace gui
{
    void DesktopMainWindow::buildInterface()


@@ 88,7 94,7 @@ namespace gui

    void DesktopMainWindow::onBeforeShow(ShowMode mode, SwitchData *data)
    {
        if (auto notificationData = dynamic_cast<app::manager::actions::NotificationsChangedParams *>(data)) {
        if (const auto notificationData = dynamic_cast<app::manager::actions::NotificationsChangedParams *>(data)) {
            notificationsModel->updateData(notificationData);
        }
        else {


@@ 112,15 118,9 @@ namespace gui
        return AppWindow::onInput(inputEvent);
    }

    namespace
    {
        constexpr auto pageFirstNotificationIdx = 0;
        constexpr auto pageLastNotificationIdx  = style::notifications::model::maxNotificationsPerPage - 1;
    } // namespace

    bool DesktopMainWindow::processShortReleaseEvent(const InputEvent &inputEvent)
    {
        auto code = translator.handle(inputEvent.getRawKey(), InputMode({InputMode::phone}).get());
        const auto code = translator.handle(inputEvent.getRawKey(), InputMode({InputMode::phone}).get());
        // if numeric key was pressed record that key and send it to call application
        if (code != 0) {
            const auto &number = std::string(1, static_cast<char>(code));


@@ 200,7 200,7 @@ namespace gui

    app::ApplicationDesktop *DesktopMainWindow::getAppDesktop() const
    {
        auto *app = dynamic_cast<app::ApplicationDesktop *>(application);
        const auto app = dynamic_cast<app::ApplicationDesktop *>(application);
        assert(app);
        return app;
    }


@@ 220,5 220,4 @@ namespace gui
        return app::manager::Controller::sendAction(
            application, app::manager::actions::Dial, std::make_unique<app::EnterNumberData>(number));
    }

} /* namespace gui */

M module-apps/application-messages/windows/SMSTemplatesWindow.cpp => module-apps/application-messages/windows/SMSTemplatesWindow.cpp +2 -2
@@ 90,7 90,7 @@ namespace gui

        auto requestingWindow  = switchData->requestingWindow;
        app->templatesCallback = [=](std::shared_ptr<SMSTemplateRecord> templ) {
            LOG_DEBUG("SMS template id = %" PRIu32 "chosen", templ->ID);
            LOG_DEBUG("SMS template id = %" PRIu32 " chosen", templ->ID);
            auto data = std::make_unique<SMSTextData>(templ->text, SMSTextData::Concatenate::True);
            application->switchWindow(requestingWindow, std::move(data));
            return true;


@@ 105,7 105,7 @@ namespace gui
        assert(app != nullptr);

        app->templatesCallback = [=](std::shared_ptr<SMSTemplateRecord> templ) {
            LOG_DEBUG("SMS template id = %" PRIu32 "sent", templ->ID);
            LOG_DEBUG("SMS template id = %" PRIu32 " sent", templ->ID);
            app::manager::Controller::switchBack(
                app,
                std::make_unique<app::manager::SwitchBackRequest>(application->GetName(),

M module-apps/application-special-input/include/application-special-input/ApplicationSpecialInput.hpp => module-apps/application-special-input/include/application-special-input/ApplicationSpecialInput.hpp +3 -4
@@ 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


@@ 9,8 9,7 @@

namespace app
{

    inline constexpr auto special_input = "ApplicationSpecialInput";
    inline constexpr auto name_special_input = "ApplicationSpecialInput";
    inline constexpr auto char_select   = gui::name::window::main_window;

    // app just to provide input selection on UI


@@ 19,7 18,7 @@ namespace app
      public:
        std::string requester = "";

        ApplicationSpecialInput(std::string name                    = special_input,
        ApplicationSpecialInput(std::string name                    = name_special_input,
                                std::string parent                  = {},
                                StatusIndicators statusIndicators   = StatusIndicators{},
                                StartInBackground startInBackground = {true});

M module-services/service-cellular/CellularServiceAPI.cpp => module-services/service-cellular/CellularServiceAPI.cpp +1 -1
@@ 261,7 261,7 @@ bool CellularServiceAPI::IsCallStateForCallApplicationActive(sys::Service *serv,
{
    // Ask ApplicationCall (if App even exist) about its internal Call State
    auto msg = std::make_shared<cellular::IsCallActive>();
    auto ret = serv->bus.sendUnicastSync(msg, app::name_call, 1000);
    const auto ret = serv->bus.sendUnicastSync(std::move(msg), app::name_call, 1000);
    if (ret.first == sys::ReturnCodes::Success) {
        auto celResponse = std::dynamic_pointer_cast<cellular::IsCallActiveResponse>(ret.second);
        if ((celResponse != nullptr) && (celResponse->retCode == sys::ReturnCodes::Success)) {

M products/PurePhone/PurePhoneMain.cpp => products/PurePhone/PurePhoneMain.cpp +2 -2
@@ 220,7 220,7 @@ int main()
            applications.push_back(app::CreateLauncher<app::ApplicationNotes>(app::name_notes));
#endif
#ifdef ENABLE_APP_CALLLOG
            applications.push_back(app::CreateLauncher<app::ApplicationCallLog>(app::CallLogAppStr));
            applications.push_back(app::CreateLauncher<app::ApplicationCallLog>(app::name_calllog));
#endif
#ifdef ENABLE_APP_PHONEBOOK
            applications.push_back(app::CreateLauncher<app::ApplicationPhonebook>(app::name_phonebook));


@@ 230,7 230,7 @@ int main()
#endif
#ifdef ENABLE_APP_SPECIAL_INPUT
            applications.push_back(
                app::CreateLauncher<app::ApplicationSpecialInput>(app::special_input, app::Closeable::False));
                app::CreateLauncher<app::ApplicationSpecialInput>(app::name_special_input, app::Closeable::False));
#endif
#ifdef ENABLE_APP_ANTENNA
            applications.push_back(app::CreateLauncher<app::ApplicationAntenna>(app::name_antenna));

M products/PurePhone/services/appmgr/RunAppsInBackground.cpp => products/PurePhone/services/appmgr/RunAppsInBackground.cpp +2 -3
@@ 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

#include <appmgr/ApplicationManager.hpp>


@@ 6,10 6,9 @@

namespace app::manager
{

    void ApplicationManager::runAppsInBackground()
    {
        for (const auto &name : std::vector<ApplicationName>{app::special_input}) {
        for (const auto &name : std::vector<ApplicationName>{app::name_special_input}) {
            if (auto app = getApplication(name); app != nullptr) {
                StatusIndicators statusIndicators;
                statusIndicators.phoneMode        = phoneModeObserver->getCurrentPhoneMode();

M pure_changelog.md => pure_changelog.md +1 -0
@@ 27,6 27,7 @@
* Fixed frequency lock during user activity
* Fixed crash on transferring audio file with big metadata
* Fixed possibility of OS crash during update package size check
* Fixed possible crash when entering phone number

## [1.8.0 2023-09-27]