2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-09-01 07:05:13 +00:00

Add a simple way of testing color themes.

This commit is contained in:
John Preston
2021-09-10 22:29:30 +03:00
parent c4d822ba02
commit 13c00949ed
7 changed files with 194 additions and 2 deletions

View File

@@ -1399,13 +1399,14 @@ auto SessionController::cachedChatThemeValue(
if (i == end(_customChatThemes)) {
cacheChatTheme(data);
}
const auto limit = Data::CloudThemes::TestingColors() ? (1 << 20) : 1;
using namespace rpl::mappers;
return rpl::single(
_defaultChatTheme
) | rpl::then(_cachedThemesStream.events(
) | rpl::filter([=](const std::shared_ptr<Ui::ChatTheme> &theme) {
return (theme->key() == key);
}) | rpl::take(1));
}) | rpl::take(limit));
}
void SessionController::setChatStyleTheme(
@@ -1417,6 +1418,10 @@ void SessionController::setChatStyleTheme(
_chatStyle->apply(theme.get());
}
void SessionController::clearCachedChatThemes() {
_customChatThemes.clear();
}
void SessionController::pushDefaultChatBackground() {
const auto background = Theme::Background();
const auto &paper = background->paper();