M module-apps/application-call/windows/CallWindow.cpp => module-apps/application-call/windows/CallWindow.cpp +2 -1
@@ 113,7 113,8 @@ namespace gui
sendSmsIcon->activatedCallback = [=](gui::Item &item) {
LOG_INFO("Send message template and reject the call");
constexpr auto preventAutoLock = true;
- auto msg = std::make_unique<SMSSendTemplateRequest>(presenter.getPhoneNumber().getView(), preventAutoLock);
+ auto msg = std::make_unique<SMSSendTemplateRequest>(
+ presenter.getPhoneNumber().getView(), preventAutoLock, application->GetName());
msg->ignoreCurrentWindowOnStack = true;
return app::manager::Controller::sendAction(application,
app::manager::actions::ShowSmsTemplates,
M module-apps/application-messages/data/SMSdata.hpp => module-apps/application-messages/data/SMSdata.hpp +12 -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
@@ 9,6 9,7 @@
#include <ThreadRecord.hpp>
#include <SMSRecord.hpp>
#include <Database/Database.hpp>
+#include <ApplicationCommon.hpp>
#include <memory>
#include <string>
#include <utility>
@@ 71,8 72,10 @@ class SMSSendRequest : public SMSRequest
class SMSSendTemplateRequest : public SMSRequest
{
public:
- SMSSendTemplateRequest(const utils::PhoneNumber::View &phoneNumber, bool preventAutoLock = false)
- : SMSRequest(phoneNumber), preventAutoLock(preventAutoLock)
+ explicit SMSSendTemplateRequest(const utils::PhoneNumber::View &phoneNumber,
+ bool preventAutoLock = false,
+ std::optional<app::ApplicationName> nameOfSenderApp = std::nullopt)
+ : SMSRequest(phoneNumber), preventAutoLock(preventAutoLock), nameOfSenderApp(nameOfSenderApp)
{}
~SMSSendTemplateRequest() override = default;
@@ 81,8 84,14 @@ class SMSSendTemplateRequest : public SMSRequest
return preventAutoLock;
}
+ [[nodiscard]] auto getNameOfSenderApp() const -> std::optional<app::ApplicationName>
+ {
+ return nameOfSenderApp;
+ }
+
private:
bool preventAutoLock;
+ std::optional<app::ApplicationName> nameOfSenderApp;
};
class SMSTemplateSent : public gui::SwitchData
M module-apps/application-messages/windows/SMSTemplatesWindow.cpp => module-apps/application-messages/windows/SMSTemplatesWindow.cpp +12 -1
@@ 40,7 40,6 @@ namespace gui
setTitle(utils::translate("app_messages_templates"));
navBar->setText(nav_bar::Side::Center, utils::translate(style::strings::common::use));
- navBar->setActive(nav_bar::Side::Center, false);
navBar->setText(nav_bar::Side::Right, utils::translate(style::strings::common::back));
namespace style = style::messages::templates::list;
@@ 116,8 115,20 @@ namespace gui
}
if (auto switchData = dynamic_cast<SMSSendTemplateRequest *>(data); switchData != nullptr) {
+ ignoreWindowsOfThisAppOnSwitchBack = data->ignoreCurrentWindowOnStack;
+ appNameToSwitchBack = switchData->getNameOfSenderApp();
smsSendTemplateRequestHandler(switchData);
}
}
+ bool SMSTemplatesWindow::onInput(const InputEvent &inputEvent)
+ {
+ if (!inputEvent.isShortRelease(KeyCode::KEY_RF) || !ignoreWindowsOfThisAppOnSwitchBack ||
+ !appNameToSwitchBack.has_value()) {
+ return AppWindow::onInput(inputEvent);
+ }
+
+ return app::manager::Controller::switchBack(
+ application, std::make_unique<app::manager::SwitchBackRequest>(appNameToSwitchBack.value(), nullptr, true));
+ }
} /* namespace gui */
M module-apps/application-messages/windows/SMSTemplatesWindow.hpp => module-apps/application-messages/windows/SMSTemplatesWindow.hpp +6 -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
#pragma once
@@ 20,8 20,10 @@ namespace gui
class SMSTemplatesWindow : public AppWindow
{
std::shared_ptr<SMSTemplateModel> smsTemplateModel;
- gui::ListView *list = nullptr;
- gui::Icon *emptyListIcon = nullptr;
+ gui::ListView *list = nullptr;
+ gui::Icon *emptyListIcon = nullptr;
+ bool ignoreWindowsOfThisAppOnSwitchBack = false;
+ std::optional<app::ApplicationName> appNameToSwitchBack = std::nullopt;
void smsSendTemplateRequestHandler(const SMSSendTemplateRequest *const switchData);
void smsTemplateRequestHandler(const SMSTemplateRequest *const switchData);
@@ 32,6 34,7 @@ namespace gui
virtual ~SMSTemplatesWindow();
void onBeforeShow(ShowMode mode, SwitchData *data) override;
+ bool onInput(const InputEvent &inputEvent) override;
void rebuild() override;
void buildInterface() override;
M pure_changelog.md => pure_changelog.md +1 -0
@@ 90,6 90,7 @@
* Fixed missing "No calls yet" text in call log
* Fixed phonebook is not handling database notification about contacts action done by Center
* Fixed contact deleted via Center cannot be edited by Phonebook app and saved again
+* Fixed returning to call screen from message template
## [1.5.0 2022-12-20]