M harmony_changelog.md => harmony_changelog.md +1 -0
@@ 4,6 4,7 @@
### Fixed
* Fixed eink crash while refreshing
+* Fixed problem with occasional background playback after song has finished
### Added
* Added brightness fade in functionality
M products/BellHybrid/apps/application-bell-relaxation/presenter/RelaxationRunningProgressPresenter.cpp => products/BellHybrid/apps/application-bell-relaxation/presenter/RelaxationRunningProgressPresenter.cpp +16 -6
@@ 8,6 8,15 @@
#include <common/models/TimeModel.hpp>
#include <gsl/assert>
+namespace
+{
+ bool songLengthEqualsToSelectedPeriod(std::chrono::minutes period, std::chrono::seconds songLength)
+ {
+ auto periodInSeconds = std::chrono::duration_cast<std::chrono::seconds>(period);
+ return periodInSeconds.count() == songLength.count();
+ }
+} // namespace
+
namespace app::relaxation
{
RelaxationRunningProgressPresenter::RelaxationRunningProgressPresenter(settings::Settings *settings,
@@ 31,15 40,16 @@ namespace app::relaxation
{
Expects(timer != nullptr);
AbstractRelaxationPlayer::PlaybackMode mode;
- const auto value = settings->getValue(timerValueDBRecordName, settings::SettingsScope::AppLocal);
- if (utils::is_number(value) && utils::getNumericValue<int>(value) != 0) {
- timer->reset(std::chrono::minutes{utils::getNumericValue<int>(value)});
+ const auto value = settings->getValue(timerValueDBRecordName, settings::SettingsScope::AppLocal);
+ const auto songLength = std::chrono::seconds{song.audioProperties.songLength};
+ if (utils::is_number(value) && utils::getNumericValue<int>(value) != 0 &&
+ !songLengthEqualsToSelectedPeriod(std::chrono::minutes{utils::getNumericValue<int>(value)}, songLength)) {
+ const auto playbackTimeInMinutes = std::chrono::minutes{utils::getNumericValue<int>(value)};
+ timer->reset(playbackTimeInMinutes);
mode = AbstractRelaxationPlayer::PlaybackMode::Looped;
}
else {
- const auto songLength = std::chrono::seconds{song.audioProperties.songLength};
- mode = AbstractRelaxationPlayer::PlaybackMode::SingleShot;
-
+ mode = AbstractRelaxationPlayer::PlaybackMode::SingleShot;
if (songLength > std::chrono::seconds::zero()) {
timer->reset(songLength);
}
M products/BellHybrid/apps/application-bell-relaxation/windows/RelaxationErrorWindow.cpp => products/BellHybrid/apps/application-bell-relaxation/windows/RelaxationErrorWindow.cpp +0 -6
@@ 53,9 53,6 @@ namespace gui
{
timerCallback = [this](Item &, sys::Timer &timer) {
application->switchWindow(gui::name::window::main_window);
- if (errorType == RelaxationErrorType::FileDeleted) {
- application->getWindow(gui::name::window::main_window)->rebuild();
- }
return true;
};
}
@@ 89,9 86,6 @@ namespace gui
{
if (inputEvent.isShortRelease(KeyCode::KEY_ENTER) || inputEvent.isShortRelease(KeyCode::KEY_RF)) {
application->switchWindow(gui::name::window::main_window);
- if (errorType == RelaxationErrorType::FileDeleted) {
- application->getWindow(gui::name::window::main_window)->rebuild();
- }
return true;
}
return true;
M products/BellHybrid/apps/application-bell-relaxation/windows/RelaxationRunningProgressWindow.cpp => products/BellHybrid/apps/application-bell-relaxation/windows/RelaxationRunningProgressWindow.cpp +0 -1
@@ 182,5 182,4 @@ namespace gui
auto switchData = std::make_unique<RelaxationErrorData>(RelaxationErrorType::FileDeleted);
application->switchWindow(gui::window::name::relaxationError, std::move(switchData));
}
-
} // namespace gui