mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +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 {
|
bool SponsoredMessages::isTopBarFor(not_null<History*> history) const {
|
||||||
if (const auto user = history->peer->asUser()) {
|
if (peerIsUser(history->peer->id)) {
|
||||||
return user->isBot();
|
if (const auto user = history->peer->asUser()) {
|
||||||
|
return user->isBot();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4429,7 +4429,6 @@ void HistoryWidget::showAnimated(
|
||||||
if (_pinnedBar) {
|
if (_pinnedBar) {
|
||||||
_pinnedBar->finishAnimating();
|
_pinnedBar->finishAnimating();
|
||||||
}
|
}
|
||||||
checkSponsoredMessageBar();
|
|
||||||
if (_translateBar) {
|
if (_translateBar) {
|
||||||
_translateBar->finishAnimating();
|
_translateBar->finishAnimating();
|
||||||
}
|
}
|
||||||
|
@ -4501,6 +4500,7 @@ void HistoryWidget::doneShow() {
|
||||||
if (_pinnedBar) {
|
if (_pinnedBar) {
|
||||||
_pinnedBar->finishAnimating();
|
_pinnedBar->finishAnimating();
|
||||||
}
|
}
|
||||||
|
checkSponsoredMessageBar();
|
||||||
if (_sponsoredMessageBar) {
|
if (_sponsoredMessageBar) {
|
||||||
_sponsoredMessageBar->finishAnimating();
|
_sponsoredMessageBar->finishAnimating();
|
||||||
}
|
}
|
||||||
|
@ -7628,13 +7628,15 @@ void HistoryWidget::requestSponsoredMessageBar() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void HistoryWidget::checkSponsoredMessageBar() {
|
void HistoryWidget::checkSponsoredMessageBar() {
|
||||||
if (!_history) {
|
if (!_history || !session().sponsoredMessages().isTopBarFor(_history)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const auto state = session().sponsoredMessages().state(_history);
|
const auto state = session().sponsoredMessages().state(_history);
|
||||||
if (state == Data::SponsoredMessages::State::AppendToTopBar) {
|
if (state == Data::SponsoredMessages::State::AppendToTopBar) {
|
||||||
if (checkSponsoredMessageBarVisibility()) {
|
if (checkSponsoredMessageBarVisibility()) {
|
||||||
createSponsoredMessageBar();
|
if (!_sponsoredMessageBar) {
|
||||||
|
createSponsoredMessageBar();
|
||||||
|
}
|
||||||
_sponsoredMessageBar->toggle(true, anim::type::instant);
|
_sponsoredMessageBar->toggle(true, anim::type::instant);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue