mirror of https://github.com/procxx/kepka.git
Update API scheme to layer 103.
This commit is contained in:
parent
c70a1f03de
commit
8d632bd2be
|
@ -651,7 +651,7 @@ messages.botResults#947ca848 flags:# gallery:flags.0?true query_id:long next_off
|
||||||
|
|
||||||
exportedMessageLink#5dab1af4 link:string html:string = ExportedMessageLink;
|
exportedMessageLink#5dab1af4 link:string html:string = ExportedMessageLink;
|
||||||
|
|
||||||
messageFwdHeader#ec338270 flags:# from_id:flags.0?int from_name:flags.5?string date:int channel_id:flags.1?int channel_post:flags.2?int post_author:flags.3?string saved_from_peer:flags.4?Peer saved_from_msg_id:flags.4?int = MessageFwdHeader;
|
messageFwdHeader#353a686b flags:# from_id:flags.0?int from_name:flags.5?string date:int channel_id:flags.1?int channel_post:flags.2?int post_author:flags.3?string saved_from_peer:flags.4?Peer saved_from_msg_id:flags.4?int psa_type:flags.6?string = MessageFwdHeader;
|
||||||
|
|
||||||
auth.codeTypeSms#72a3158c = auth.CodeType;
|
auth.codeTypeSms#72a3158c = auth.CodeType;
|
||||||
auth.codeTypeCall#741cd3e3 = auth.CodeType;
|
auth.codeTypeCall#741cd3e3 = auth.CodeType;
|
||||||
|
@ -912,9 +912,6 @@ fileHash#6242c773 offset:int limit:int hash:bytes = FileHash;
|
||||||
|
|
||||||
inputClientProxy#75588b3f address:string port:int = InputClientProxy;
|
inputClientProxy#75588b3f address:string port:int = InputClientProxy;
|
||||||
|
|
||||||
help.proxyDataEmpty#e09e1fb8 expires:int = help.ProxyData;
|
|
||||||
help.proxyDataPromo#2bf7ee23 expires:int peer:Peer chats:Vector<Chat> users:Vector<User> = help.ProxyData;
|
|
||||||
|
|
||||||
help.termsOfServiceUpdateEmpty#e3309f7f expires:int = help.TermsOfServiceUpdate;
|
help.termsOfServiceUpdateEmpty#e3309f7f expires:int = help.TermsOfServiceUpdate;
|
||||||
help.termsOfServiceUpdate#28ecf961 expires:int terms_of_service:help.TermsOfService = help.TermsOfServiceUpdate;
|
help.termsOfServiceUpdate#28ecf961 expires:int terms_of_service:help.TermsOfService = help.TermsOfServiceUpdate;
|
||||||
|
|
||||||
|
@ -1140,6 +1137,9 @@ messageInteractionCounters#ad4fc9bd msg_id:int views:int forwards:int = MessageI
|
||||||
|
|
||||||
stats.broadcastStats#bdf78394 period:StatsDateRangeDays followers:StatsAbsValueAndPrev views_per_post:StatsAbsValueAndPrev shares_per_post:StatsAbsValueAndPrev enabled_notifications:StatsPercentValue growth_graph:StatsGraph followers_graph:StatsGraph mute_graph:StatsGraph top_hours_graph:StatsGraph interactions_graph:StatsGraph iv_interactions_graph:StatsGraph views_by_source_graph:StatsGraph new_followers_by_source_graph:StatsGraph languages_graph:StatsGraph recent_message_interactions:Vector<MessageInteractionCounters> = stats.BroadcastStats;
|
stats.broadcastStats#bdf78394 period:StatsDateRangeDays followers:StatsAbsValueAndPrev views_per_post:StatsAbsValueAndPrev shares_per_post:StatsAbsValueAndPrev enabled_notifications:StatsPercentValue growth_graph:StatsGraph followers_graph:StatsGraph mute_graph:StatsGraph top_hours_graph:StatsGraph interactions_graph:StatsGraph iv_interactions_graph:StatsGraph views_by_source_graph:StatsGraph new_followers_by_source_graph:StatsGraph languages_graph:StatsGraph recent_message_interactions:Vector<MessageInteractionCounters> = stats.BroadcastStats;
|
||||||
|
|
||||||
|
help.promoDataEmpty#98f6ac75 expires:int = help.PromoData;
|
||||||
|
help.promoData#8f6adccf flags:# proxy:flags.0?true psa:flags.1?true expires:int peer:Peer chats:Vector<Chat> users:Vector<User> psa_message:flags.2?string = help.PromoData;
|
||||||
|
|
||||||
---functions---
|
---functions---
|
||||||
|
|
||||||
invokeAfterMsg#cb9f372d {X:Type} msg_id:long query:!X = X;
|
invokeAfterMsg#cb9f372d {X:Type} msg_id:long query:!X = X;
|
||||||
|
@ -1411,7 +1411,6 @@ help.getAppChangelog#9010ef6f prev_app_version:string = Updates;
|
||||||
help.setBotUpdatesStatus#ec22cfcd pending_updates_count:int message:string = Bool;
|
help.setBotUpdatesStatus#ec22cfcd pending_updates_count:int message:string = Bool;
|
||||||
help.getCdnConfig#52029342 = CdnConfig;
|
help.getCdnConfig#52029342 = CdnConfig;
|
||||||
help.getRecentMeUrls#3dc0f114 referer:string = help.RecentMeUrls;
|
help.getRecentMeUrls#3dc0f114 referer:string = help.RecentMeUrls;
|
||||||
help.getProxyData#3d7758e1 = help.ProxyData;
|
|
||||||
help.getTermsOfServiceUpdate#2ca51fd1 = help.TermsOfServiceUpdate;
|
help.getTermsOfServiceUpdate#2ca51fd1 = help.TermsOfServiceUpdate;
|
||||||
help.acceptTermsOfService#ee72f79a id:DataJSON = Bool;
|
help.acceptTermsOfService#ee72f79a id:DataJSON = Bool;
|
||||||
help.getDeepLinkInfo#3fedc75f path:string = help.DeepLinkInfo;
|
help.getDeepLinkInfo#3fedc75f path:string = help.DeepLinkInfo;
|
||||||
|
@ -1421,6 +1420,7 @@ help.getPassportConfig#c661ad08 hash:int = help.PassportConfig;
|
||||||
help.getSupportName#d360e72c = help.SupportName;
|
help.getSupportName#d360e72c = help.SupportName;
|
||||||
help.getUserInfo#38a08d3 user_id:InputUser = help.UserInfo;
|
help.getUserInfo#38a08d3 user_id:InputUser = help.UserInfo;
|
||||||
help.editUserInfo#66b91b70 user_id:InputUser message:string entities:Vector<MessageEntity> = help.UserInfo;
|
help.editUserInfo#66b91b70 user_id:InputUser message:string entities:Vector<MessageEntity> = help.UserInfo;
|
||||||
|
help.getPromoData#c0977421 = help.PromoData;
|
||||||
|
|
||||||
channels.readHistory#cc104937 channel:InputChannel max_id:int = Bool;
|
channels.readHistory#cc104937 channel:InputChannel max_id:int = Bool;
|
||||||
channels.deleteMessages#84c1fd4e channel:InputChannel id:Vector<int> = messages.AffectedMessages;
|
channels.deleteMessages#84c1fd4e channel:InputChannel id:Vector<int> = messages.AffectedMessages;
|
||||||
|
@ -1494,7 +1494,6 @@ langpack.getLanguage#6a596502 lang_pack:string lang_code:string = LangPackLangua
|
||||||
folders.editPeerFolders#6847d0ab folder_peers:Vector<InputFolderPeer> = Updates;
|
folders.editPeerFolders#6847d0ab folder_peers:Vector<InputFolderPeer> = Updates;
|
||||||
folders.deleteFolder#1c295881 folder_id:int = Updates;
|
folders.deleteFolder#1c295881 folder_id:int = Updates;
|
||||||
|
|
||||||
stats.getBroadcastStats#e6300dba flags:# dark:flags.0?true channel:InputChannel tz_offset:int = stats.BroadcastStats;
|
|
||||||
stats.loadAsyncGraph#621d5fa0 flags:# token:string x:flags.0?long = StatsGraph;
|
stats.loadAsyncGraph#621d5fa0 flags:# token:string x:flags.0?long = StatsGraph;
|
||||||
|
|
||||||
// LAYER 112
|
// LAYER 113
|
||||||
|
|
|
@ -88,8 +88,8 @@ constexpr auto kMaxUsersPerInvite = 100;
|
||||||
// that was added to this chat.
|
// that was added to this chat.
|
||||||
constexpr auto kForwardMessagesOnAdd = 100;
|
constexpr auto kForwardMessagesOnAdd = 100;
|
||||||
|
|
||||||
constexpr auto kProxyPromotionInterval = TimeId(60 * 60);
|
constexpr auto kTopPromotionInterval = TimeId(60 * 60);
|
||||||
constexpr auto kProxyPromotionMinDelay = TimeId(10);
|
constexpr auto kTopPromotionMinDelay = TimeId(10);
|
||||||
constexpr auto kSmallDelayMs = 5;
|
constexpr auto kSmallDelayMs = 5;
|
||||||
constexpr auto kUnreadMentionsPreloadIfLess = 5;
|
constexpr auto kUnreadMentionsPreloadIfLess = 5;
|
||||||
constexpr auto kUnreadMentionsFirstRequestLimit = 10;
|
constexpr auto kUnreadMentionsFirstRequestLimit = 10;
|
||||||
|
@ -237,7 +237,7 @@ ApiWrap::ApiWrap(not_null<Main::Session*> session)
|
||||||
, _dialogsLoadState(std::make_unique<DialogsLoadState>())
|
, _dialogsLoadState(std::make_unique<DialogsLoadState>())
|
||||||
, _fileLoader(std::make_unique<TaskQueue>(kFileLoaderQueueStopTimeout))
|
, _fileLoader(std::make_unique<TaskQueue>(kFileLoaderQueueStopTimeout))
|
||||||
//, _feedReadTimer([=] { readFeeds(); }) // #feed
|
//, _feedReadTimer([=] { readFeeds(); }) // #feed
|
||||||
, _proxyPromotionTimer([=] { refreshProxyPromotion(); })
|
, _topPromotionTimer([=] { refreshTopPromotion(); })
|
||||||
, _updateNotifySettingsTimer([=] { sendNotifySettingsUpdates(); })
|
, _updateNotifySettingsTimer([=] { sendNotifySettingsUpdates(); })
|
||||||
, _selfDestruct(std::make_unique<Api::SelfDestruct>(this))
|
, _selfDestruct(std::make_unique<Api::SelfDestruct>(this))
|
||||||
, _sensitiveContent(std::make_unique<Api::SensitiveContent>(this)) {
|
, _sensitiveContent(std::make_unique<Api::SensitiveContent>(this)) {
|
||||||
|
@ -288,13 +288,13 @@ void ApiWrap::requestChangelog(
|
||||||
).send();
|
).send();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ApiWrap::refreshProxyPromotion() {
|
void ApiWrap::refreshTopPromotion() {
|
||||||
const auto now = base::unixtime::now();
|
const auto now = base::unixtime::now();
|
||||||
const auto next = (_proxyPromotionNextRequestTime != 0)
|
const auto next = (_topPromotionNextRequestTime != 0)
|
||||||
? _proxyPromotionNextRequestTime
|
? _topPromotionNextRequestTime
|
||||||
: now;
|
: now;
|
||||||
if (_proxyPromotionRequestId) {
|
if (_topPromotionRequestId) {
|
||||||
getProxyPromotionDelayed(now, next);
|
getTopPromotionDelayed(now, next);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const auto key = [&]() -> std::pair<QString, uint32> {
|
const auto key = [&]() -> std::pair<QString, uint32> {
|
||||||
|
@ -307,51 +307,48 @@ void ApiWrap::refreshProxyPromotion() {
|
||||||
}
|
}
|
||||||
return { proxy.host, proxy.port };
|
return { proxy.host, proxy.port };
|
||||||
}();
|
}();
|
||||||
if (_proxyPromotionKey == key && now < next) {
|
if (_topPromotionKey == key && now < next) {
|
||||||
getProxyPromotionDelayed(now, next);
|
getTopPromotionDelayed(now, next);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_proxyPromotionKey = key;
|
_topPromotionKey = key;
|
||||||
if (key.first.isEmpty() || !key.second) {
|
_topPromotionRequestId = request(MTPhelp_GetPromoData(
|
||||||
proxyPromotionDone(MTP_help_proxyDataEmpty(
|
)).done([=](const MTPhelp_PromoData &result) {
|
||||||
MTP_int(base::unixtime::now() + kProxyPromotionInterval)));
|
_topPromotionRequestId = 0;
|
||||||
return;
|
topPromotionDone(result);
|
||||||
}
|
|
||||||
_proxyPromotionRequestId = request(MTPhelp_GetProxyData(
|
|
||||||
)).done([=](const MTPhelp_ProxyData &result) {
|
|
||||||
_proxyPromotionRequestId = 0;
|
|
||||||
proxyPromotionDone(result);
|
|
||||||
}).fail([=](const RPCError &error) {
|
}).fail([=](const RPCError &error) {
|
||||||
_proxyPromotionRequestId = 0;
|
_topPromotionRequestId = 0;
|
||||||
const auto now = base::unixtime::now();
|
const auto now = base::unixtime::now();
|
||||||
const auto next = _proxyPromotionNextRequestTime = now
|
const auto next = _topPromotionNextRequestTime = now
|
||||||
+ kProxyPromotionInterval;
|
+ kTopPromotionInterval;
|
||||||
if (!_proxyPromotionTimer.isActive()) {
|
if (!_topPromotionTimer.isActive()) {
|
||||||
getProxyPromotionDelayed(now, next);
|
getTopPromotionDelayed(now, next);
|
||||||
}
|
}
|
||||||
}).send();
|
}).send();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ApiWrap::getProxyPromotionDelayed(TimeId now, TimeId next) {
|
void ApiWrap::getTopPromotionDelayed(TimeId now, TimeId next) {
|
||||||
_proxyPromotionTimer.callOnce(std::min(
|
_topPromotionTimer.callOnce(std::min(
|
||||||
std::max(next - now, kProxyPromotionMinDelay),
|
std::max(next - now, kTopPromotionMinDelay),
|
||||||
kProxyPromotionInterval) * crl::time(1000));
|
kTopPromotionInterval) * crl::time(1000));
|
||||||
};
|
};
|
||||||
|
|
||||||
void ApiWrap::proxyPromotionDone(const MTPhelp_ProxyData &proxy) {
|
void ApiWrap::topPromotionDone(const MTPhelp_PromoData &proxy) {
|
||||||
_proxyPromotionNextRequestTime = proxy.match([&](const auto &data) {
|
_topPromotionNextRequestTime = proxy.match([&](const auto &data) {
|
||||||
return data.vexpires().v;
|
return data.vexpires().v;
|
||||||
});
|
});
|
||||||
getProxyPromotionDelayed(base::unixtime::now(), _proxyPromotionNextRequestTime);
|
getTopPromotionDelayed(
|
||||||
|
base::unixtime::now(),
|
||||||
|
_topPromotionNextRequestTime);
|
||||||
|
|
||||||
proxy.match([&](const MTPDhelp_proxyDataEmpty &data) {
|
proxy.match([&](const MTPDhelp_promoDataEmpty &data) {
|
||||||
_session->data().setProxyPromoted(nullptr);
|
_session->data().setTopPromoted(nullptr);
|
||||||
}, [&](const MTPDhelp_proxyDataPromo &data) {
|
}, [&](const MTPDhelp_promoData &data) {
|
||||||
_session->data().processChats(data.vchats());
|
_session->data().processChats(data.vchats());
|
||||||
_session->data().processUsers(data.vusers());
|
_session->data().processUsers(data.vusers());
|
||||||
const auto peerId = peerFromMTP(data.vpeer());
|
const auto peerId = peerFromMTP(data.vpeer());
|
||||||
const auto peer = _session->data().peer(peerId);
|
const auto peer = _session->data().peer(peerId);
|
||||||
_session->data().setProxyPromoted(peer);
|
_session->data().setTopPromoted(peer);
|
||||||
if (const auto history = _session->data().historyLoaded(peer)) {
|
if (const auto history = _session->data().historyLoaded(peer)) {
|
||||||
history->owner().histories().requestDialogEntry(history);
|
history->owner().histories().requestDialogEntry(history);
|
||||||
}
|
}
|
||||||
|
|
|
@ -208,7 +208,7 @@ public:
|
||||||
void requestChangelog(
|
void requestChangelog(
|
||||||
const QString &sinceVersion,
|
const QString &sinceVersion,
|
||||||
Fn<void(const MTPUpdates &result)> callback);
|
Fn<void(const MTPUpdates &result)> callback);
|
||||||
void refreshProxyPromotion();
|
void refreshTopPromotion();
|
||||||
void requestDeepLinkInfo(
|
void requestDeepLinkInfo(
|
||||||
const QString &path,
|
const QString &path,
|
||||||
Fn<void(const MTPDhelp_deepLinkInfo &result)> callback);
|
Fn<void(const MTPDhelp_deepLinkInfo &result)> callback);
|
||||||
|
@ -646,8 +646,8 @@ private:
|
||||||
|
|
||||||
//void readFeeds(); // #feed
|
//void readFeeds(); // #feed
|
||||||
|
|
||||||
void getProxyPromotionDelayed(TimeId now, TimeId next);
|
void getTopPromotionDelayed(TimeId now, TimeId next);
|
||||||
void proxyPromotionDone(const MTPhelp_ProxyData &proxy);
|
void topPromotionDone(const MTPhelp_PromoData &proxy);
|
||||||
|
|
||||||
void sendNotifySettingsUpdates();
|
void sendNotifySettingsUpdates();
|
||||||
|
|
||||||
|
@ -787,10 +787,10 @@ private:
|
||||||
//base::flat_map<not_null<Data::Feed*>, mtpRequestId> _feedReadRequests;
|
//base::flat_map<not_null<Data::Feed*>, mtpRequestId> _feedReadRequests;
|
||||||
//base::Timer _feedReadTimer;
|
//base::Timer _feedReadTimer;
|
||||||
|
|
||||||
mtpRequestId _proxyPromotionRequestId = 0;
|
mtpRequestId _topPromotionRequestId = 0;
|
||||||
std::pair<QString, uint32> _proxyPromotionKey;
|
std::pair<QString, uint32> _topPromotionKey;
|
||||||
TimeId _proxyPromotionNextRequestTime = TimeId(0);
|
TimeId _topPromotionNextRequestTime = TimeId(0);
|
||||||
base::Timer _proxyPromotionTimer;
|
base::Timer _topPromotionTimer;
|
||||||
|
|
||||||
base::flat_set<not_null<const PeerData*>> _updateNotifySettingsPeers;
|
base::flat_set<not_null<const PeerData*>> _updateNotifySettingsPeers;
|
||||||
base::Timer _updateNotifySettingsTimer;
|
base::Timer _updateNotifySettingsTimer;
|
||||||
|
|
|
@ -3713,18 +3713,18 @@ MessageIdsList Session::takeMimeForwardIds() {
|
||||||
return std::move(_mimeForwardIds);
|
return std::move(_mimeForwardIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Session::setProxyPromoted(PeerData *promoted) {
|
void Session::setTopPromoted(PeerData *promoted) {
|
||||||
if (_proxyPromoted != promoted) {
|
if (_topPromoted != promoted) {
|
||||||
if (const auto history = historyLoaded(_proxyPromoted)) {
|
if (const auto history = historyLoaded(_topPromoted)) {
|
||||||
history->cacheProxyPromoted(false);
|
history->cacheTopPromoted(false);
|
||||||
}
|
}
|
||||||
const auto old = std::exchange(_proxyPromoted, promoted);
|
const auto old = std::exchange(_topPromoted, promoted);
|
||||||
if (_proxyPromoted) {
|
if (_topPromoted) {
|
||||||
const auto history = this->history(_proxyPromoted);
|
const auto history = this->history(_topPromoted);
|
||||||
history->cacheProxyPromoted(true);
|
history->cacheTopPromoted(true);
|
||||||
history->requestChatListMessage();
|
history->requestChatListMessage();
|
||||||
Notify::peerUpdatedDelayed(
|
Notify::peerUpdatedDelayed(
|
||||||
_proxyPromoted,
|
_topPromoted,
|
||||||
Notify::PeerUpdate::Flag::ChannelPromotedChanged);
|
Notify::PeerUpdate::Flag::ChannelPromotedChanged);
|
||||||
}
|
}
|
||||||
if (old) {
|
if (old) {
|
||||||
|
@ -3735,8 +3735,8 @@ void Session::setProxyPromoted(PeerData *promoted) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PeerData *Session::proxyPromoted() const {
|
PeerData *Session::topPromoted() const {
|
||||||
return _proxyPromoted;
|
return _topPromoted;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Session::updateWallpapers(const MTPaccount_WallPapers &data) {
|
bool Session::updateWallpapers(const MTPaccount_WallPapers &data) {
|
||||||
|
|
|
@ -678,8 +678,8 @@ public:
|
||||||
void setMimeForwardIds(MessageIdsList &&list);
|
void setMimeForwardIds(MessageIdsList &&list);
|
||||||
MessageIdsList takeMimeForwardIds();
|
MessageIdsList takeMimeForwardIds();
|
||||||
|
|
||||||
void setProxyPromoted(PeerData *promoted);
|
void setTopPromoted(PeerData *promoted);
|
||||||
PeerData *proxyPromoted() const;
|
PeerData *topPromoted() const;
|
||||||
|
|
||||||
bool updateWallpapers(const MTPaccount_WallPapers &data);
|
bool updateWallpapers(const MTPaccount_WallPapers &data);
|
||||||
void removeWallpaper(const WallPaper &paper);
|
void removeWallpaper(const WallPaper &paper);
|
||||||
|
@ -957,7 +957,7 @@ private:
|
||||||
|
|
||||||
base::flat_set<not_null<ViewElement*>> _heavyViewParts;
|
base::flat_set<not_null<ViewElement*>> _heavyViewParts;
|
||||||
|
|
||||||
PeerData *_proxyPromoted = nullptr;
|
PeerData *_topPromoted = nullptr;
|
||||||
|
|
||||||
NotifySettings _defaultUserNotifySettings;
|
NotifySettings _defaultUserNotifySettings;
|
||||||
NotifySettings _defaultChatNotifySettings;
|
NotifySettings _defaultChatNotifySettings;
|
||||||
|
|
|
@ -86,12 +86,12 @@ void Entry::cachePinnedIndex(FilterId filterId, int index) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Entry::cacheProxyPromoted(bool promoted) {
|
void Entry::cacheTopPromoted(bool promoted) {
|
||||||
if (_isProxyPromoted != promoted) {
|
if (_isTopPromoted != promoted) {
|
||||||
_isProxyPromoted = promoted;
|
_isTopPromoted = promoted;
|
||||||
updateChatListSortPosition();
|
updateChatListSortPosition();
|
||||||
updateChatListEntry();
|
updateChatListEntry();
|
||||||
if (!_isProxyPromoted) {
|
if (!_isTopPromoted) {
|
||||||
updateChatListExistence();
|
updateChatListExistence();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -120,10 +120,10 @@ public:
|
||||||
return lookupPinnedIndex(filterId) != 0;
|
return lookupPinnedIndex(filterId) != 0;
|
||||||
}
|
}
|
||||||
void cachePinnedIndex(FilterId filterId, int index);
|
void cachePinnedIndex(FilterId filterId, int index);
|
||||||
bool isProxyPromoted() const {
|
bool isTopPromoted() const {
|
||||||
return _isProxyPromoted;
|
return _isTopPromoted;
|
||||||
}
|
}
|
||||||
void cacheProxyPromoted(bool promoted);
|
void cacheTopPromoted(bool promoted);
|
||||||
[[nodiscard]] uint64 sortKeyInChatList(FilterId filterId) const {
|
[[nodiscard]] uint64 sortKeyInChatList(FilterId filterId) const {
|
||||||
return filterId
|
return filterId
|
||||||
? computeSortPosition(filterId)
|
? computeSortPosition(filterId)
|
||||||
|
@ -137,7 +137,7 @@ public:
|
||||||
|
|
||||||
virtual int fixedOnTopIndex() const = 0;
|
virtual int fixedOnTopIndex() const = 0;
|
||||||
static constexpr auto kArchiveFixOnTopIndex = 1;
|
static constexpr auto kArchiveFixOnTopIndex = 1;
|
||||||
static constexpr auto kProxyPromotionFixOnTopIndex = 2;
|
static constexpr auto kTopPromotionFixOnTopIndex = 2;
|
||||||
|
|
||||||
virtual bool shouldBeInChatList() const = 0;
|
virtual bool shouldBeInChatList() const = 0;
|
||||||
virtual int chatListUnreadCount() const = 0;
|
virtual int chatListUnreadCount() const = 0;
|
||||||
|
@ -211,7 +211,7 @@ private:
|
||||||
uint64 _sortKeyInChatList = 0;
|
uint64 _sortKeyInChatList = 0;
|
||||||
uint64 _sortKeyByDate = 0;
|
uint64 _sortKeyByDate = 0;
|
||||||
base::flat_map<FilterId, int> _pinnedIndex;
|
base::flat_map<FilterId, int> _pinnedIndex;
|
||||||
bool _isProxyPromoted = false;
|
bool _isTopPromoted = false;
|
||||||
TimeId _timeId = 0;
|
TimeId _timeId = 0;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -296,7 +296,7 @@ void paintRow(
|
||||||
namewidth,
|
namewidth,
|
||||||
st::msgNameFont->height);
|
st::msgNameFont->height);
|
||||||
|
|
||||||
const auto promoted = (history && history->useProxyPromotion())
|
const auto promoted = (history && history->useTopPromotion())
|
||||||
&& !(flags & (Flag::SearchResult/* | Flag::FeedSearchResult*/)); // #feed
|
&& !(flags & (Flag::SearchResult/* | Flag::FeedSearchResult*/)); // #feed
|
||||||
if (promoted) {
|
if (promoted) {
|
||||||
const auto text = tr::lng_proxy_sponsor(tr::now);
|
const auto text = tr::lng_proxy_sponsor(tr::now);
|
||||||
|
|
|
@ -2580,8 +2580,8 @@ void History::updateChatListExistence() {
|
||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool History::useProxyPromotion() const {
|
bool History::useTopPromotion() const {
|
||||||
if (!isProxyPromoted()) {
|
if (!isTopPromoted()) {
|
||||||
return false;
|
return false;
|
||||||
} else if (const auto channel = peer->asChannel()) {
|
} else if (const auto channel = peer->asChannel()) {
|
||||||
return !isPinnedDialog(FilterId()) && !channel->amIn();
|
return !isPinnedDialog(FilterId()) && !channel->amIn();
|
||||||
|
@ -2590,7 +2590,7 @@ bool History::useProxyPromotion() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
int History::fixedOnTopIndex() const {
|
int History::fixedOnTopIndex() const {
|
||||||
return useProxyPromotion() ? kProxyPromotionFixOnTopIndex : 0;
|
return useTopPromotion() ? kTopPromotionFixOnTopIndex : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool History::trackUnreadMessages() const {
|
bool History::trackUnreadMessages() const {
|
||||||
|
@ -2607,7 +2607,7 @@ bool History::shouldBeInChatList() const {
|
||||||
return true;
|
return true;
|
||||||
} else if (const auto channel = peer->asChannel()) {
|
} else if (const auto channel = peer->asChannel()) {
|
||||||
if (!channel->amIn()) {
|
if (!channel->amIn()) {
|
||||||
return isProxyPromoted();
|
return isTopPromoted();
|
||||||
//} else if (const auto feed = channel->feed()) { // #feed
|
//} else if (const auto feed = channel->feed()) { // #feed
|
||||||
// return !feed->needUpdateInChatList();
|
// return !feed->needUpdateInChatList();
|
||||||
}
|
}
|
||||||
|
|
|
@ -330,7 +330,7 @@ public:
|
||||||
void setForwardDraft(MessageIdsList &&items);
|
void setForwardDraft(MessageIdsList &&items);
|
||||||
|
|
||||||
History *migrateSibling() const;
|
History *migrateSibling() const;
|
||||||
bool useProxyPromotion() const;
|
bool useTopPromotion() const;
|
||||||
int fixedOnTopIndex() const override;
|
int fixedOnTopIndex() const override;
|
||||||
void updateChatListExistence() override;
|
void updateChatListExistence() override;
|
||||||
bool shouldBeInChatList() const override;
|
bool shouldBeInChatList() const override;
|
||||||
|
|
|
@ -564,7 +564,7 @@ HistoryWidget::HistoryWidget(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (update.flags & UpdateFlag::ChannelPromotedChanged) {
|
if (update.flags & UpdateFlag::ChannelPromotedChanged) {
|
||||||
refreshAboutProxyPromotion();
|
refreshAboutTopPromotion();
|
||||||
updateHistoryGeometry();
|
updateHistoryGeometry();
|
||||||
updateControlsVisibility();
|
updateControlsVisibility();
|
||||||
updateControlsGeometry();
|
updateControlsGeometry();
|
||||||
|
@ -2067,7 +2067,7 @@ void HistoryWidget::updateControlsVisibility() {
|
||||||
if (_contactStatus) {
|
if (_contactStatus) {
|
||||||
_contactStatus->show();
|
_contactStatus->show();
|
||||||
}
|
}
|
||||||
refreshAboutProxyPromotion();
|
refreshAboutTopPromotion();
|
||||||
if (!editingMessage() && (isBlocked() || isJoinChannel() || isMuteUnmute() || isBotStart())) {
|
if (!editingMessage() && (isBlocked() || isJoinChannel() || isMuteUnmute() || isBotStart())) {
|
||||||
if (isBlocked()) {
|
if (isBlocked()) {
|
||||||
_joinChannel->hide();
|
_joinChannel->hide();
|
||||||
|
@ -2260,10 +2260,10 @@ void HistoryWidget::updateControlsVisibility() {
|
||||||
updateMouseTracking();
|
updateMouseTracking();
|
||||||
}
|
}
|
||||||
|
|
||||||
void HistoryWidget::refreshAboutProxyPromotion() {
|
void HistoryWidget::refreshAboutTopPromotion() {
|
||||||
if (_history->useProxyPromotion()) {
|
if (_history->useTopPromotion()) {
|
||||||
if (!_aboutProxyPromotion) {
|
if (!_aboutTopPromotion) {
|
||||||
_aboutProxyPromotion = object_ptr<Ui::PaddingWrap<Ui::FlatLabel>>(
|
_aboutTopPromotion = object_ptr<Ui::PaddingWrap<Ui::FlatLabel>>(
|
||||||
this,
|
this,
|
||||||
object_ptr<Ui::FlatLabel>(
|
object_ptr<Ui::FlatLabel>(
|
||||||
this,
|
this,
|
||||||
|
@ -2271,9 +2271,9 @@ void HistoryWidget::refreshAboutProxyPromotion() {
|
||||||
st::historyAboutProxy),
|
st::historyAboutProxy),
|
||||||
st::historyAboutProxyPadding);
|
st::historyAboutProxyPadding);
|
||||||
}
|
}
|
||||||
_aboutProxyPromotion->show();
|
_aboutTopPromotion->show();
|
||||||
} else {
|
} else {
|
||||||
_aboutProxyPromotion.destroy();
|
_aboutTopPromotion.destroy();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4188,10 +4188,10 @@ void HistoryWidget::moveFieldControls() {
|
||||||
_muteUnmute->setGeometry(fullWidthButtonRect);
|
_muteUnmute->setGeometry(fullWidthButtonRect);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_aboutProxyPromotion) {
|
if (_aboutTopPromotion) {
|
||||||
_aboutProxyPromotion->moveToLeft(
|
_aboutTopPromotion->moveToLeft(
|
||||||
0,
|
0,
|
||||||
fullWidthButtonRect.y() - _aboutProxyPromotion->height());
|
fullWidthButtonRect.y() - _aboutTopPromotion->height());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5197,9 +5197,9 @@ void HistoryWidget::updateHistoryGeometry(
|
||||||
}
|
}
|
||||||
if (!editingMessage() && (isBlocked() || isBotStart() || isJoinChannel() || isMuteUnmute())) {
|
if (!editingMessage() && (isBlocked() || isBotStart() || isJoinChannel() || isMuteUnmute())) {
|
||||||
newScrollHeight -= _unblock->height();
|
newScrollHeight -= _unblock->height();
|
||||||
if (_aboutProxyPromotion) {
|
if (_aboutTopPromotion) {
|
||||||
_aboutProxyPromotion->resizeToWidth(width());
|
_aboutTopPromotion->resizeToWidth(width());
|
||||||
newScrollHeight -= _aboutProxyPromotion->height();
|
newScrollHeight -= _aboutTopPromotion->height();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (editingMessage() || _canSendMessages) {
|
if (editingMessage() || _canSendMessages) {
|
||||||
|
@ -6983,8 +6983,8 @@ void HistoryWidget::paintEvent(QPaintEvent *e) {
|
||||||
} else if (const auto error = writeRestriction()) {
|
} else if (const auto error = writeRestriction()) {
|
||||||
drawRestrictedWrite(p, *error);
|
drawRestrictedWrite(p, *error);
|
||||||
}
|
}
|
||||||
if (_aboutProxyPromotion) {
|
if (_aboutTopPromotion) {
|
||||||
p.fillRect(_aboutProxyPromotion->geometry(), st::historyReplyBg);
|
p.fillRect(_aboutTopPromotion->geometry(), st::historyReplyBg);
|
||||||
}
|
}
|
||||||
if (_pinnedBar && !_pinnedBar->cancel->isHidden()) {
|
if (_pinnedBar && !_pinnedBar->cancel->isHidden()) {
|
||||||
drawPinnedBar(p);
|
drawPinnedBar(p);
|
||||||
|
|
|
@ -380,7 +380,7 @@ private:
|
||||||
void handlePeerUpdate();
|
void handlePeerUpdate();
|
||||||
void setMembersShowAreaActive(bool active);
|
void setMembersShowAreaActive(bool active);
|
||||||
void handleHistoryChange(not_null<const History*> history);
|
void handleHistoryChange(not_null<const History*> history);
|
||||||
void refreshAboutProxyPromotion();
|
void refreshAboutTopPromotion();
|
||||||
void unreadCountUpdated();
|
void unreadCountUpdated();
|
||||||
|
|
||||||
[[nodiscard]] int computeMaxFieldHeight() const;
|
[[nodiscard]] int computeMaxFieldHeight() const;
|
||||||
|
@ -734,7 +734,7 @@ private:
|
||||||
object_ptr<Ui::FlatButton> _joinChannel;
|
object_ptr<Ui::FlatButton> _joinChannel;
|
||||||
object_ptr<Ui::FlatButton> _muteUnmute;
|
object_ptr<Ui::FlatButton> _muteUnmute;
|
||||||
object_ptr<Ui::FlatButton> _discuss;
|
object_ptr<Ui::FlatButton> _discuss;
|
||||||
object_ptr<Ui::RpWidget> _aboutProxyPromotion = { nullptr };
|
object_ptr<Ui::RpWidget> _aboutTopPromotion = { nullptr };
|
||||||
object_ptr<Ui::IconButton> _attachToggle;
|
object_ptr<Ui::IconButton> _attachToggle;
|
||||||
object_ptr<Ui::EmojiButton> _tabbedSelectorToggle;
|
object_ptr<Ui::EmojiButton> _tabbedSelectorToggle;
|
||||||
object_ptr<Ui::IconButton> _botKeyboardShow;
|
object_ptr<Ui::IconButton> _botKeyboardShow;
|
||||||
|
|
|
@ -69,9 +69,9 @@ Session::Session(
|
||||||
notifications().updateAll();
|
notifications().updateAll();
|
||||||
}, _lifetime);
|
}, _lifetime);
|
||||||
subscribe(Global::RefConnectionTypeChanged(), [=] {
|
subscribe(Global::RefConnectionTypeChanged(), [=] {
|
||||||
_api->refreshProxyPromotion();
|
_api->refreshTopPromotion();
|
||||||
});
|
});
|
||||||
_api->refreshProxyPromotion();
|
_api->refreshTopPromotion();
|
||||||
_api->requestTermsUpdate();
|
_api->requestTermsUpdate();
|
||||||
_api->requestFullPeer(_user);
|
_api->requestFullPeer(_user);
|
||||||
|
|
||||||
|
|
|
@ -150,7 +150,8 @@ AdminLog::OwnedItem GenerateForwardedItem(
|
||||||
MTPint(), // channel_post
|
MTPint(), // channel_post
|
||||||
MTPstring(), // post_author
|
MTPstring(), // post_author
|
||||||
MTPPeer(), // saved_from_peer
|
MTPPeer(), // saved_from_peer
|
||||||
MTPint()), // saved_from_msg_id
|
MTPint(), // saved_from_msg_id
|
||||||
|
MTPstring()), // psa_type
|
||||||
MTPint(), // via_bot_id
|
MTPint(), // via_bot_id
|
||||||
MTPint(), // reply_to_msg_id,
|
MTPint(), // reply_to_msg_id,
|
||||||
MTP_int(base::unixtime::now()), // date
|
MTP_int(base::unixtime::now()), // date
|
||||||
|
|
|
@ -253,7 +253,7 @@ bool Filler::showToggleArchived() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const auto history = _peer->owner().historyLoaded(_peer);
|
const auto history = _peer->owner().historyLoaded(_peer);
|
||||||
if (history && history->useProxyPromotion()) {
|
if (history && history->useTopPromotion()) {
|
||||||
return false;
|
return false;
|
||||||
} else if (!_peer->isNotificationsUser() && !_peer->isSelf()) {
|
} else if (!_peer->isNotificationsUser() && !_peer->isSelf()) {
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in New Issue