mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-05-29 19:23:58 +02:00
Send sponsored peers view requests.
This commit is contained in:
parent
7f2545a9ef
commit
04e10f81b5
4 changed files with 14 additions and 1 deletions
|
@ -149,6 +149,8 @@ PRIVATE
|
|||
api/api_peer_colors.h
|
||||
api/api_peer_photo.cpp
|
||||
api/api_peer_photo.h
|
||||
api/api_peer_search.cpp
|
||||
api/api_peer_search.h
|
||||
api/api_polls.cpp
|
||||
api/api_polls.h
|
||||
api/api_premium.cpp
|
||||
|
|
|
@ -509,7 +509,10 @@ void SponsoredMessages::view(const FullMsgId &fullId) {
|
|||
if (!entryPtr) {
|
||||
return;
|
||||
}
|
||||
const auto randomId = entryPtr->sponsored.randomId;
|
||||
view(entryPtr->sponsored.randomId);
|
||||
}
|
||||
|
||||
void SponsoredMessages::view(const QByteArray &randomId) {
|
||||
auto &request = _viewRequests[randomId];
|
||||
if (request.requestId || TooEarlyForRequest(request.lastReceived)) {
|
||||
return;
|
||||
|
|
|
@ -117,6 +117,7 @@ public:
|
|||
int fallbackWidth);
|
||||
|
||||
void view(const FullMsgId &fullId);
|
||||
void view(const QByteArray &randomId);
|
||||
|
||||
[[nodiscard]] State state(not_null<History*> history) const;
|
||||
|
||||
|
|
|
@ -33,6 +33,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "ui/painter.h"
|
||||
#include "ui/rect.h"
|
||||
#include "ui/ui_utility.h"
|
||||
#include "data/components/sponsored_messages.h"
|
||||
#include "data/data_drafts.h"
|
||||
#include "data/data_folder.h"
|
||||
#include "data/data_forum.h"
|
||||
|
@ -1134,6 +1135,12 @@ void InnerWidget::paintEvent(QPaintEvent *e) {
|
|||
const auto activePeer = activeEntry.key.peer();
|
||||
for (; from < to; ++from) {
|
||||
const auto &result = _peerSearchResults[from];
|
||||
if (result->sponsored
|
||||
&& r.y() <= (skip + from * st::dialogsRowHeight)
|
||||
&& r.y() + r.height() >= (skip + (from + 1) * st::dialogsRowHeight)) {
|
||||
session().sponsoredMessages().view(
|
||||
result->sponsored->randomId);
|
||||
}
|
||||
const auto peer = result->peer;
|
||||
const auto active = !activeEntry.fullId
|
||||
&& activePeer
|
||||
|
|
Loading…
Add table
Reference in a new issue