M harmony_changelog.md => harmony_changelog.md +1 -0
@@ 21,6 21,7 @@
* Fixed the logic in onboarding screens
* Fixed issues with file uploads with low disk space.
* Fixed hard fault handling
+* Fixed meditation countdown timer when a deep press is performed
### Added
M products/BellHybrid/apps/application-bell-meditation-timer/CMakeLists.txt => products/BellHybrid/apps/application-bell-meditation-timer/CMakeLists.txt +1 -0
@@ 49,6 49,7 @@ target_link_libraries(application-bell-meditation-timer
bell::app-common
bell::app-main
bell::paths
+ bell::keymap
service-appmgr
service-time
PUBLIC
M products/BellHybrid/apps/application-bell-meditation-timer/presenter/MeditationCountdownPresenter.cpp => products/BellHybrid/apps/application-bell-meditation-timer/presenter/MeditationCountdownPresenter.cpp +20 -5
@@ 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 "MeditationCommon.hpp"
@@ 36,11 36,26 @@ namespace app::meditation
timer->stop();
}
- void MeditationCountdownPresenter::onCountdownFinished()
+ bool MeditationCountdownPresenter::isFinished()
+ {
+ return finished;
+ }
+
+ void MeditationCountdownPresenter::setReady(bool status)
{
- auto data = std::make_unique<gui::SwitchData>();
- data->ignoreCurrentWindowOnStack = true;
+ ready = status;
+ }
- app->switchWindow(meditation::windows::meditationProgress, std::move(data));
+ bool MeditationCountdownPresenter::isReady()
+ {
+ return ready;
+ }
+
+ void MeditationCountdownPresenter::onCountdownFinished()
+ {
+ finished = true;
+ if (ready) {
+ app->switchWindow(meditation::windows::meditationProgress);
+ }
}
} // namespace app::meditation
M products/BellHybrid/apps/application-bell-meditation-timer/presenter/MeditationCountdownPresenter.hpp => products/BellHybrid/apps/application-bell-meditation-timer/presenter/MeditationCountdownPresenter.hpp +9 -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
@@ 38,6 38,9 @@ namespace app::meditation
virtual void setTimer(std::unique_ptr<app::TimerWithCallbacks> &&timer) = 0;
virtual void start() = 0;
virtual void stop() = 0;
+ virtual bool isFinished() = 0;
+ virtual bool isReady() = 0;
+ virtual void setReady(bool status) = 0;
};
};
@@ 50,12 53,17 @@ namespace app::meditation
std::chrono::seconds duration;
void onCountdownFinished();
+ bool finished{false};
+ bool ready{true};
public:
MeditationCountdownPresenter(app::ApplicationCommon *app, models::StartDelay &startDelay);
void setTimer(std::unique_ptr<app::TimerWithCallbacks> &&_timer) override;
+ bool isFinished() override;
void start() override;
void stop() override;
+ bool isReady() override;
+ void setReady(bool status) override;
};
} // namespace app::meditation
M products/BellHybrid/apps/application-bell-meditation-timer/windows/MeditationCountdownWindow.cpp => products/BellHybrid/apps/application-bell-meditation-timer/windows/MeditationCountdownWindow.cpp +11 -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 <Arc.hpp>
@@ 8,6 8,7 @@
#include "MeditationCountdownWindow.hpp"
#include "MeditationStyle.hpp"
+#include <keymap/KeyMap.hpp>
#include <apps-common/widgets/ProgressTimerWithBarGraphAndCounter.hpp>
namespace
@@ 90,13 91,21 @@ namespace gui
if (mode == ShowMode::GUI_SHOW_INIT) {
presenter->start();
}
+ else if (presenter->isFinished()) {
+ application->switchWindow(app::meditation::windows::meditationProgress);
+ }
+ presenter->setReady(true);
}
bool MeditationCountdownWindow::onInput(const InputEvent &inputEvent)
{
- if (inputEvent.isShortRelease(gui::KeyCode::KEY_RF)) {
+ const auto key = mapKey(inputEvent.getKeyCode());
+ if (key == KeyMap::Back) {
presenter->stop();
}
+ if (key == KeyMap::DeepPressUp || key == KeyMap::DeepPressDown) {
+ presenter->setReady(false);
+ }
return AppWindow::onInput(inputEvent);
}
M products/BellHybrid/apps/application-bell-meditation-timer/windows/MeditationCountdownWindow.hpp => products/BellHybrid/apps/application-bell-meditation-timer/windows/MeditationCountdownWindow.hpp +1 -5
@@ 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
@@ 36,9 36,5 @@ namespace gui
void buildLayout();
void configureTimer();
-
- void endSession();
- void intervalTimeout();
- void playGong();
};
} // namespace gui