~aleteoryx/muditaos

15a239427e9df4806d875933e3981a88cddfb88c — wojtekrzepecki 4 years ago a9fba04
[EGD-7773] Exit with delay fix

fix
1 files changed, 11 insertions(+), 5 deletions(-)

M module-apps/apps-common/popups/WindowWithTimer.cpp
M module-apps/apps-common/popups/WindowWithTimer.cpp => module-apps/apps-common/popups/WindowWithTimer.cpp +11 -5
@@ 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 "WindowWithTimer.hpp"


@@ 18,10 18,16 @@ namespace gui
        : AppWindow{app, name}, timeout{timeout}
    {
        popupTimer    = app::GuiTimerFactory::createSingleShotTimer(application, this, popup::timerName, timeout);
        timerCallback = [this](Item &, sys::Timer &timer) {
            LOG_DEBUG("Delayed exit timer callback");
            application->returnToPreviousWindow();
            return true;
        timerCallback = [this, name](Item &, sys::Timer &timer) {
            if (application->getCurrentWindow()->getName() == name) {
                LOG_DEBUG("Delayed exit timer callback from: %s", name.c_str());
                application->returnToPreviousWindow();
                return true;
            }
            else {
                LOG_DEBUG("Delayed exit from: %s not succeeded, different window displayed already", name.c_str());
                return false;
            }
        };
    }