M harmony_changelog.md => harmony_changelog.md +1 -0
@@ 17,6 17,7 @@
* Fixed problem with displaying end of title when playing song in loop was selected.
* Fixed problem with an unresponsive device after playing specific WAV files.
* Fixed USB charging port detection.
+* Fixed problem with deleting files during Relaxation session.
### Added
M image/system_a/data/lang/Deutsch.json => image/system_a/data/lang/Deutsch.json +1 -0
@@ 52,6 52,7 @@
"app_bell_onboarding_shortcuts_step_turn_off": "Zum Ausstellen des Ger\u00e4ts R\u00fcckseite 10 Sek. dr\u00fccken",
"app_bell_relaxation_error_message": "Nicht unterst\u00fctztes Dateiformat",
"app_bell_relaxation_limit_error_message": "<text>Datenlimit \u00fcberschritten.<br />Es k\u00f6nnte zu Fehlern kommen.</text>",
+ "app_bell_relaxation_file_deleted_message": "<text>Die Datei wurde gelöscht.</text>",
"app_bell_relaxation_loop": "endlos",
"app_bell_relaxation_loop_description": "der Titel wird abgespielt, bis Sie ihn ausschalten",
"app_bell_relaxation_looped": "geschlungen",
M image/system_a/data/lang/English.json => image/system_a/data/lang/English.json +1 -0
@@ 85,6 85,7 @@
"app_bell_onboarding_shortcuts_step_turn_off": "Press back for 10s to turn off the device",
"app_bell_relaxation_error_message": "Unsupported media type",
"app_bell_relaxation_limit_error_message": "<text>File limit exceeded.<br />Not all files may be displayed<br />correctly</text>",
+ "app_bell_relaxation_file_deleted_message": "<text>The file has been deleted.</text>",
"app_bell_relaxation_loop": "loop",
"app_bell_relaxation_loop_description": "the song will play until you turn it off",
"app_bell_relaxation_looped": "looped",
M image/system_a/data/lang/Espanol.json => image/system_a/data/lang/Espanol.json +1 -0
@@ 51,6 51,7 @@
"app_bell_onboarding_shortcuts_step_turn_off": "Pulsa Volver atr\u00e1s 10 s para apagar el dispositivo",
"app_bell_relaxation_error_message": "Formato de archivo no admitido",
"app_bell_relaxation_limit_error_message": "<text>L\u00edmite de archivos alcanzado,<br />pueden producirse errores.</text>",
+ "app_bell_relaxation_file_deleted_message": "<text>Se ha eliminado el archivo.</text>",
"app_bell_relaxation_loop": "bucle",
"app_bell_relaxation_loop_description": "la canci\u00f3n se reproducir\u00e1 hasta que la apagues",
"app_bell_relaxation_looped": "en bucle",
M image/system_a/data/lang/Francais.json => image/system_a/data/lang/Francais.json +1 -0
@@ 53,6 53,7 @@
"app_bell_onboarding_shortcuts_step_turn_off": "Appuyez sur Retour pendant 10 sec pour \u00e9teindre l'appareil",
"app_bell_relaxation_error_message": "<text>Format de fichier non pris en<br></br>charge</text>",
"app_bell_relaxation_limit_error_message": "<text>Limite de fichiers exc\u00e9d\u00e9e.<br />Risque de probl\u00e8mes<br />d'affichage</text>",
+ "app_bell_relaxation_file_deleted_message": "<text>Le fichier a été supprimé.</text>",
"app_bell_relaxation_loop": "en boucle",
"app_bell_relaxation_loop_description": "le morceau sera lu jusqu'\u00e0 ce que vous l'\u00e9teigniez",
"app_bell_relaxation_looped": "en boucle",
M image/system_a/data/lang/Polski.json => image/system_a/data/lang/Polski.json +1 -0
@@ 52,6 52,7 @@
"app_bell_onboarding_shortcuts_step_turn_off": "Przytrzymaj przycisk wstecz przez 10s aby wy\u0142\u0105czy\u0107 urz\u0105dzenie",
"app_bell_relaxation_error_message": "Nieobs\u0142ugiwany format pliku",
"app_bell_relaxation_limit_error_message": "<text>Przekroczono limit plik\u00f3w.<br />Nie wszystkie pliki mog\u0105 by\u0107<br />wy\u015bwietlone poprawnie</text>",
+ "app_bell_relaxation_file_deleted_message": "<text>Plik został usunięty.</text>",
"app_bell_relaxation_loop": "w p\u0119tli",
"app_bell_relaxation_loop_description": "utw\u00f3r b\u0119dzie odtwarzany do momentu wy\u0142\u0105czenia go",
"app_bell_relaxation_looped": "zap\u0119tlony",
M products/BellHybrid/apps/application-bell-relaxation/data/RelaxationErrorData.hpp => products/BellHybrid/apps/application-bell-relaxation/data/RelaxationErrorData.hpp +3 -2
@@ 10,8 10,9 @@ namespace gui
enum class RelaxationErrorType
{
UnsupportedMediaType,
- FilesLimitExceeded
-
+ FilesLimitExceeded,
+ FileDeleted,
+ Unknown
};
class RelaxationErrorData : public SwitchData
M products/BellHybrid/apps/application-bell-relaxation/presenter/RelaxationRunningLoopPresenter.cpp => products/BellHybrid/apps/application-bell-relaxation/presenter/RelaxationRunningLoopPresenter.cpp +3 -1
@@ 57,7 57,9 @@ namespace app::relaxation
return;
}
};
- player.start(song.fileInfo.path, mode, std::move(onStartCallback));
+ auto onErrorCallback = [this]() { getView()->handleDeletedFile(); };
+
+ player.start(song.fileInfo.path, mode, std::move(onStartCallback), std::move(onErrorCallback));
}
void RelaxationRunningLoopPresenter::stop()
M products/BellHybrid/apps/application-bell-relaxation/presenter/RelaxationRunningLoopPresenter.hpp => products/BellHybrid/apps/application-bell-relaxation/presenter/RelaxationRunningLoopPresenter.hpp +1 -0
@@ 41,6 41,7 @@ namespace app::relaxation
virtual void setTime(std::time_t newTime) = 0;
virtual void setTimeFormat(utils::time::Locale::TimeFormat fmt) = 0;
virtual void handleError() = 0;
+ virtual void handleDeletedFile() = 0;
};
class Presenter : public BasePresenter<RelaxationRunningLoopContract::View>
M products/BellHybrid/apps/application-bell-relaxation/presenter/RelaxationRunningProgressPresenter.cpp => products/BellHybrid/apps/application-bell-relaxation/presenter/RelaxationRunningProgressPresenter.cpp +3 -1
@@ 57,7 57,9 @@ namespace app::relaxation
return;
}
};
- player.start(song.fileInfo.path, mode, std::move(onStartCallback));
+
+ auto onErrorCallback = [this]() { getView()->handleDeletedFile(); };
+ player.start(song.fileInfo.path, mode, std::move(onStartCallback), std::move(onErrorCallback));
}
void RelaxationRunningProgressPresenter::stop()
M products/BellHybrid/apps/application-bell-relaxation/presenter/RelaxationRunningProgressPresenter.hpp => products/BellHybrid/apps/application-bell-relaxation/presenter/RelaxationRunningProgressPresenter.hpp +1 -0
@@ 40,6 40,7 @@ namespace app::relaxation
virtual void setTime(std::time_t newTime) = 0;
virtual void setTimeFormat(utils::time::Locale::TimeFormat fmt) = 0;
virtual void handleError() = 0;
+ virtual void handleDeletedFile() = 0;
};
class Presenter : public BasePresenter<RelaxationRunningProgressContract::View>
M products/BellHybrid/apps/application-bell-relaxation/widgets/RelaxationPlayer.cpp => products/BellHybrid/apps/application-bell-relaxation/widgets/RelaxationPlayer.cpp +17 -5
@@ 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 "RelaxationPlayer.hpp"
@@ 14,16 14,28 @@ namespace app::relaxation
{}
void RelaxationPlayer::start(const std::string &filePath,
AbstractRelaxationPlayer::PlaybackMode mode,
- AbstractAudioModel::OnStateChangeCallback &&callback)
+ AbstractAudioModel::OnStateChangeCallback &&callback,
+ AbstractAudioModel::OnPlaybackFinishedCallback &&finishedCallback)
{
recentFilePath = filePath;
playbackMode = mode;
audioModel.play(filePath, AbstractAudioModel::PlaybackType::Multimedia, std::move(callback));
- audioModel.setPlaybackFinishedCb([&]() {
+
+ auto finishedCb = [_callback = finishedCallback, this]() {
+ auto cb = [&](audio::RetCode retCode) {
+ if (retCode != audio::RetCode::Success) {
+ _callback();
+ }
+ };
if (playbackMode == PlaybackMode::Looped) {
- audioModel.play(recentFilePath, AbstractAudioModel::PlaybackType::Multimedia, {});
+ audioModel.play(recentFilePath, AbstractAudioModel::PlaybackType::Multimedia, std::move(cb));
+ }
+ else {
+ _callback();
}
- });
+ };
+
+ audioModel.setPlaybackFinishedCb(std::move(finishedCb));
}
void RelaxationPlayer::stop(AbstractAudioModel::OnStateChangeCallback &&callback)
{
M products/BellHybrid/apps/application-bell-relaxation/widgets/RelaxationPlayer.hpp => products/BellHybrid/apps/application-bell-relaxation/widgets/RelaxationPlayer.hpp +11 -9
@@ 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
@@ 25,15 25,16 @@ namespace app::relaxation
SingleShot
};
- virtual ~AbstractRelaxationPlayer() = default;
+ virtual ~AbstractRelaxationPlayer() = default;
virtual void start(const std::string &filePath,
PlaybackMode mode,
- AbstractAudioModel::OnStateChangeCallback &&callback) = 0;
- virtual void stop(AbstractAudioModel::OnStateChangeCallback &&callback) = 0;
- virtual void pause(AbstractAudioModel::OnStateChangeCallback &&callback) = 0;
- virtual void resume(AbstractAudioModel::OnStateChangeCallback &&callback) = 0;
- virtual PlaybackMode getCurrentMode() const noexcept = 0;
- virtual bool isPaused() = 0;
+ AbstractAudioModel::OnStateChangeCallback &&callback,
+ AbstractAudioModel::OnPlaybackFinishedCallback &&finishedCallback) = 0;
+ virtual void stop(AbstractAudioModel::OnStateChangeCallback &&callback) = 0;
+ virtual void pause(AbstractAudioModel::OnStateChangeCallback &&callback) = 0;
+ virtual void resume(AbstractAudioModel::OnStateChangeCallback &&callback) = 0;
+ virtual PlaybackMode getCurrentMode() const noexcept = 0;
+ virtual bool isPaused() = 0;
};
class RelaxationPlayer : public AbstractRelaxationPlayer
@@ 44,7 45,8 @@ namespace app::relaxation
private:
void start(const std::string &filePath,
PlaybackMode mode,
- AbstractAudioModel::OnStateChangeCallback &&callback) override;
+ AbstractAudioModel::OnStateChangeCallback &&callback,
+ AbstractAudioModel::OnPlaybackFinishedCallback &&finishedCallback) override;
void stop(AbstractAudioModel::OnStateChangeCallback &&callback) override;
void pause(AbstractAudioModel::OnStateChangeCallback &&callback) override;
void resume(AbstractAudioModel::OnStateChangeCallback &&callback) override;
M products/BellHybrid/apps/application-bell-relaxation/windows/RelaxationErrorWindow.cpp => products/BellHybrid/apps/application-bell-relaxation/windows/RelaxationErrorWindow.cpp +17 -3
@@ 2,7 2,6 @@
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#include "RelaxationErrorWindow.hpp"
-#include <data/RelaxationErrorData.hpp>
#include <data/RelaxationStyle.hpp>
#include <ApplicationBellRelaxation.hpp>
@@ 12,6 11,9 @@ namespace
{
constexpr auto unsupportedMediaMessage = "app_bell_relaxation_error_message";
constexpr auto exceededFilesLimitMessage = "app_bell_relaxation_limit_error_message";
+ constexpr auto fileDeletedMessage = "app_bell_relaxation_file_deleted_message";
+ constexpr auto emptyErrorMessage = "";
+
} // namespace
namespace gui
@@ 51,6 53,9 @@ 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;
};
}
@@ 59,16 64,22 @@ namespace gui
{
if (data && typeid(*data) == typeid(RelaxationErrorData)) {
auto *errorData = static_cast<RelaxationErrorData *>(data);
- switch (errorData->getErrorType()) {
+ errorType = errorData->getErrorType();
+ switch (errorType) {
case RelaxationErrorType::UnsupportedMediaType: {
icon->text->setRichText(utils::translate(unsupportedMediaMessage));
break;
}
-
case RelaxationErrorType::FilesLimitExceeded: {
icon->text->setRichText(utils::translate(exceededFilesLimitMessage));
break;
}
+ case RelaxationErrorType::FileDeleted: {
+ icon->text->setRichText(utils::translate(fileDeletedMessage));
+ break;
+ }
+ default:
+ icon->text->setRichText(utils::translate(emptyErrorMessage));
}
}
WindowWithTimer::onBeforeShow(mode, data);
@@ 78,6 89,9 @@ 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/RelaxationErrorWindow.hpp => products/BellHybrid/apps/application-bell-relaxation/windows/RelaxationErrorWindow.hpp +3 -1
@@ 5,6 5,7 @@
#include "presenter/RelaxationErrorPresenter.hpp"
#include <apps-common/popups/WindowWithTimer.hpp>
+#include <data/RelaxationErrorData.hpp>
#include <gui/widgets/Icon.hpp>
#include <memory>
@@ 21,7 22,8 @@ namespace gui
private:
std::unique_ptr<app::relaxation::RelaxationErrorContract::Presenter> presenter;
std::string errorText;
- gui::Icon *icon = nullptr;
+ gui::Icon *icon = nullptr;
+ RelaxationErrorType errorType = RelaxationErrorType::Unknown;
void buildInterface() override;
bool onInput(const gui::InputEvent &inputEvent) override;
M products/BellHybrid/apps/application-bell-relaxation/windows/RelaxationMainWindow.cpp => products/BellHybrid/apps/application-bell-relaxation/windows/RelaxationMainWindow.cpp +5 -0
@@ 64,4 64,9 @@ namespace gui
application->switchWindow(gui::window::name::relaxationError, std::move(switchData));
}
+ void RelaxationMainWindow::rebuild()
+ {
+ presenter->loadAudioRecords();
+ }
+
} // namespace gui
M products/BellHybrid/apps/application-bell-relaxation/windows/RelaxationMainWindow.hpp => products/BellHybrid/apps/application-bell-relaxation/windows/RelaxationMainWindow.hpp +1 -0
@@ 20,6 20,7 @@ namespace gui
void buildInterface() override;
void handleError() override;
+ void rebuild() override;
void setSoundsList(std::vector<db::multimedia_files::MultimediaFilesRecord> soundsTags);
void onActivated(const db::multimedia_files::MultimediaFilesRecord &selectedSound);
};
M products/BellHybrid/apps/application-bell-relaxation/windows/RelaxationRunningLoopWindow.cpp => products/BellHybrid/apps/application-bell-relaxation/windows/RelaxationRunningLoopWindow.cpp +6 -0
@@ 240,4 240,10 @@ namespace gui
auto switchData = std::make_unique<RelaxationErrorData>(RelaxationErrorType::UnsupportedMediaType);
application->switchWindow(gui::window::name::relaxationError, std::move(switchData));
}
+
+ void RelaxationRunningLoopWindow::handleDeletedFile()
+ {
+ auto switchData = std::make_unique<RelaxationErrorData>(RelaxationErrorType::FileDeleted);
+ application->switchWindow(gui::window::name::relaxationError, std::move(switchData));
+ }
} // namespace gui
M products/BellHybrid/apps/application-bell-relaxation/windows/RelaxationRunningLoopWindow.hpp => products/BellHybrid/apps/application-bell-relaxation/windows/RelaxationRunningLoopWindow.hpp +1 -0
@@ 41,6 41,7 @@ namespace gui
void resume() override;
bool updateBatteryStatus() override;
void handleError() override;
+ void handleDeletedFile() override;
void buildLayout();
void configureTimer();
M products/BellHybrid/apps/application-bell-relaxation/windows/RelaxationRunningProgressWindow.cpp => products/BellHybrid/apps/application-bell-relaxation/windows/RelaxationRunningProgressWindow.cpp +5 -0
@@ 178,5 178,10 @@ namespace gui
auto switchData = std::make_unique<RelaxationErrorData>(RelaxationErrorType::UnsupportedMediaType);
application->switchWindow(gui::window::name::relaxationError, std::move(switchData));
}
+ void RelaxationRunningProgressWindow::handleDeletedFile()
+ {
+ auto switchData = std::make_unique<RelaxationErrorData>(RelaxationErrorType::FileDeleted);
+ application->switchWindow(gui::window::name::relaxationError, std::move(switchData));
+ }
} // namespace gui
M products/BellHybrid/apps/application-bell-relaxation/windows/RelaxationRunningProgressWindow.hpp => products/BellHybrid/apps/application-bell-relaxation/windows/RelaxationRunningProgressWindow.hpp +1 -0
@@ 42,6 42,7 @@ namespace gui
void resume() override;
RefreshModes updateTime() override;
void handleError() override;
+ void handleDeletedFile() override;
void buildLayout();
void configureTimer();