From 04922b954328608b9e1e19c2c86d6c600bb92556 Mon Sep 17 00:00:00 2001 From: Bartosz Date: Wed, 1 Mar 2023 16:25:45 +0100 Subject: [PATCH] [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 --- .../ApplicationMessages.cpp | 27 +++++++++---------- .../application-messages/Constants.hpp | 3 ++- .../models/SMSTemplateModel.cpp | 7 +++-- .../windows/SMSTemplatesWindow.cpp | 4 +-- .../windows/SMSTemplatesWindow.hpp | 8 +++--- .../services/appmgr/ApplicationManager.cpp | 2 +- 6 files changed, 26 insertions(+), 25 deletions(-) diff --git a/module-apps/application-messages/ApplicationMessages.cpp b/module-apps/application-messages/ApplicationMessages.cpp index c4330adc2c5f2388f7f75ca4a86c6a177a5db89e..3404dc8a75d1ab54c59757196d53fc71723851b3 100644 --- a/module-apps/application-messages/ApplicationMessages.cpp +++ b/module-apps/application-messages/ApplicationMessages.cpp @@ -13,13 +13,8 @@ #include "ThreadWindowOptions.hpp" #include -#include #include -#include -#include #include -#include -#include #include #include #include @@ -27,16 +22,9 @@ #include #include #include -#include -#include #include #include -#include -#include - -#include -#include -#include +#include 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(app); }); + windowsFactory.attach(gui::name::window::call_sms_templates, + [](ApplicationCommon *app, const std::string &name) { + return std::make_unique(app); + }); windowsFactory.attach(gui::name::window::search_results, [](ApplicationCommon *app, const std::string &name) { return std::make_unique(app); }); diff --git a/module-apps/application-messages/include/application-messages/Constants.hpp b/module-apps/application-messages/include/application-messages/Constants.hpp index 14190179f8bcde30d125cab85108f03c50d91706..035476d5f785b77a2dc861b5551198280ab5a539 100644 --- a/module-apps/application-messages/include/application-messages/Constants.hpp +++ b/module-apps/application-messages/include/application-messages/Constants.hpp @@ -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 diff --git a/module-apps/application-messages/models/SMSTemplateModel.cpp b/module-apps/application-messages/models/SMSTemplateModel.cpp index 88d75dc12cf76b6cb30765b1e333c1c5e779860f..4ad7926535beeb883c2c3fdae93c985c5fe3d5d0 100644 --- a/module-apps/application-messages/models/SMSTemplateModel.cpp +++ b/module-apps/application-messages/models/SMSTemplateModel.cpp @@ -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 #include #include +#include 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; } diff --git a/module-apps/application-messages/windows/SMSTemplatesWindow.cpp b/module-apps/application-messages/windows/SMSTemplatesWindow.cpp index b819cc1bd8f88bfa4f1862a0cee5a851c551c62a..fbcedd86d113d98af1dcca6a919dcda5f35ef159 100644 --- a/module-apps/application-messages/windows/SMSTemplatesWindow.cpp +++ b/module-apps/application-messages/windows/SMSTemplatesWindow.cpp @@ -16,8 +16,8 @@ namespace gui { - SMSTemplatesWindow::SMSTemplatesWindow(app::ApplicationCommon *app) - : AppWindow(app, name::window::sms_templates), smsTemplateModel{std::make_shared(app)} + SMSTemplatesWindow::SMSTemplatesWindow(app::ApplicationCommon *app, const std::string &windowName) + : AppWindow(app, windowName), smsTemplateModel{std::make_shared(app)} { buildInterface(); } diff --git a/module-apps/application-messages/windows/SMSTemplatesWindow.hpp b/module-apps/application-messages/windows/SMSTemplatesWindow.hpp index c9f3bbede541ac78faa40cce658613854df8be09..a072398c136ac64db4c505e68579368adf8cabdf 100644 --- a/module-apps/application-messages/windows/SMSTemplatesWindow.hpp +++ b/module-apps/application-messages/windows/SMSTemplatesWindow.hpp @@ -7,14 +7,11 @@ #include "SMSTemplateModel.hpp" #include +#include #include -#include #include -#include -#include - 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; diff --git a/products/PurePhone/services/appmgr/ApplicationManager.cpp b/products/PurePhone/services/appmgr/ApplicationManager.cpp index 37244d99eaa500f7ed8cf0dbff25edb19983b441..2faa0e442987768fa3a1b392a9922b1e773d3e78 100644 --- a/products/PurePhone/services/appmgr/ApplicationManager.cpp +++ b/products/PurePhone/services/appmgr/ApplicationManager.cpp @@ -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