~aleteoryx/muditaos

4b8735610b5e5f4116b906c9d9583b9eaee3d1a6 — Marcin Zieliński 3 years ago b7308b2
[MOS-357] Fixed regression described in MOS-916

Ditto
M module-apps/application-phonebook/windows/PhonebookNewContact.cpp => module-apps/application-phonebook/windows/PhonebookNewContact.cpp +11 -0
@@ 9,6 9,7 @@
#include <Dialog.hpp>
#include <service-db/DBServiceAPI.hpp>
#include <messages/DialogMetadataMessage.hpp>
#include <service-appmgr/Controller.hpp>

namespace gui
{


@@ 119,6 120,16 @@ namespace gui

    auto PhonebookNewContact::onInput(const InputEvent &inputEvent) -> bool
    {
        auto backToCallLogIfCameFromThere = [this]() {
            // MOS-357: conditionally (@see ApplicationManagerCommon::handleSwitchBack) return to call log
            return app::manager::Controller::switchBack(
                application, std::make_unique<app::manager::SwitchBackRequest>("ApplicationCallLog", nullptr, true));
        };

        if (inputEvent.isShortRelease(gui::KeyCode::KEY_RF)) {
            return backToCallLogIfCameFromThere();
        }

        auto ret = AppWindow::onInput(inputEvent);

        setSaveButtonVisible(!newContactModel->emptyData());

M module-services/service-appmgr/include/service-appmgr/messages/SwitchBackRequest.hpp => module-services/service-appmgr/include/service-appmgr/messages/SwitchBackRequest.hpp +6 -4
@@ 11,12 11,14 @@ namespace app::manager
{
    class SwitchBackRequest : public BaseMessage
    {
        std::unique_ptr<gui::SwitchData> data;

      public:
        SwitchBackRequest(const ApplicationName &name, std::unique_ptr<gui::SwitchData> data = nullptr);
        SwitchBackRequest(const ApplicationName &name,
                          std::unique_ptr<gui::SwitchData> data              = nullptr,
                          bool dontSwitchBackWhenRequestedAppNameDoesntMatch = false);

        [[nodiscard]] auto getData() noexcept -> std::unique_ptr<gui::SwitchData> &;

      private:
        std::unique_ptr<gui::SwitchData> data;
        bool dontSwitchBackWhenRequestedAppNameDoesntMatch;
    };
} // namespace app::manager

M module-services/service-appmgr/messages/SwitchBackRequest.cpp => module-services/service-appmgr/messages/SwitchBackRequest.cpp +5 -2
@@ 5,8 5,11 @@

namespace app::manager
{
    SwitchBackRequest::SwitchBackRequest(const ApplicationName &name, std::unique_ptr<gui::SwitchData> data)
        : BaseMessage(MessageType::APMSwitchPrevApp, name), data{std::move(data)}
    SwitchBackRequest::SwitchBackRequest(const ApplicationName &name,
                                         std::unique_ptr<gui::SwitchData> data,
                                         bool dontSwitchBackWhenRequestedAppNameDoesntMatch)
        : BaseMessage(MessageType::APMSwitchPrevApp, name), data{std::move(data)},
          dontSwitchBackWhenRequestedAppNameDoesntMatch{dontSwitchBackWhenRequestedAppNameDoesntMatch}
    {}

    [[nodiscard]] auto SwitchBackRequest::getData() noexcept -> std::unique_ptr<gui::SwitchData> &

M module-services/service-appmgr/model/ApplicationManagerCommon.cpp => module-services/service-appmgr/model/ApplicationManagerCommon.cpp +6 -0
@@ 590,6 590,12 @@ namespace app::manager
            return false;
        }

        if (msg->dontSwitchBackWhenRequestedAppNameDoesntMatch && previousApp->name() != msg->getSenderName()) {
            LOG_INFO("Requested to switch back only if to [%s] - discarding as doesn't match",
                     previousApp->name().c_str());
            return false;
        }

        auto currentlyFocusedApp = getFocusedApplication();
        if (currentlyFocusedApp == nullptr) {
            LOG_INFO("No focused application at the moment. Starting previous application...");

M pure_changelog.md => pure_changelog.md +1 -0
@@ 85,6 85,7 @@
* Fixed missing translation for words "show" and "replace"
* Fixed music playback disablement after currently played audio file gets deleted
* Fixed incorrectly displayed Swedish translations in Onboarding
* Fixed going back to wrong window after confirming or cancelling creation of new contact from call log

## [1.5.0 2022-12-20]