From 85cf420b8d68c5b3da68cbcda5f7fe93bc38bcca Mon Sep 17 00:00:00 2001 From: Przemyslaw Brudny Date: Mon, 10 Jan 2022 21:34:49 +0100 Subject: [PATCH] [EGD-8080] Added 4 hour deep refresh on locked screen Added 4 hour deep refresh on locked screen. --- module-apps/apps-common/ApplicationCommon.cpp | 4 ++-- .../popups/lock-popups/PhoneLockedWindow.cpp | 13 +++++++++++++ .../popups/lock-popups/PhoneLockedWindow.hpp | 5 +++++ 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/module-apps/apps-common/ApplicationCommon.cpp b/module-apps/apps-common/ApplicationCommon.cpp index 451e8f50fb6d12599c82401980b723fa4dea6b62..a40e87d2d3c6f217558de2c2529e856fd857e49b 100644 --- a/module-apps/apps-common/ApplicationCommon.cpp +++ b/module-apps/apps-common/ApplicationCommon.cpp @@ -927,8 +927,8 @@ namespace app bool ApplicationCommon::isCurrentWindow(const std::string &windowName) const noexcept { - if (const auto &window = windowsStack().get(windowName); window != nullptr) { - return window->getName() == windowName; + if (const auto &window = windowsStack().get(topWindow); window != std::nullopt) { + return window == windowName; } LOG_ERROR("no window: %s", windowName.c_str()); return false; diff --git a/module-apps/apps-common/popups/lock-popups/PhoneLockedWindow.cpp b/module-apps/apps-common/popups/lock-popups/PhoneLockedWindow.cpp index 8a8e9981b0b6c2f6b0cb21c563208e4210881037..5a25ba0ada9f8dc8947146b82a7c96355a95ffa2 100644 --- a/module-apps/apps-common/popups/lock-popups/PhoneLockedWindow.cpp +++ b/module-apps/apps-common/popups/lock-popups/PhoneLockedWindow.cpp @@ -3,6 +3,7 @@ #include "PhoneLockedWindow.hpp" #include "PhoneLockedInfoData.hpp" +#include "Timers/TimerFactory.hpp" #include #include @@ -24,6 +25,12 @@ namespace gui buildInterface(); preBuildDrawListHook = [this](std::list &cmd) { updateTime(); }; + + screenRefreshTimer = + sys::TimerFactory::createPeriodicTimer(application, refreshTimerName, refreshTimeout, [this](sys::Timer &) { + application->refreshWindow(RefreshModes::GUI_REFRESH_DEEP); + return; + }); } void PhoneLockedWindow::buildInterface() @@ -61,6 +68,7 @@ namespace gui navBar->setText(nav_bar::Side::Center, utils::translate("app_desktop_unlock")); navBar->setActive(nav_bar::Side::Right, false); } + screenRefreshTimer.start(); } bool PhoneLockedWindow::updateTime() @@ -105,6 +113,11 @@ namespace gui return true; } + void PhoneLockedWindow::onClose(Window::CloseReason reason) + { + screenRefreshTimer.stop(); + } + status_bar::Configuration PhoneLockedWindow::configureStatusBar(status_bar::Configuration appConfiguration) { appConfiguration.disable(status_bar::Indicator::NetworkAccessTechnology); diff --git a/module-apps/apps-common/popups/lock-popups/PhoneLockedWindow.hpp b/module-apps/apps-common/popups/lock-popups/PhoneLockedWindow.hpp index 8547cdbdcbff80f26c9092ce74237eaf00d18935..c5aa95735f5ed479c310b5fa48d6782796fce43c 100644 --- a/module-apps/apps-common/popups/lock-popups/PhoneLockedWindow.hpp +++ b/module-apps/apps-common/popups/lock-popups/PhoneLockedWindow.hpp @@ -26,6 +26,7 @@ namespace gui bool onInput(const InputEvent &inputEvent) override; void onBeforeShow(ShowMode mode, SwitchData *data) override; + void onClose(CloseReason reason) override; void buildInterface() override; status_bar::Configuration configureStatusBar(status_bar::Configuration appConfiguration) override; @@ -40,6 +41,10 @@ namespace gui bool processLongReleaseEvent(const InputEvent &inputEvent); private: + static constexpr auto refreshTimerName = "PhoneLockRefreshTimer"; + static constexpr auto refreshTimeout = std::chrono::hours(4); + sys::TimerHandle screenRefreshTimer; + std::shared_ptr clockWallpaper; std::unique_ptr wallpaperPresenter; };