~aleteoryx/muditaos

5447774803ddda4df9e2e54ee7778c80a317ca92 — Mateusz Piesta 3 years ago e511492
[BH-1449] Fix crash during startup

* Moved all Bell-specific paths to AlarmSoundPaths.
* Fixed loading default layout logic. Currently, there is no
db update schema which in specific cases can lead to
layout setting field missing. In this case, load default layout and
update missing db field.
* Added support for Aarch64 Linux.
23 files changed, 132 insertions(+), 182 deletions(-)

M host-tools/genlittlefs/CMake/FindBLKID.cmake
M host-tools/littlefs-fuse/CMake/FindFUSE.cmake
M image/user/db/settings_bell_002.sql
M products/BellHybrid/BellHybridMain.cpp
M products/BellHybrid/alarms/include/AlarmSoundPaths.hpp
M products/BellHybrid/alarms/src/AlarmSoundPaths.cpp
M products/BellHybrid/apps/application-bell-background-sounds/ApplicationBellBackgroundSounds.cpp
M products/BellHybrid/apps/application-bell-background-sounds/CMakeLists.txt
D products/BellHybrid/apps/application-bell-background-sounds/models/BGSoundsRepository.cpp
D products/BellHybrid/apps/application-bell-background-sounds/models/BGSoundsRepository.hpp
M products/BellHybrid/apps/application-bell-background-sounds/presenter/BGSoundsMainWindowPresenter.cpp
M products/BellHybrid/apps/application-bell-main/ApplicationBellMain.cpp
M products/BellHybrid/apps/application-bell-main/include/application-bell-main/ApplicationBellMain.hpp
M products/BellHybrid/apps/application-bell-meditation-timer/CMakeLists.txt
M products/BellHybrid/apps/application-bell-meditation-timer/data/MeditationCommon.hpp
M products/BellHybrid/apps/application-bell-meditation-timer/presenter/SettingsPresenter.cpp
M products/BellHybrid/apps/application-bell-meditation-timer/windows/MeditationRunningWindow.cpp
M products/BellHybrid/apps/application-bell-settings/models/LayoutModel.cpp
M products/BellHybrid/apps/application-bell-settings/presenter/TimeUnitsPresenter.cpp
M products/BellHybrid/apps/application-bell-settings/windows/BellSettingsBedtimeToneWindow.hpp
M products/BellHybrid/apps/common/include/common/layouts/HomeScreenLayouts.hpp
M products/BellHybrid/apps/common/include/common/models/LayoutModel.hpp
M products/BellHybrid/apps/common/src/layouts/HomeScreenLayouts.cpp
M host-tools/genlittlefs/CMake/FindBLKID.cmake => host-tools/genlittlefs/CMake/FindBLKID.cmake +1 -1
@@ 25,7 25,7 @@ else (APPLE)
endif (APPLE)
FIND_LIBRARY(BLKID_LIBRARIES
        NAMES ${BLKID_NAMES}
        PATHS /lib64 /lib /usr/lib64 /usr/lib /usr/local/lib64 /usr/local/lib /usr/lib/x86_64-linux-gnu
        PATHS /lib64 /lib /usr/lib64 /usr/lib /usr/local/lib64 /usr/local/lib /usr/lib/x86_64-linux-gnu /usr/lib/aarch64-linux-gnu
        )

include ("FindPackageHandleStandardArgs")

M host-tools/littlefs-fuse/CMake/FindFUSE.cmake => host-tools/littlefs-fuse/CMake/FindFUSE.cmake +1 -1
@@ 24,7 24,7 @@ else (APPLE)
endif (APPLE)
FIND_LIBRARY(FUSE_LIBRARIES
        NAMES ${FUSE_NAMES}
        PATHS /lib64 /lib /usr/lib64 /usr/lib /usr/local/lib64 /usr/local/lib /usr/lib/x86_64-linux-gnu
        PATHS /lib64 /lib /usr/lib64 /usr/lib /usr/local/lib64 /usr/local/lib /usr/lib/x86_64-linux-gnu /usr/lib/aarch64-linux-gnu
        )

include ("FindPackageHandleStandardArgs")

M image/user/db/settings_bell_002.sql => image/user/db/settings_bell_002.sql +1 -1
@@ 45,7 45,7 @@ INSERT OR IGNORE INTO settings_tab (path, value) VALUES
    ('bedtime_time','21:00'),
    ('bedtime_tone','Evening Horizon'),
    ('bedtime_duration','5'),
    ('layout','ClassicWithTemp'),
    ('layout','Classic'),
    ('\ServiceEink\\display_inverted_mode', '0');



M products/BellHybrid/BellHybridMain.cpp => products/BellHybrid/BellHybridMain.cpp +19 -4
@@ 15,9 15,7 @@
#include <application-bell-powernap/ApplicationBellPowerNap.hpp>

// modules
#include <module-db/Databases/EventsDB.hpp>
#include <module-db/Databases/MultimediaFilesDB.hpp>
#include <module-db/Interface/AlarmEventRecord.hpp>
#include <module-db/Interface/MultimediaFilesRecord.hpp>

// services


@@ 43,6 41,7 @@
#include <SystemWatchdog/SystemWatchdog.hpp>
#include <thread.hpp>
#include <time/AlarmOperations.hpp>
#include "alarms/include/AlarmSoundPaths.hpp"

#include <memory>
#include <vector>


@@ 51,11 50,24 @@
#include <SEGGER/SEGGER_SYSVIEW.h>
#endif

namespace
{
    void validate_assets_path()
    {
        if (const auto ret = alarms::paths::validate(); not ret.empty()) {
            for (const auto &e : ret) {
                LOG_FATAL("%s path missing", e.c_str());
            }
            abort();
        }
    }
} // namespace

int main()
{
    constexpr auto ApplicationName = "BellHybrid";

    std::vector<std::string> fileIndexerAudioPaths = {{purefs::dir::getCurrentOSPath() / "assets/audio/bg_sounds"}};
    std::vector<std::string> fileIndexerAudioPaths = {alarms::paths::getBackgroundSoundsDir()};

#if SYSTEM_VIEW_ENABLED
    SEGGER_SYSVIEW_Conf();


@@ 74,7 86,7 @@ int main()
    if (!sys::SystemWatchdog::getInstance().init()) {
        LOG_ERROR("System watchdog failed to initialize");
        // wait for the hardware watchdog (initialized in reset ISR) to reset the system
        while (1)
        while (true)
            ;
    }



@@ 105,6 117,9 @@ int main()
            /// otherwise we would end up with an init race and PhonenumberUtil could
            /// be initiated in a task with stack not big enough to handle it
            i18n::phonenumbers::PhoneNumberUtil::GetInstance();

            validate_assets_path();

            return true;
        },
        [sysmgr]() {

M products/BellHybrid/alarms/include/AlarmSoundPaths.hpp => products/BellHybrid/alarms/include/AlarmSoundPaths.hpp +7 -1
@@ 1,9 1,10 @@
// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// 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
{


@@ 12,4 13,9 @@ namespace alarms::paths
    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

M products/BellHybrid/alarms/src/AlarmSoundPaths.cpp => products/BellHybrid/alarms/src/AlarmSoundPaths.cpp +38 -1
@@ 1,4 1,4 @@
// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// 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"


@@ 31,4 31,41 @@ namespace alarms::paths
    {
        return purefs::dir::getCurrentOSPath() / "assets/audio/evening_reminder";
    }

    std::filesystem::path getBackgroundSoundsDir() noexcept
    {
        return purefs::dir::getCurrentOSPath() / "assets/audio/bg_sounds";
    }

    std::filesystem::path getMeditationSoundsDir() noexcept
    {
        return purefs::dir::getCurrentOSPath() / "assets/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

M products/BellHybrid/apps/application-bell-background-sounds/ApplicationBellBackgroundSounds.cpp => products/BellHybrid/apps/application-bell-background-sounds/ApplicationBellBackgroundSounds.cpp +5 -10
@@ 1,4 1,4 @@
// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#include "ApplicationBellBackgroundSounds.hpp"


@@ 12,6 12,7 @@
#include "windows/BGSoundsTimerSelectWindow.hpp"
#include "windows/BGSoundsVolumeWindow.hpp"
#include "widgets/BGSoundsPlayer.hpp"
#include <AlarmSoundPaths.hpp>
#include <apps-common/messages/AppMessage.hpp>
#include <apps-common/models/SongsRepository.hpp>
#include <common/models/TimeModel.hpp>


@@ 20,12 21,6 @@

#include <log/log.hpp>

namespace
{
    const auto backgroundSoundsFilesPath =
        purefs::createPath(purefs::dir::getCurrentOSPath(), "assets/audio/bg_sounds").string();
}

namespace app
{
    ApplicationBellBackgroundSounds::ApplicationBellBackgroundSounds(std::string name,


@@ 55,9 50,9 @@ namespace app
    void ApplicationBellBackgroundSounds::createUserInterface()
    {
        windowsFactory.attach(gui::name::window::main_window, [this](ApplicationCommon *app, const std::string &name) {
            auto tagsFetcher = std::make_unique<app::music::ServiceAudioTagsFetcher>(app);
            auto soundsRepository =
                std::make_unique<app::music::SongsRepository>(app, std::move(tagsFetcher), backgroundSoundsFilesPath);
            auto tagsFetcher      = std::make_unique<app::music::ServiceAudioTagsFetcher>(app);
            auto soundsRepository = std::make_unique<app::music::SongsRepository>(
                app, std::move(tagsFetcher), alarms::paths::getBackgroundSoundsDir());
            auto presenter = std::make_unique<bgSounds::BGSoundsMainWindowPresenter>(std::move(soundsRepository));
            return std::make_unique<gui::BGSoundsMainWindow>(app, std::move(presenter));
        });

M products/BellHybrid/apps/application-bell-background-sounds/CMakeLists.txt => products/BellHybrid/apps/application-bell-background-sounds/CMakeLists.txt +1 -0
@@ 47,6 47,7 @@ target_link_libraries(application-bell-background-sounds
    PRIVATE
        apps-common
        bell::audio
        bell::alarms

    PUBLIC
        module-gui

D products/BellHybrid/apps/application-bell-background-sounds/models/BGSoundsRepository.cpp => products/BellHybrid/apps/application-bell-background-sounds/models/BGSoundsRepository.cpp +0 -58
@@ 1,58 0,0 @@
// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#include <algorithm>
#include <log/log.hpp>
#include <time/ScopedTime.hpp>
#include <tags_fetcher/TagsFetcher.hpp>
#include <apps-common/models/SongsRepository.hpp>
#include <module-db/queries/multimedia_files/QueryMultimediaFilesGetLimited.hpp>

#include <filesystem>

namespace app::bgSounds
{
    BGSoundsTagsFetcher::BGSoundsTagsFetcher(ApplicationCommon *application) : application(application)
    {}

    std::optional<tags::fetcher::Tags> BGSoundsTagsFetcher::getFileTags(const std::string &filePath) const
    {
        return tags::fetcher::fetchTags(filePath);
    }

    BGSoundsRepository::BGSoundsRepository(ApplicationCommon *application,
                                           std::unique_ptr<AbstractTagsFetcher> tagsFetcher,
                                           std::string musicFolderName)
        : app::AsyncCallbackReceiver{application}, application{application}, tagsFetcher(std::move(tagsFetcher)),
          musicFolderName(std::move(musicFolderName))
    {}

    void BGSoundsRepository::getMusicFilesList(std::uint32_t offset,
                                               std::uint32_t limit,
                                               const OnGetMusicFilesListCallback &callback)
    {
        auto query = std::make_unique<db::multimedia_files::query::GetLimited>(offset, limit);
        auto task  = app::AsyncQuery::createFromQuery(std::move(query), db::Interface::Name::MultimediaFiles);

        task->setCallback([this, callback, offset](auto response) {
            auto result = dynamic_cast<db::multimedia_files::query::GetLimitedResult *>(response);
            musicFilesViewCache.records.clear();

            if (result == nullptr) {
                return false;
            }

            for (auto &record : result->getResult()) {
                musicFilesViewCache.records.push_back(record);
            }
            musicFilesViewCache.recordsOffset = offset;
            musicFilesViewCache.recordsCount  = result->getCount();

            if (callback) {
                callback(musicFilesViewCache.records, musicFilesViewCache.recordsCount);
            }
            return true;
        });
        task->execute(application, this);
    }
} // namespace app::bgSounds

D products/BellHybrid/apps/application-bell-background-sounds/models/BGSoundsRepository.hpp => products/BellHybrid/apps/application-bell-background-sounds/models/BGSoundsRepository.hpp +0 -74
@@ 1,74 0,0 @@
// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#pragma once

#include <apps-common/ApplicationCommon.hpp>
#include <tags_fetcher/TagsFetcher.hpp>
#include <purefs/filesystem_paths.hpp>

#include <memory>
#include <optional>
#include <string>
#include <vector>

#include <cstddef>

namespace app::bgSounds
{
    struct FilesCache
    {
        std::vector<db::multimedia_files::MultimediaFilesRecord> records{};
        std::uint32_t recordsOffset{0};
        std::uint32_t recordsCount{0};
    };

    class AbstractTagsFetcher
    {
      public:
        virtual ~AbstractTagsFetcher() noexcept = default;

        virtual std::optional<tags::fetcher::Tags> getFileTags(const std::string &filePath) const = 0;
    };

    class BGSoundsTagsFetcher : public AbstractTagsFetcher
    {
      public:
        explicit BGSoundsTagsFetcher(ApplicationCommon *application);

        std::optional<tags::fetcher::Tags> getFileTags(const std::string &filePath) const final;

      private:
        ApplicationCommon *application = nullptr;
    };

    class AbstractSoundsRepository
    {
      public:
        virtual ~AbstractSoundsRepository() noexcept = default;

        virtual std::vector<tags::fetcher::Tags> getMusicFilesList() const = 0;
    };

    class BGSoundsRepository : public AbstractSoundsRepository, public app::AsyncCallbackReceiver
    {
        static constexpr auto bgsoundsSubfolderPath = "assets/audio/bg_sounds";

      public:
        using OnGetMusicFilesListCallback =
            std::function<bool(const std::vector<db::multimedia_files::MultimediaFilesRecord> &, unsigned int)>;

        BGSoundsRepository(ApplicationCommon *application,
                           std::unique_ptr<AbstractTagsFetcher> tagsFetcher,
                           std::string musicFolderName = purefs::dir::getCurrentOSPath() / bgsoundsSubfolderPath);

        void getMusicFilesList(std::uint32_t offset, std::uint32_t limit, const OnGetMusicFilesListCallback &callback);

      private:
        ApplicationCommon *application = nullptr;
        std::unique_ptr<AbstractTagsFetcher> tagsFetcher;
        std::string musicFolderName;
        FilesCache musicFilesViewCache;
        std::vector<tags::fetcher::Tags> musicFiles;
    };
} // namespace app::bgSounds

M products/BellHybrid/apps/application-bell-background-sounds/presenter/BGSoundsMainWindowPresenter.cpp => products/BellHybrid/apps/application-bell-background-sounds/presenter/BGSoundsMainWindowPresenter.cpp +1 -3
@@ 1,4 1,4 @@
// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#include "BGSoundsMainWindowPresenter.hpp"


@@ 13,8 13,6 @@ namespace

namespace app::bgSounds
{
    auto bgSoundsPath = purefs::dir::getCurrentOSPath() / "assets" / "audio" / "bell" / "bg_sounds";

    BGSoundsMainWindowPresenter::BGSoundsMainWindowPresenter(
        std::unique_ptr<app::music::AbstractSongsRepository> soundsRepository)
        : soundsRepository{std::move(soundsRepository)}

M products/BellHybrid/apps/application-bell-main/ApplicationBellMain.cpp => products/BellHybrid/apps/application-bell-main/ApplicationBellMain.cpp +18 -7
@@ 89,10 89,20 @@ namespace app
    void ApplicationBellMain::createUserInterface()
    {
        windowsFactory.attach(gui::name::window::main_window, [this](ApplicationCommon *app, const std::string &name) {
            auto layoutModel    = std::make_unique<bell_settings::LayoutModel>(app);
            auto window         = std::make_unique<gui::BellHomeScreenWindow>(app, homeScreenPresenter);
            auto selectedLayout = layoutModel->getValue();
            setHomeScreenLayout(selectedLayout);
            auto layoutModel = std::make_unique<bell_settings::LayoutModel>(app);
            auto window      = std::make_unique<gui::BellHomeScreenWindow>(app, homeScreenPresenter);
            if (const auto selectedLayout = layoutModel->getValue();
                not selectedLayout or not setHomeScreenLayout(*selectedLayout)) {

                const auto defaultLayout = gui::factory::getDefaultLayout();

                /// Update database entry even if such a field does not exist
                layoutModel->setValue(defaultLayout);
                setHomeScreenLayout(defaultLayout);

                LOG_WARN("Invalid layout, loading the default one, %s", defaultLayout.c_str());
            }

            return window;
        });



@@ 160,13 170,14 @@ namespace app
        return ApplicationCommon::handleSwitchWindow(msgl);
    }

    void ApplicationBellMain::setHomeScreenLayout(std::string layoutName)
    bool ApplicationBellMain::setHomeScreenLayout(std::string layoutName)
    {
        auto homeScreenLayoutsList = gui::factory::getAllLayouts();
        if (homeScreenLayoutsList.find(layoutName) == homeScreenLayoutsList.end()) {
            return;
            return false;
        }
        auto layoutGenerator = homeScreenLayoutsList.at(layoutName);
        const auto layoutGenerator = homeScreenLayoutsList.at(layoutName);
        homeScreenPresenter->setLayout(layoutGenerator);
        return true;
    }
} // namespace app

M products/BellHybrid/apps/application-bell-main/include/application-bell-main/ApplicationBellMain.hpp => products/BellHybrid/apps/application-bell-main/include/application-bell-main/ApplicationBellMain.hpp +1 -1
@@ 44,7 44,7 @@ namespace app
      private:
        void onStart() override;
        sys::MessagePointer handleSwitchWindow(sys::Message *msgl) override;
        void setHomeScreenLayout(std::string layoutName);
        bool setHomeScreenLayout(std::string layoutName);

        std::shared_ptr<app::home_screen::HomeScreenPresenter> homeScreenPresenter{};
    };

M products/BellHybrid/apps/application-bell-meditation-timer/CMakeLists.txt => products/BellHybrid/apps/application-bell-meditation-timer/CMakeLists.txt +1 -0
@@ 44,6 44,7 @@ target_link_libraries(application-bell-meditation-timer
        bell::audio
        bell::app-common
        bell::app-main
        bell::alarms
        service-appmgr
        service-time
    PUBLIC

M products/BellHybrid/apps/application-bell-meditation-timer/data/MeditationCommon.hpp => products/BellHybrid/apps/application-bell-meditation-timer/data/MeditationCommon.hpp +12 -2
@@ 1,8 1,13 @@
// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// 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 <AlarmSoundPaths.hpp>

#include <filesystem>
#include <string>

namespace app::meditation
{
    namespace windows


@@ 13,5 18,10 @@ namespace app::meditation
    }; // namespace windows

    constexpr auto meditationDBRecordName = "MeditationTimer";
    inline constexpr auto meditationAudioPath = "assets/audio/meditation/Meditation_Gong.mp3";

    inline std::filesystem::path getMeditationAudioPath()
    {
        return alarms::paths::getMeditationSoundsDir() / "Meditation_Gong.mp3";
    }

} // namespace app::meditation

M products/BellHybrid/apps/application-bell-meditation-timer/presenter/SettingsPresenter.cpp => products/BellHybrid/apps/application-bell-meditation-timer/presenter/SettingsPresenter.cpp +3 -7
@@ 1,4 1,4 @@
// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#include "SettingsPresenter.hpp"


@@ 86,9 86,7 @@ namespace app::meditation
            std::make_shared<BellListItemProvider>(BellListItemProvider::Items{startDelay, chimeInterval, chimeVolume});

        chimeVolume->onEnter = [this]() {
            this->audioModel.play(purefs::dir::getCurrentOSPath() / meditationAudioPath,
                                  AbstractAudioModel::PlaybackType::Meditation,
                                  {});
            this->audioModel.play(getMeditationAudioPath(), AbstractAudioModel::PlaybackType::Meditation, {});
        };

        chimeVolume->onExit = [this]() { stopSound(); };


@@ 96,9 94,7 @@ namespace app::meditation
        chimeVolume->set_on_value_change_cb([this](const auto &val) {
            this->audioModel.setVolume(val, AbstractAudioModel::PlaybackType::Meditation, {});
            if (this->audioModel.hasPlaybackFinished()) {
                this->audioModel.play(purefs::dir::getCurrentOSPath() / meditationAudioPath,
                                      AbstractAudioModel::PlaybackType::Meditation,
                                      {});
                this->audioModel.play(getMeditationAudioPath(), AbstractAudioModel::PlaybackType::Meditation, {});
            }
        });


M products/BellHybrid/apps/application-bell-meditation-timer/windows/MeditationRunningWindow.cpp => products/BellHybrid/apps/application-bell-meditation-timer/windows/MeditationRunningWindow.cpp +3 -3
@@ 1,4 1,4 @@
// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#include "MeditationTimer.hpp"


@@ 185,8 185,8 @@ namespace gui

    void MeditationRunningWindow::playGong()
    {
        auto msg = std::make_shared<service::AudioStartPlaybackRequest>(
            purefs::dir::getCurrentOSPath() / app::meditation::meditationAudioPath, audio::PlaybackType::Meditation);
        auto msg = std::make_shared<service::AudioStartPlaybackRequest>(app::meditation::getMeditationAudioPath(),
                                                                        audio::PlaybackType::Meditation);
        application->bus.sendUnicast(std::move(msg), service::audioServiceName);
    }
} // namespace gui

M products/BellHybrid/apps/application-bell-settings/models/LayoutModel.cpp => products/BellHybrid/apps/application-bell-settings/models/LayoutModel.cpp +7 -2
@@ 14,9 14,14 @@ namespace app::bell_settings
        settings.init(service::ServiceProxy{app->weak_from_this()});
    }

    std::string LayoutModel::getValue() const
    std::optional<std::string> LayoutModel::getValue() const
    {
        return settings.getValue(bell::settings::Layout::layout, settings::SettingsScope::Global);
        if (const auto result = settings.getValue(bell::settings::Layout::layout, settings::SettingsScope::Global);
            not result.empty()) {
            return result;
        }

        return std::nullopt;
    }

    void LayoutModel::setValue(const std::string &value) const

M products/BellHybrid/apps/application-bell-settings/presenter/TimeUnitsPresenter.cpp => products/BellHybrid/apps/application-bell-settings/presenter/TimeUnitsPresenter.cpp +3 -3
@@ 1,4 1,4 @@
// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#include "models/TemperatureUnitModel.hpp"


@@ 48,10 48,10 @@ namespace app::bell_settings
            }
            if (isCurrentLayout12h) {
                std::string fallbackLayout;
                if (currentLayout.rfind("Classic", 0) == 0) {
                if (currentLayout->rfind("Classic", 0) == 0) {
                    fallbackLayout = "Classic";
                }
                else if (currentLayout.rfind("Vertical", 0) == 0) {
                else if (currentLayout->rfind("Vertical", 0) == 0) {
                    fallbackLayout = "VerticalSimple";
                }
                auto layoutChangeRequest = std::make_shared<ChangeHomescreenLayoutMessage>(fallbackLayout);

M products/BellHybrid/apps/application-bell-settings/windows/BellSettingsBedtimeToneWindow.hpp => products/BellHybrid/apps/application-bell-settings/windows/BellSettingsBedtimeToneWindow.hpp +1 -1
@@ 15,7 15,7 @@ namespace gui
                                          public app::bell_settings::BedtimeSettingsWindowContract::View
    {
      public:
        static constexpr auto name = "BellSettingsBedtimeToneWindow";
        static constexpr auto name = "BellSettingsBedtimeTone";
        explicit BellSettingsBedtimeToneWindow(
            app::ApplicationCommon *app, std::unique_ptr<app::bell_settings::SettingsPresenter::Presenter> presenter);


M products/BellHybrid/apps/common/include/common/layouts/HomeScreenLayouts.hpp => products/BellHybrid/apps/common/include/common/layouts/HomeScreenLayouts.hpp +1 -0
@@ 18,5 18,6 @@ namespace gui
        std::map<std::string, LayoutGenerator> getLayoutsFormat12h();

        std::map<std::string, LayoutGenerator> getAllLayouts();
        std::string getDefaultLayout();
    } // namespace factory
};    // namespace gui

M products/BellHybrid/apps/common/include/common/models/LayoutModel.hpp => products/BellHybrid/apps/common/include/common/models/LayoutModel.hpp +3 -2
@@ 6,6 6,7 @@
#include <common/models/SettingsModel.hpp>
#include <service-db/Settings.hpp>
#include <string>
#include <optional>

namespace app
{


@@ 19,7 20,7 @@ namespace app::bell_settings
    {
      public:
        virtual ~AbstractLayoutModel()                        = default;
        virtual std::string getValue() const                  = 0;
        virtual std::optional<std::string> getValue() const   = 0;
        virtual void setValue(const std::string &value) const = 0;
    };



@@ 27,7 28,7 @@ namespace app::bell_settings
    {
      public:
        explicit LayoutModel(ApplicationCommon *app);
        std::string getValue() const override;
        std::optional<std::string> getValue() const override;
        void setValue(const std::string &value) const override;

      private:

M products/BellHybrid/apps/common/src/layouts/HomeScreenLayouts.cpp => products/BellHybrid/apps/common/src/layouts/HomeScreenLayouts.cpp +5 -0
@@ 36,4 36,9 @@ namespace gui::factory
        return getLayoutsFormat12h();
    };

    std::string getDefaultLayout()
    {
        return "Classic";
    }

} // namespace gui::factory