~aleteoryx/muditaos

0fbe6e9529e8cc12ed012cc2a4038f31d88b2476 — Tomasz Rybarski 3 years ago 74d09e5
[BH-1395] Bedtime confirmation screen

Confirmation screen displayed also for off state
M products/BellHybrid/apps/application-bell-bedtime/models/BedtimeListItemProvider.cpp => products/BellHybrid/apps/application-bell-bedtime/models/BedtimeListItemProvider.cpp +2 -2
@@ 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 "BedtimeListItemProvider.hpp"


@@ 27,7 27,7 @@ namespace app::bell_bedtime
        auto onOff       = new OnOffListItem(model.get()->getBedtimeOnOff(), utils::translate("app_bellmain_bedtime"));
        onOff->onProceed = [onOff, this]() {
            if (not onOff->isActive()) {
                this->onExit(false);
                this->onExit();
                return true;
            }
            return false;

M products/BellHybrid/apps/application-bell-bedtime/models/BedtimeListItemProvider.hpp => products/BellHybrid/apps/application-bell-bedtime/models/BedtimeListItemProvider.hpp +2 -2
@@ 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

#pragma once


@@ 20,7 20,7 @@ namespace app::bell_bedtime
        [[nodiscard]] auto requestRecordsCount() -> unsigned int override;
        [[nodiscard]] auto getMinimalItemSpaceRequired() const -> unsigned int override;

        std::function<void(bool)> onExit;
        std::function<void()> onExit;

      private:
        void buildListItems();

M products/BellHybrid/apps/application-bell-bedtime/presenter/BellBedtimeWindowPresenter.cpp => products/BellHybrid/apps/application-bell-bedtime/presenter/BellBedtimeWindowPresenter.cpp +2 -2
@@ 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 "BellBedtimeWindowPresenter.hpp"


@@ 9,7 9,7 @@ namespace app::bell_bedtime
    BellBedtimeWindowPresenter::BellBedtimeWindowPresenter(std::shared_ptr<BedtimeListItemProvider> provider)
        : provider{provider}
    {
        provider->onExit = [this](bool showSuccessWindow) { getView()->exit(showSuccessWindow); };
        provider->onExit = [this]() { getView()->exit(); };
    }

    void BellBedtimeWindowPresenter::saveData()

M products/BellHybrid/apps/application-bell-bedtime/presenter/BellBedtimeWindowPresenter.hpp => products/BellHybrid/apps/application-bell-bedtime/presenter/BellBedtimeWindowPresenter.hpp +2 -2
@@ 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

#pragma once


@@ 31,7 31,7 @@ namespace app::bell_bedtime
    {
      public:
        virtual ~View() noexcept                  = default;
        virtual void exit(bool showSuccessWindow) = 0;
        virtual void exit()                       = 0;
    };

    class AbstractBedtimePresenter : public BasePresenter<View>

M products/BellHybrid/apps/application-bell-bedtime/windows/BellBedtimeWindow.cpp => products/BellHybrid/apps/application-bell-bedtime/windows/BellBedtimeWindow.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 "BellBedtimeWindow.hpp"


@@ 54,7 54,7 @@ namespace gui
            return true;
        }
        if (inputEvent.isShortRelease(KeyCode::KEY_ENTER)) {
            exit(true);
            exit();
            return true;
        }
        return AppWindow::onInput(inputEvent);


@@ 66,15 66,10 @@ namespace gui
        buildInterface();
    }

    void BellBedtimeWindow::exit(bool showSuccessWindow)
    void BellBedtimeWindow::exit()
    {
        presenter->saveData();
        if (showSuccessWindow) {
            application->switchWindow(gui::window::bell_finished::defaultName,
                                      BellFinishedWindowData::Factory::create("circle_success_big", "", "", true));
        }
        else {
            application->returnToPreviousWindow();
        }
        application->switchWindow(gui::window::bell_finished::defaultName,
                                  BellFinishedWindowData::Factory::create("circle_success_big", "", "", true));
    }
} /* namespace gui */

M products/BellHybrid/apps/application-bell-bedtime/windows/BellBedtimeWindow.hpp => products/BellHybrid/apps/application-bell-bedtime/windows/BellBedtimeWindow.hpp +2 -2
@@ 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

#pragma once


@@ 22,7 22,7 @@ namespace gui
        void buildInterface() override;
        auto onInput(const InputEvent &inputEvent) -> bool override;
        void rebuild() override;
        void exit(bool showSuccessWindow) override;
        void exit() override;

      private:
        SideListView *listView{};