~aleteoryx/muditaos

04922b954328608b9e1e19c2c86d6c600bb92556 — Bartosz 2 years ago 5098d06
[MOS-921] Fixed unexitable screen while having a missed call during template selection

Created a cloned SMS template window to differenciate it from the
templates used in SMS thred - better than creating a bool flag...

Added switchBack on missed call to application messages
M module-apps/application-messages/ApplicationMessages.cpp => module-apps/application-messages/ApplicationMessages.cpp +13 -14
@@ 13,13 13,8 @@
#include "ThreadWindowOptions.hpp"

#include <Dialog.hpp>
#include <DialogMetadata.hpp>
#include <DialogMetadataMessage.hpp>
#include <i18n/i18n.hpp>
#include <memory>
#include <messages/OptionsWindow.hpp>
#include <MessageType.hpp>
#include <module-db/queries/messages/sms/QuerySMSAdd.hpp>
#include <module-db/queries/messages/sms/QuerySMSRemove.hpp>
#include <module-db/queries/messages/sms/QuerySMSUpdate.hpp>
#include <module-db/queries/messages/threads/QueryThreadGetByID.hpp>


@@ 27,16 22,9 @@
#include <module-db/queries/messages/threads/QueryThreadRemove.hpp>
#include <module-db/queries/phonebook/QueryContactGetByNumberID.hpp>
#include <module-db/queries/notifications/QueryNotificationsDecrement.hpp>
#include <OptionsWindow.hpp>
#include <OptionWindow.hpp>
#include <service-cellular/CellularMessage.hpp>
#include <service-db/DBNotificationMessage.hpp>
#include <service-db/DBServiceAPI.hpp>
#include <service-db/QueryMessage.hpp>

#include <cassert>
#include <ctime>
#include <utility>
#include <service-appmgr/Controller.hpp>

namespace app
{


@@ 53,7 41,7 @@ namespace app
        addActionReceiver(manager::actions::CreateSms,
                          [this](auto &&data) { return handleCreateSmsAction(std::move(data)); });
        addActionReceiver(manager::actions::ShowSmsTemplates, [this](auto &&data) {
            switchWindow(gui::name::window::sms_templates, std::move(data));
            switchWindow(gui::name::window::call_sms_templates, std::move(data));
            return actionHandled();
        });
        addActionReceiver(manager::actions::SmsRejectNoSim, [this](auto &&data) {


@@ 75,6 63,13 @@ namespace app

            return actionHandled();
        });

        connect(typeid(cellular::CallMissedNotification), [&](sys::Message *request) {
            if (getCurrentWindow()->getName() == gui::name::window::call_sms_templates) {
                app::manager::Controller::switchBack(this);
            }
            return sys::MessageNone{};
        });
    }

    // Invoked upon receiving data message


@@ 148,6 143,10 @@ namespace app
        windowsFactory.attach(gui::name::window::sms_templates, [](ApplicationCommon *app, const std::string &name) {
            return std::make_unique<gui::SMSTemplatesWindow>(app);
        });
        windowsFactory.attach(gui::name::window::call_sms_templates,
                              [](ApplicationCommon *app, const std::string &name) {
                                  return std::make_unique<gui::SMSTemplatesWindow>(app);
                              });
        windowsFactory.attach(gui::name::window::search_results, [](ApplicationCommon *app, const std::string &name) {
            return std::make_unique<gui::SearchResults>(app);
        });

M module-apps/application-messages/include/application-messages/Constants.hpp => module-apps/application-messages/include/application-messages/Constants.hpp +2 -1
@@ 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


@@ 18,6 18,7 @@ namespace gui::name::window
    inline constexpr auto thread_options    = "ThreadOptions";
    inline constexpr auto sms_options       = "SMSOptions";
    inline constexpr auto sms_templates     = "SMSTemplates";
    inline constexpr auto call_sms_templates = "CallSMSTemplates";
    inline constexpr auto thread_view       = "ThreadViewWindow";

} // namespace gui::name::window

M module-apps/application-messages/models/SMSTemplateModel.cpp => module-apps/application-messages/models/SMSTemplateModel.cpp +5 -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 "ApplicationMessages.hpp"


@@ 8,6 8,7 @@
#include <ListView.hpp>
#include <module-db/queries/messages/templates/QuerySMSTemplateGetForList.hpp>
#include <service-db/DBServiceAPI.hpp>
#include <AppWindow.hpp>

SMSTemplateModel::SMSTemplateModel(app::ApplicationCommon *app) : DatabaseModel(app), app::AsyncCallbackReceiver{app}
{}


@@ 77,6 78,8 @@ auto SMSTemplateModel::handleQueryResponse(db::QueryResult *queryResult) -> bool
    }

    // refreshWindow(...) does too few in this case
    application->switchWindow(gui::name::window::sms_templates);
    const auto currentWindow = application->getCurrentWindow();
    application->switchWindow(currentWindow->getName());

    return false;
}

M module-apps/application-messages/windows/SMSTemplatesWindow.cpp => module-apps/application-messages/windows/SMSTemplatesWindow.cpp +2 -2
@@ 16,8 16,8 @@

namespace gui
{
    SMSTemplatesWindow::SMSTemplatesWindow(app::ApplicationCommon *app)
        : AppWindow(app, name::window::sms_templates), smsTemplateModel{std::make_shared<SMSTemplateModel>(app)}
    SMSTemplatesWindow::SMSTemplatesWindow(app::ApplicationCommon *app, const std::string &windowName)
        : AppWindow(app, windowName), smsTemplateModel{std::make_shared<SMSTemplateModel>(app)}
    {
        buildInterface();
    }

M module-apps/application-messages/windows/SMSTemplatesWindow.hpp => module-apps/application-messages/windows/SMSTemplatesWindow.hpp +3 -5
@@ 7,14 7,11 @@
#include "SMSTemplateModel.hpp"

#include <AppWindow.hpp>
#include <Constants.hpp>

#include <Icon.hpp>
#include <gui/widgets/text/Label.hpp>
#include <gui/widgets/ListView.hpp>

#include <functional>
#include <string>

namespace gui
{
    class SMSTemplatesWindow : public AppWindow


@@ 30,7 27,8 @@ namespace gui

      public:
        SMSTemplatesWindow() = delete;
        SMSTemplatesWindow(app::ApplicationCommon *app);
        explicit SMSTemplatesWindow(app::ApplicationCommon *app,
                                    const std::string &windowName = name::window::sms_templates);
        virtual ~SMSTemplatesWindow();

        void onBeforeShow(ShowMode mode, SwitchData *data) override;

M products/PurePhone/services/appmgr/ApplicationManager.cpp => products/PurePhone/services/appmgr/ApplicationManager.cpp +1 -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

#include <appmgr/ApplicationManager.hpp>