From 0fbe6e9529e8cc12ed012cc2a4038f31d88b2476 Mon Sep 17 00:00:00 2001 From: Tomasz Rybarski Date: Mon, 14 Feb 2022 14:39:59 +0100 Subject: [PATCH] [BH-1395] Bedtime confirmation screen Confirmation screen displayed also for off state --- .../models/BedtimeListItemProvider.cpp | 4 ++-- .../models/BedtimeListItemProvider.hpp | 4 ++-- .../presenter/BellBedtimeWindowPresenter.cpp | 4 ++-- .../presenter/BellBedtimeWindowPresenter.hpp | 4 ++-- .../windows/BellBedtimeWindow.cpp | 15 +++++---------- .../windows/BellBedtimeWindow.hpp | 4 ++-- 6 files changed, 15 insertions(+), 20 deletions(-) diff --git a/products/BellHybrid/apps/application-bell-bedtime/models/BedtimeListItemProvider.cpp b/products/BellHybrid/apps/application-bell-bedtime/models/BedtimeListItemProvider.cpp index 9d5797b8624058cf57c5824ab665bef9d7b316d9..24053d65a73ab723e3dc40442103bdcc879f8450 100644 --- a/products/BellHybrid/apps/application-bell-bedtime/models/BedtimeListItemProvider.cpp +++ b/products/BellHybrid/apps/application-bell-bedtime/models/BedtimeListItemProvider.cpp @@ -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; diff --git a/products/BellHybrid/apps/application-bell-bedtime/models/BedtimeListItemProvider.hpp b/products/BellHybrid/apps/application-bell-bedtime/models/BedtimeListItemProvider.hpp index 35c04e3dfec3bbedbdc049a9383dde0dbb70627c..edb37dc036b6cde3944284a8f52de75551d93c7a 100644 --- a/products/BellHybrid/apps/application-bell-bedtime/models/BedtimeListItemProvider.hpp +++ b/products/BellHybrid/apps/application-bell-bedtime/models/BedtimeListItemProvider.hpp @@ -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 onExit; + std::function onExit; private: void buildListItems(); diff --git a/products/BellHybrid/apps/application-bell-bedtime/presenter/BellBedtimeWindowPresenter.cpp b/products/BellHybrid/apps/application-bell-bedtime/presenter/BellBedtimeWindowPresenter.cpp index 7fdacfb965c0f790bde6cf7499916aefc5247b7a..0bade2378db21731174984843d1893317f8ffddd 100644 --- a/products/BellHybrid/apps/application-bell-bedtime/presenter/BellBedtimeWindowPresenter.cpp +++ b/products/BellHybrid/apps/application-bell-bedtime/presenter/BellBedtimeWindowPresenter.cpp @@ -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 provider) : provider{provider} { - provider->onExit = [this](bool showSuccessWindow) { getView()->exit(showSuccessWindow); }; + provider->onExit = [this]() { getView()->exit(); }; } void BellBedtimeWindowPresenter::saveData() diff --git a/products/BellHybrid/apps/application-bell-bedtime/presenter/BellBedtimeWindowPresenter.hpp b/products/BellHybrid/apps/application-bell-bedtime/presenter/BellBedtimeWindowPresenter.hpp index 8f5be981ae3d0e0d15b0b36479f602a8f851e3aa..caaa1ebf5cc0ee81d49e0a9dbc6e3c4dfdba909f 100644 --- a/products/BellHybrid/apps/application-bell-bedtime/presenter/BellBedtimeWindowPresenter.hpp +++ b/products/BellHybrid/apps/application-bell-bedtime/presenter/BellBedtimeWindowPresenter.hpp @@ -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 diff --git a/products/BellHybrid/apps/application-bell-bedtime/windows/BellBedtimeWindow.cpp b/products/BellHybrid/apps/application-bell-bedtime/windows/BellBedtimeWindow.cpp index 768ca56cb6c15ba67144fa43758c1d6e4a96d4f7..e23203767600efbe2c4ebe8056c80c3f173c7da9 100644 --- a/products/BellHybrid/apps/application-bell-bedtime/windows/BellBedtimeWindow.cpp +++ b/products/BellHybrid/apps/application-bell-bedtime/windows/BellBedtimeWindow.cpp @@ -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 */ diff --git a/products/BellHybrid/apps/application-bell-bedtime/windows/BellBedtimeWindow.hpp b/products/BellHybrid/apps/application-bell-bedtime/windows/BellBedtimeWindow.hpp index 7a1f6b3983b1cb5dbe4ddbbc5617b79f16605fd2..b38c1019728b527d5f8395b1f98f90c9d39e9835 100644 --- a/products/BellHybrid/apps/application-bell-bedtime/windows/BellBedtimeWindow.hpp +++ b/products/BellHybrid/apps/application-bell-bedtime/windows/BellBedtimeWindow.hpp @@ -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{};