~aleteoryx/muditaos

67e8b1c136e05f44cf4e4b0ac53173d70a5acf66 — Lukasz Mastalerz 2 years ago 64ee37c
[CP-1950] Templates menu navigation loop and pagination on pure gets blocked

Fixed problem where the Templates window gets unresponsive for user input
while changes in templates were done via MC
M module-apps/application-messages/ApplicationMessages.cpp => module-apps/application-messages/ApplicationMessages.cpp +2 -1
@@ 86,7 86,8 @@ namespace app
                userInterfaceDBNotification(msgl,
                                            [&]([[maybe_unused]] sys::Message *, [[maybe_unused]] const std::string &) {
                                                return msg->interface == db::Interface::Name::SMSThread ||
                                                       msg->interface == db::Interface::Name::SMS;
                                                       msg->interface == db::Interface::Name::SMS ||
                                                       msg->interface == db::Interface::Name::SMSTemplate;
                                            });
                return std::make_shared<sys::ResponseMessage>();
            }

M module-apps/application-messages/windows/SMSTemplatesWindow.cpp => module-apps/application-messages/windows/SMSTemplatesWindow.cpp +16 -2
@@ 6,6 6,7 @@
#include "SMSTemplateItem.hpp"
#include "SMSTemplatesWindow.hpp"

#include <service-db/DBNotificationMessage.hpp>
#include <i18n/i18n.hpp>
#include <log/log.hpp>
#include <service-appmgr/Controller.hpp>


@@ 29,8 30,10 @@ namespace gui

    void SMSTemplatesWindow::rebuild()
    {
        destroyInterface();
        buildInterface();
        if (list == nullptr) {
            return;
        }
        list->rebuildList(gui::listview::RebuildType::InPlace);
    }

    void SMSTemplatesWindow::buildInterface()


@@ 128,4 131,15 @@ namespace gui
            application,
            std::make_unique<app::manager::SwitchBackRequest>(nameOfPreviousApplication.value(), nullptr, true));
    }

    bool SMSTemplatesWindow::onDatabaseMessage(sys::Message *msgl)
    {
        const auto msgNotification = dynamic_cast<db::NotificationMessage *>(msgl);
        if (msgNotification != nullptr && msgNotification->interface == db::Interface::Name::SMSTemplate &&
            msgNotification->dataModified()) {
            rebuild();
            return true;
        }
        return false;
    }
} /* namespace gui */

M module-apps/application-messages/windows/SMSTemplatesWindow.hpp => module-apps/application-messages/windows/SMSTemplatesWindow.hpp +1 -0
@@ 31,6 31,7 @@ namespace gui

        void onBeforeShow(ShowMode mode, SwitchData *data) override;
        bool onInput(const InputEvent &inputEvent) override;
        bool onDatabaseMessage(sys::Message *msgl) override;

        void rebuild() override;
        void buildInterface() override;

M module-db/queries/messages/templates/QuerySMSTemplateAdd.cpp => module-db/queries/messages/templates/QuerySMSTemplateAdd.cpp +2 -2
@@ 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 "QuerySMSTemplateAdd.hpp"


@@ 8,7 8,7 @@

using namespace db::query;

SMSTemplateAdd::SMSTemplateAdd(const SMSTemplateRecord &rec) : Query(Query::Type::Read), rec(rec)
SMSTemplateAdd::SMSTemplateAdd(const SMSTemplateRecord &rec) : Query(Query::Type::Create), rec(rec)
{}

SMSTemplateAddResult::SMSTemplateAddResult(bool result, unsigned int id) : result(result), id(id)

M module-db/queries/messages/templates/QuerySMSTemplateRemove.cpp => module-db/queries/messages/templates/QuerySMSTemplateRemove.cpp +2 -2
@@ 1,11 1,11 @@
// 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 "QuerySMSTemplateRemove.hpp"

namespace db::query
{
    SMSTemplateRemove::SMSTemplateRemove(unsigned int id) : Query(Query::Type::Read), id(id)
    SMSTemplateRemove::SMSTemplateRemove(unsigned int id) : Query(Query::Type::Delete), id(id)
    {}

    auto SMSTemplateRemove::debugInfo() const -> std::string

M module-db/queries/messages/templates/QuerySMSTemplateUpdate.cpp => module-db/queries/messages/templates/QuerySMSTemplateUpdate.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 "QuerySMSTemplateUpdate.hpp"


@@ 8,7 8,7 @@

using namespace db::query;

SMSTemplateUpdate::SMSTemplateUpdate(const SMSTemplateRecord &rec) : Query(Query::Type::Read), rec(std::move(rec))
SMSTemplateUpdate::SMSTemplateUpdate(const SMSTemplateRecord &rec) : Query(Query::Type::Update), rec(std::move(rec))
{}

SMSTemplateUpdateResult::SMSTemplateUpdateResult(bool result) : result(result)

M pure_changelog.md => pure_changelog.md +1 -1
@@ 36,7 36,7 @@
* Fixed adding USSD codes to phonebook
* Fixed slider-related crash on phone turn off
* Fixed problem with an unresponsive device after playing specific WAV files.

* Fixed unresponsive Templates window for user input after templates were changed via MC.

## [1.7.0 2023-03-23]
### Changed / Improved