mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-15 21:57:10 +02:00
Update API scheme to layer 149.
This commit is contained in:
parent
a94dd22caa
commit
983b6af0b4
5 changed files with 19 additions and 24 deletions
|
@ -266,7 +266,7 @@ messages.dialogsNotModified#f0e3e596 count:int = messages.Dialogs;
|
|||
|
||||
messages.messages#8c718e87 messages:Vector<Message> chats:Vector<Chat> users:Vector<User> = messages.Messages;
|
||||
messages.messagesSlice#3a54685e flags:# inexact:flags.1?true count:int next_rate:flags.0?int offset_id_offset:flags.2?int messages:Vector<Message> chats:Vector<Chat> users:Vector<User> = messages.Messages;
|
||||
messages.channelMessages#64479808 flags:# inexact:flags.1?true pts:int count:int offset_id_offset:flags.2?int messages:Vector<Message> chats:Vector<Chat> users:Vector<User> = messages.Messages;
|
||||
messages.channelMessages#c776ba4e flags:# inexact:flags.1?true pts:int count:int offset_id_offset:flags.2?int messages:Vector<Message> topics:Vector<ForumTopic> chats:Vector<Chat> users:Vector<User> = messages.Messages;
|
||||
messages.messagesNotModified#74535f21 count:int = messages.Messages;
|
||||
|
||||
messages.chats#64ff9fd5 chats:Vector<Chat> = messages.Chats;
|
||||
|
@ -401,7 +401,8 @@ updateRecentEmojiStatuses#30f443db = Update;
|
|||
updateRecentReactions#6f7863f4 = Update;
|
||||
updateMoveStickerSetToTop#86fccf85 flags:# masks:flags.0?true emojis:flags.1?true stickerset:long = Update;
|
||||
updateMessageExtendedMedia#5a73a98c peer:Peer msg_id:int extended_media:MessageExtendedMedia = Update;
|
||||
updateChannelPinnedTopic#f694b0ae flags:# channel_id:long topic_id:flags.0?int = Update;
|
||||
updateChannelPinnedTopic#192efbe3 flags:# pinned:flags.0?true channel_id:long topic_id:int = Update;
|
||||
updateChannelPinnedTopics#fe198602 flags:# channel_id:long order:flags.0?Vector<int> = Update;
|
||||
|
||||
updates.state#a56c2a3e pts:int qts:int date:int seq:int unread_count:int = updates.State;
|
||||
|
||||
|
@ -1466,7 +1467,7 @@ stickerKeyword#fcfeb29c document_id:long keyword:Vector<string> = StickerKeyword
|
|||
username#b4073647 flags:# editable:flags.0?true active:flags.1?true username:string = Username;
|
||||
|
||||
forumTopicDeleted#23f109b id:int = ForumTopic;
|
||||
forumTopic#71701da9 flags:# my:flags.1?true closed:flags.2?true pinned:flags.3?true id:int date:int title:string icon_color:int icon_emoji_id:flags.0?long top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int unread_mentions_count:int unread_reactions_count:int from_id:Peer notify_settings:PeerNotifySettings draft:flags.4?DraftMessage = ForumTopic;
|
||||
forumTopic#71701da9 flags:# my:flags.1?true closed:flags.2?true pinned:flags.3?true short:flags.5?true id:int date:int title:string icon_color:int icon_emoji_id:flags.0?long top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int unread_mentions_count:int unread_reactions_count:int from_id:Peer notify_settings:PeerNotifySettings draft:flags.4?DraftMessage = ForumTopic;
|
||||
|
||||
messages.forumTopics#367617d3 flags:# order_by_create_date:flags.0?true count:int topics:Vector<ForumTopic> messages:Vector<Message> chats:Vector<Chat> users:Vector<User> pts:int = messages.ForumTopics;
|
||||
|
||||
|
@ -1880,6 +1881,7 @@ channels.getForumTopicsByID#b0831eb9 channel:InputChannel topics:Vector<int> = m
|
|||
channels.editForumTopic#6c883e2d flags:# channel:InputChannel topic_id:int title:flags.0?string icon_emoji_id:flags.1?long closed:flags.2?Bool = Updates;
|
||||
channels.updatePinnedForumTopic#6c2d9026 channel:InputChannel topic_id:int pinned:Bool = Updates;
|
||||
channels.deleteTopicHistory#34435f2d channel:InputChannel top_msg_id:int = messages.AffectedHistory;
|
||||
channels.reorderPinnedForumTopics#2950a18f flags:# force:flags.0?true channel:InputChannel order:Vector<int> = Updates;
|
||||
|
||||
bots.sendCustomRequest#aa2769ed custom_method:string params:DataJSON = DataJSON;
|
||||
bots.answerWebhookJSONQuery#e6213f4d query_id:long data:DataJSON = Bool;
|
||||
|
@ -1958,4 +1960,4 @@ stats.getMegagroupStats#dcdf8607 flags:# dark:flags.0?true channel:InputChannel
|
|||
stats.getMessagePublicForwards#5630281b channel:InputChannel msg_id:int offset_rate:int offset_peer:InputPeer offset_id:int limit:int = messages.Messages;
|
||||
stats.getMessageStats#b6e0a3f5 flags:# dark:flags.0?true channel:InputChannel msg_id:int = stats.MessageStats;
|
||||
|
||||
// LAYER 148
|
||||
// LAYER 149
|
||||
|
|
|
@ -2297,19 +2297,19 @@ void Updates::feedUpdate(const MTPUpdate &update) {
|
|||
const auto &d = update.c_updateChannelPinnedTopic();
|
||||
const auto peerId = peerFromChannel(d.vchannel_id());
|
||||
if (const auto peer = session().data().peerLoaded(peerId)) {
|
||||
const auto rootId = d.vtopic_id().value_or_empty();
|
||||
const auto rootId = d.vtopic_id().v;
|
||||
if (const auto topic = peer->forumTopicFor(rootId)) {
|
||||
session().data().setChatPinned(topic, 0, true);
|
||||
session().data().setChatPinned(topic, 0, d.is_pinned());
|
||||
} else if (const auto forum = peer->forum()) {
|
||||
if (rootId) {
|
||||
forum->requestTopic(rootId);
|
||||
} else {
|
||||
forum->unpinTopic();
|
||||
}
|
||||
forum->requestTopic(rootId);
|
||||
}
|
||||
}
|
||||
} break;
|
||||
|
||||
case mtpc_updateChannelPinnedTopics: {
|
||||
const auto &d = update.c_updateChannelPinnedTopics();
|
||||
} break;
|
||||
|
||||
// Pinned message.
|
||||
case mtpc_updatePinnedMessages: {
|
||||
const auto &d = update.c_updatePinnedMessages();
|
||||
|
|
|
@ -37,13 +37,14 @@ constexpr auto kTopicsFirstLoad = 20;
|
|||
constexpr auto kLoadedTopicsMinCount = 20;
|
||||
constexpr auto kTopicsPerPage = 500;
|
||||
constexpr auto kStalePerRequest = 100;
|
||||
constexpr auto kPinnedLimit = 5;
|
||||
// constexpr auto kGeneralColorId = 0xA9A9A9;
|
||||
|
||||
} // namespace
|
||||
|
||||
Forum::Forum(not_null<History*> history)
|
||||
: _history(history)
|
||||
, _topicsList(&session(), FilterId(0), rpl::single(1)) {
|
||||
, _topicsList(&session(), FilterId(0), rpl::single(kPinnedLimit)) {
|
||||
Expects(_history->peer->isChannel());
|
||||
|
||||
if (_history->inChatList()) {
|
||||
|
@ -95,13 +96,6 @@ not_null<Dialogs::MainList*> Forum::topicsList() {
|
|||
return &_topicsList;
|
||||
}
|
||||
|
||||
void Forum::unpinTopic() {
|
||||
const auto list = _topicsList.pinned();
|
||||
while (!list->order().empty()) {
|
||||
list->setPinned(list->order().front(), false);
|
||||
}
|
||||
}
|
||||
|
||||
rpl::producer<> Forum::destroyed() const {
|
||||
return channel()->flagsValue(
|
||||
) | rpl::filter([=](const ChannelData::Flags::Change &update) {
|
||||
|
@ -147,9 +141,12 @@ void Forum::requestTopics() {
|
|||
MTP_int(_offset.topicId),
|
||||
MTP_int(loadCount)
|
||||
)).done([=](const MTPmessages_ForumTopics &result) {
|
||||
const auto previousOffset = _offset;
|
||||
applyReceivedTopics(result, _offset);
|
||||
const auto &list = result.data().vtopics().v;
|
||||
if (list.isEmpty() || list.size() == result.data().vcount().v) {
|
||||
if (list.isEmpty()
|
||||
|| list.size() == result.data().vcount().v
|
||||
|| (_offset == previousOffset)) {
|
||||
_topicsList.setLoaded();
|
||||
}
|
||||
_requestId = 0;
|
||||
|
|
|
@ -53,7 +53,6 @@ public:
|
|||
void requestTopics();
|
||||
[[nodiscard]] rpl::producer<> chatsListChanges() const;
|
||||
[[nodiscard]] rpl::producer<> chatsListLoadedEvents() const;
|
||||
void unpinTopic();
|
||||
|
||||
void requestTopic(MsgId rootId, Fn<void()> done = nullptr);
|
||||
ForumTopic *applyTopicAdded(
|
||||
|
|
|
@ -1921,9 +1921,6 @@ void Session::setChatPinned(
|
|||
const auto list = (filterId
|
||||
? chatsFilters().chatsList(filterId)
|
||||
: chatsListFor(key.entry()))->pinned();
|
||||
if (const auto topic = key.topic()) {
|
||||
topic->forum()->unpinTopic();
|
||||
}
|
||||
list->setPinned(key, pinned);
|
||||
notifyPinnedDialogsOrderUpdated();
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue