M products/BellHybrid/BellHybridMain.cpp => products/BellHybrid/BellHybridMain.cpp +6 -2
@@ 54,7 54,7 @@ int main()
{
constexpr auto ApplicationName = "BellHybrid";
- std::vector<std::string> fileIndexerAudioPaths = {paths::audio::proprietary(), paths::audio::user()};
+ std::vector<std::string> fileIndexerAudioPaths = {paths::audio::proprietary(), {purefs::dir::getUserMediaPath()}};
#if SYSTEM_VIEW_ENABLED
SEGGER_SYSVIEW_Conf();
@@ 82,7 82,11 @@ int main()
systemServices.emplace_back(sys::CreatorFor<service::ServiceFileIndexer>(std::move(fileIndexerAudioPaths)));
systemServices.emplace_back(sys::CreatorFor<ServiceDB>());
systemServices.emplace_back(sys::CreatorFor<service::Audio>());
- systemServices.emplace_back(sys::CreatorFor<ServiceDesktop>(purefs::dir::getUserMediaPath() / "app/relaxation"));
+ /// Due to the problem with USB MTP not supporting hierarchical folders structure, we cannot use
+ /// 'purefs::dir::getUserMediaPath()'. Instead, we can only pass a specific app folder which is very limiting.
+ /// Hopefully, support for hierarchical folders will be added in the future and such a case won't be relevant
+ /// anymore.
+ systemServices.emplace_back(sys::CreatorFor<ServiceDesktop>(paths::audio::userApp() / paths::audio::relaxation()));
systemServices.emplace_back(sys::CreatorFor<stm::ServiceTime>(std::make_shared<alarms::AlarmOperationsFactory>()));
systemServices.emplace_back(sys::CreatorFor<service::eink::ServiceEink>(service::eink::ExitAction::None));
systemServices.emplace_back(
M products/BellHybrid/alarms/CMakeLists.txt => products/BellHybrid/alarms/CMakeLists.txt +0 -1
@@ 4,7 4,6 @@ add_library(bell::alarms ALIAS alarms)
target_sources(alarms
PRIVATE
BellAlarmHandler.cpp
- src/AlarmSoundPaths.cpp
src/actions/PlayAudioActions.cpp
src/actions/NotifyGUIAction.cpp
src/actions/NotifyGUIBedtimeReminderAction.cpp
D products/BellHybrid/alarms/include/AlarmSoundPaths.hpp => products/BellHybrid/alarms/include/AlarmSoundPaths.hpp +0 -22
@@ 1,22 0,0 @@
-
-// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
-// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
-
-#pragma once
-
-#include <filesystem>
-#include <vector>
-
-namespace alarms::paths
-{
- std::filesystem::path getAlarmDir() noexcept;
- std::filesystem::path getMusicDir() noexcept;
- std::filesystem::path getPreWakeUpChimesDir() noexcept;
- std::filesystem::path getSnoozeChimesDir() noexcept;
- std::filesystem::path getBedtimeReminderChimesDir() noexcept;
- std::filesystem::path getBackgroundSoundsDir() noexcept;
- std::filesystem::path getMeditationSoundsDir() noexcept;
-
- /// Check if system paths exist. In case of error, returns vector of missing entries.
- std::vector<std::filesystem::path> validate() noexcept;
-} // namespace alarms::paths>
\ No newline at end of file
D products/BellHybrid/alarms/src/AlarmSoundPaths.cpp => products/BellHybrid/alarms/src/AlarmSoundPaths.cpp +0 -71
@@ 1,71 0,0 @@
-// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
-// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
-
-#include <AlarmSoundPaths.hpp>
-
-#include <purefs/filesystem_paths.hpp>
-
-namespace alarms::paths
-{
- std::filesystem::path getAlarmDir() noexcept
- {
- return purefs::dir::getAssetsDirPath() / "audio/alarm";
- }
-
- std::filesystem::path getMusicDir() noexcept
- {
- return purefs::dir::getUserDiskPath() / "music";
- }
-
- std::filesystem::path getPreWakeUpChimesDir() noexcept
- {
- return purefs::dir::getAssetsDirPath() / "audio/prewakeup";
- }
-
- std::filesystem::path getSnoozeChimesDir() noexcept
- {
- return purefs::dir::getAssetsDirPath() / "audio/chimes";
- }
-
- std::filesystem::path getBedtimeReminderChimesDir() noexcept
- {
- return purefs::dir::getAssetsDirPath() / "audio/evening_reminder";
- }
-
- std::filesystem::path getBackgroundSoundsDir() noexcept
- {
- return purefs::dir::getAssetsDirPath() / "audio/relaxation";
- }
-
- std::filesystem::path getMeditationSoundsDir() noexcept
- {
- return purefs::dir::getAssetsDirPath() / "audio/meditation";
- }
-
- std::vector<std::filesystem::path> validate() noexcept
- {
- std::vector<std::filesystem::path> ret;
- if (not std::filesystem::exists(getAlarmDir())) {
- ret.push_back(getAlarmDir());
- }
- if (not std::filesystem::exists(getMusicDir())) {
- ret.push_back(getMusicDir());
- }
- if (not std::filesystem::exists(getPreWakeUpChimesDir())) {
- ret.push_back(getPreWakeUpChimesDir());
- }
- if (not std::filesystem::exists(getSnoozeChimesDir())) {
- ret.push_back(getSnoozeChimesDir());
- }
- if (not std::filesystem::exists(getBedtimeReminderChimesDir())) {
- ret.push_back(getBedtimeReminderChimesDir());
- }
- if (not std::filesystem::exists(getBackgroundSoundsDir())) {
- ret.push_back(getBackgroundSoundsDir());
- }
- if (not std::filesystem::exists(getMeditationSoundsDir())) {
- ret.push_back(getMeditationSoundsDir());
- }
- return ret;
- }
-} // namespace alarms::paths>
\ No newline at end of file
M products/BellHybrid/apps/application-bell-relaxation/ApplicationBellRelaxation.cpp => products/BellHybrid/apps/application-bell-relaxation/ApplicationBellRelaxation.cpp +4 -3
@@ 19,7 19,7 @@
#include "windows/RelaxationEndedWindow.hpp"
#include "windows/RelaxationLowBatteryWindow.hpp"
#include "widgets/RelaxationPlayer.hpp"
-#include <AlarmSoundPaths.hpp>
+#include <Paths.hpp>
#include <apps-common/messages/AppMessage.hpp>
#include <apps-common/models/SongsRepository.hpp>
#include <common/models/TimeModel.hpp>
@@ 60,9 60,10 @@ namespace app
void ApplicationBellRelaxation::createUserInterface()
{
- windowsFactory.attach(gui::name::window::main_window, [this](ApplicationCommon *app, const std::string &name) {
+ windowsFactory.attach(gui::name::window::main_window, [](ApplicationCommon *app, const std::string &name) {
auto tagsFetcher = std::make_unique<app::music::ServiceAudioTagsFetcher>(app);
- const auto paths = std::vector<std::string>{alarms::paths::getBackgroundSoundsDir()};
+ const auto paths = std::vector<std::string>{paths::audio::proprietary() / paths::audio::relaxation(),
+ paths::audio::userApp() / paths::audio::relaxation()};
auto soundsRepository = std::make_unique<app::music::SongsRepository>(app, std::move(tagsFetcher), paths);
auto presenter = std::make_unique<relaxation::RelaxationMainWindowPresenter>(std::move(soundsRepository));
return std::make_unique<gui::RelaxationMainWindow>(app, std::move(presenter));
M products/BellHybrid/apps/application-bell-relaxation/CMakeLists.txt => products/BellHybrid/apps/application-bell-relaxation/CMakeLists.txt +1 -0
@@ 64,6 64,7 @@ target_link_libraries(application-bell-relaxation
bell::app-main
bell::audio
bell::alarms
+ bell::paths
Microsoft.GSL::GSL
PUBLIC
M products/BellHybrid/paths/Paths.cpp => products/BellHybrid/paths/Paths.cpp +1 -1
@@ 4,7 4,7 @@
#include "Paths.hpp"
#include <purefs/filesystem_paths.hpp>
-std::filesystem::path paths::audio::user() noexcept
+std::filesystem::path paths::audio::userApp() noexcept
{
return purefs::dir::getUserMediaPath() / "app";
}
M products/BellHybrid/paths/Paths.hpp => products/BellHybrid/paths/Paths.hpp +1 -1
@@ 9,7 9,7 @@ namespace paths
{
namespace audio
{
- std::filesystem::path user() noexcept;
+ std::filesystem::path userApp() noexcept;
std::filesystem::path proprietary() noexcept;
std::filesystem::path alarm() noexcept;
std::filesystem::path preWakeup() noexcept;
M products/PurePhone/PurePhoneMain.cpp => products/PurePhone/PurePhoneMain.cpp +4 -0
@@ 182,6 182,10 @@ int main()
systemServices.emplace_back(sys::CreatorFor<ServiceBluetooth>());
#endif
#ifdef ENABLE_SERVICE_DESKTOP
+ /// Due to the problem with USB MTP not supporting hierarchical folders structure, we cannot use
+ /// 'purefs::dir::getUserMediaPath()'. Instead, we can only pass a specific app folder which is very limiting.
+ /// Hopefully, support for hierarchical folders will be added in the future and such a case won't be relevant
+ /// anymore.
systemServices.emplace_back(sys::CreatorFor<ServiceDesktop>(purefs::dir::getUserMediaPath() / "app/music_player"));
#endif
#ifdef ENABLE_SERVICE_TIME