From 310befd13727aaf64ab4933c35d07b0c0bcfda21 Mon Sep 17 00:00:00 2001 From: Lukasz Mastalerz Date: Fri, 22 Sep 2023 10:07:58 +0200 Subject: [PATCH] [BH-1769] Incorrect message after setting the alarm with deep press Fix incorrect message after new alarm setting in some scenarios --- harmony_changelog.md | 1 + .../ApplicationBellAlarm.cpp | 15 +++++++++++++-- .../apps/application-bell-alarm/CMakeLists.txt | 1 + .../presenter/BellAlarmSetPresenter.cpp | 4 +--- 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/harmony_changelog.md b/harmony_changelog.md index 4d1998236753c7211b424accf0fd97c9f800eecd..1a83396b3e07a6337c42925948c74ea14ce206e3 100644 --- a/harmony_changelog.md +++ b/harmony_changelog.md @@ -8,6 +8,7 @@ * Fixed "turn off" window display time * Fixed uneven screen refresh when turning on the device * Fixed not disappearing snooze icon when an alarm is deactivated +* Fixed incorrect message after new alarm setting in some scenarios ### Added * Files not fully transferred via Center will be now removed when USB cable is unplugged diff --git a/products/BellHybrid/apps/application-bell-alarm/ApplicationBellAlarm.cpp b/products/BellHybrid/apps/application-bell-alarm/ApplicationBellAlarm.cpp index 8a592180424019b5829e38770dc07a969e51680e..c9114921ec78947d8b9c8e0acb62c6bce26a7284 100644 --- a/products/BellHybrid/apps/application-bell-alarm/ApplicationBellAlarm.cpp +++ b/products/BellHybrid/apps/application-bell-alarm/ApplicationBellAlarm.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 "ApplicationBellAlarm.hpp" @@ -8,6 +8,7 @@ #include "windows/BellAlarmSetWindow.hpp" #include +#include #include namespace app @@ -18,7 +19,17 @@ namespace app StartInBackground startInBackground, uint32_t stackDepth) : Application(std::move(name), std::move(parent), statusIndicators, startInBackground, stackDepth) - {} + { + bus.channels.push_back(sys::BusChannel::AlarmNotifications); + connect(typeid(AlarmDeactivated), [this](sys::Message *request) -> sys::MessagePointer { + alarmModel->activate(false); + return sys::msgHandled(); + }); + connect(typeid(AlarmActivated), [this](sys::Message *request) -> sys::MessagePointer { + alarmModel->activate(true); + return sys::msgHandled(); + }); + } ApplicationBellAlarm::~ApplicationBellAlarm() = default; sys::ReturnCodes ApplicationBellAlarm::InitHandler() diff --git a/products/BellHybrid/apps/application-bell-alarm/CMakeLists.txt b/products/BellHybrid/apps/application-bell-alarm/CMakeLists.txt index a4404e6c13feb44f11ee781d173084ec047f6344..70a07f791c8ca36810447c4d27e6eb8df85d5ee0 100644 --- a/products/BellHybrid/apps/application-bell-alarm/CMakeLists.txt +++ b/products/BellHybrid/apps/application-bell-alarm/CMakeLists.txt @@ -29,6 +29,7 @@ target_include_directories(application-bell-alarm target_link_libraries(application-bell-alarm PRIVATE app + bell::appmgr bell::app-main bell::app-common module-gui diff --git a/products/BellHybrid/apps/application-bell-alarm/presenter/BellAlarmSetPresenter.cpp b/products/BellHybrid/apps/application-bell-alarm/presenter/BellAlarmSetPresenter.cpp index 51a080c939e75b08d190d84bbbf7daad899f0edf..dbf570e935c38199f36a96380c816ca726131a35 100644 --- a/products/BellHybrid/apps/application-bell-alarm/presenter/BellAlarmSetPresenter.cpp +++ b/products/BellHybrid/apps/application-bell-alarm/presenter/BellAlarmSetPresenter.cpp @@ -1,10 +1,8 @@ -// 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 "BellAlarmSetPresenter.hpp" #include "application-bell-main/ApplicationBellMain.hpp" - -#include #include namespace app::bell_alarm