mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 06:07:06 +02:00
Fixed non-animated display of top bar for sponsored messages.
This commit is contained in:
parent
1dc30caee9
commit
30dae049ff
2 changed files with 9 additions and 5 deletions
|
@ -204,8 +204,10 @@ bool SponsoredMessages::canHaveFor(not_null<History*> history) const {
|
|||
}
|
||||
|
||||
bool SponsoredMessages::isTopBarFor(not_null<History*> history) const {
|
||||
if (const auto user = history->peer->asUser()) {
|
||||
return user->isBot();
|
||||
if (peerIsUser(history->peer->id)) {
|
||||
if (const auto user = history->peer->asUser()) {
|
||||
return user->isBot();
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -4429,7 +4429,6 @@ void HistoryWidget::showAnimated(
|
|||
if (_pinnedBar) {
|
||||
_pinnedBar->finishAnimating();
|
||||
}
|
||||
checkSponsoredMessageBar();
|
||||
if (_translateBar) {
|
||||
_translateBar->finishAnimating();
|
||||
}
|
||||
|
@ -4501,6 +4500,7 @@ void HistoryWidget::doneShow() {
|
|||
if (_pinnedBar) {
|
||||
_pinnedBar->finishAnimating();
|
||||
}
|
||||
checkSponsoredMessageBar();
|
||||
if (_sponsoredMessageBar) {
|
||||
_sponsoredMessageBar->finishAnimating();
|
||||
}
|
||||
|
@ -7628,13 +7628,15 @@ void HistoryWidget::requestSponsoredMessageBar() {
|
|||
}
|
||||
|
||||
void HistoryWidget::checkSponsoredMessageBar() {
|
||||
if (!_history) {
|
||||
if (!_history || !session().sponsoredMessages().isTopBarFor(_history)) {
|
||||
return;
|
||||
}
|
||||
const auto state = session().sponsoredMessages().state(_history);
|
||||
if (state == Data::SponsoredMessages::State::AppendToTopBar) {
|
||||
if (checkSponsoredMessageBarVisibility()) {
|
||||
createSponsoredMessageBar();
|
||||
if (!_sponsoredMessageBar) {
|
||||
createSponsoredMessageBar();
|
||||
}
|
||||
_sponsoredMessageBar->toggle(true, anim::type::instant);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue