Drop custom wallpaper on theme change.

This commit is contained in:
John Preston 2023-04-18 22:06:53 +04:00
parent 352ae5100a
commit da7d4687ca
1 changed files with 14 additions and 0 deletions

View File

@ -281,11 +281,25 @@ void ChooseThemeController::initButtons() {
const auto now = chosen->key ? _chosen.current() : QString();
if (was != now) {
_peer->setThemeEmoji(now);
const auto dropWallPaper = (_peer->wallPaper() != nullptr);
if (dropWallPaper) {
_peer->setWallPaper({});
}
if (chosen->theme) {
// Remember while changes propagate through event loop.
_controller->pushLastUsedChatTheme(chosen->theme);
}
const auto api = &_peer->session().api();
api->request(MTPmessages_SetChatWallPaper(
MTP_flags(0),
_peer->input,
MTPInputWallPaper(),
MTPWallPaperSettings(),
MTPint()
)).afterDelay(10).done([=](const MTPUpdates &result) {
api->applyUpdates(result);
}).send();
api->request(MTPmessages_SetChatTheme(
_peer->input,
MTP_string(now)