From aeb71e089aca2f4d1e80ea03ab3954942b075bf5 Mon Sep 17 00:00:00 2001 From: John Preston Date: Tue, 3 Jan 2023 10:43:55 +0400 Subject: [PATCH] Fix tile background saving after an app update. Fixes #25666, I hope fixes #16468, I hope fixes #5944. --- .../SourceFiles/window/themes/window_theme.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/Telegram/SourceFiles/window/themes/window_theme.cpp b/Telegram/SourceFiles/window/themes/window_theme.cpp index 174b2f128b..c2961f9477 100644 --- a/Telegram/SourceFiles/window/themes/window_theme.cpp +++ b/Telegram/SourceFiles/window/themes/window_theme.cpp @@ -923,11 +923,21 @@ QImage ChatBackground::createCurrentImage() const { } bool ChatBackground::tile() const { + if (!started()) { + const auto &set = nightMode() + ? _localStoredTileNightValue + : _localStoredTileDayValue; + if (set.has_value()) { + return *set; + } + } return nightMode() ? _tileNightValue : _tileDayValue; } bool ChatBackground::tileDay() const { - if (Data::details::IsTestingThemeWallPaper(_paper) || + if (!started() && _localStoredTileDayValue.has_value()) { + return *_localStoredTileDayValue; + } else if (Data::details::IsTestingThemeWallPaper(_paper) || Data::details::IsTestingDefaultWallPaper(_paper)) { if (!nightMode()) { return _tileForRevert; @@ -937,7 +947,9 @@ bool ChatBackground::tileDay() const { } bool ChatBackground::tileNight() const { - if (Data::details::IsTestingThemeWallPaper(_paper) || + if (!started() && _localStoredTileNightValue.has_value()) { + return *_localStoredTileNightValue; + } else if (Data::details::IsTestingThemeWallPaper(_paper) || Data::details::IsTestingDefaultWallPaper(_paper)) { if (nightMode()) { return _tileForRevert;