Update API scheme on layer 145.

This commit is contained in:
John Preston 2022-08-19 15:38:11 +03:00
parent fa26afaf9a
commit f658cb7e99
6 changed files with 40 additions and 18 deletions

View File

@ -324,7 +324,7 @@ updateChannelMessageViews#f226ac08 channel_id:long id:int views:int = Update;
updateChatParticipantAdmin#d7ca61a2 chat_id:long user_id:long is_admin:Bool version:int = Update;
updateNewStickerSet#688a30aa stickerset:messages.StickerSet = Update;
updateStickerSetsOrder#bb2d201 flags:# masks:flags.0?true emojis:flags.1?true order:Vector<long> = Update;
updateStickerSets#43ae3dec = Update;
updateStickerSets#31c24808 flags:# masks:flags.0?true emojis:flags.1?true = Update;
updateSavedGifs#9375341e = Update;
updateBotInlineQuery#496f379c flags:# query_id:long user_id:long query:string geo:flags.0?GeoPoint peer_type:flags.1?InlineQueryPeerType offset:string = Update;
updateBotInlineSend#12f12a07 flags:# user_id:long query:string geo:flags.0?GeoPoint id:string msg_id:flags.1?InputBotInlineMessageID = Update;
@ -393,6 +393,7 @@ updateBotMenuButton#14b85813 bot_id:long button:BotMenuButton = Update;
updateSavedRingtones#74d8be99 = Update;
updateTranscribedAudio#84cd5a flags:# pending:flags.0?true peer:Peer msg_id:int transcription_id:long text:string = Update;
updateReadFeaturedEmojiStickers#fb4c496c = Update;
updateUserEmojiStatus#28373599 user_id:long emoji_status:EmojiStatus = Update;
updateRecentEmojiStatuses#30f443db = Update;
updates.state#a56c2a3e pts:int qts:int date:int seq:int unread_count:int = updates.State;
@ -1330,7 +1331,7 @@ messages.peerSettings#6880b94d settings:PeerSettings chats:Vector<Chat> users:Ve
auth.loggedOut#c3a2835f flags:# future_auth_token:flags.0?bytes = auth.LoggedOut;
reactionCount#2454adf0 flags:# chosen:flags.0?true reaction:Reaction count:int = ReactionCount;
reactionCount#a3d1cb80 flags:# chosen_order:flags.0?int reaction:Reaction count:int = ReactionCount;
messageReactions#4f2b9479 flags:# min:flags.0?true can_see_list:flags.2?true results:Vector<ReactionCount> recent_reactions:flags.1?Vector<MessagePeerReaction> = MessageReactions;
@ -1712,7 +1713,7 @@ messages.hideChatJoinRequest#7fe7e815 flags:# approved:flags.0?true peer:InputPe
messages.hideAllChatJoinRequests#e085f4ea flags:# approved:flags.0?true peer:InputPeer link:flags.1?string = Updates;
messages.toggleNoForwards#b11eafa2 peer:InputPeer enabled:Bool = Updates;
messages.saveDefaultSendAs#ccfddf96 peer:InputPeer send_as:InputPeer = Bool;
messages.sendReaction#5afe99b5 flags:# big:flags.1?true peer:InputPeer msg_id:int reaction:flags.0?Reaction = Updates;
messages.sendReaction#d30d78d4 flags:# big:flags.1?true peer:InputPeer msg_id:int reaction:flags.0?Vector<Reaction> = Updates;
messages.getMessagesReactions#8bba90e6 peer:InputPeer id:Vector<int> = Updates;
messages.getMessageReactionsList#461b3f48 flags:# peer:InputPeer id:int reaction:flags.0?Reaction offset:flags.1?string limit:int = messages.MessageReactionsList;
messages.setChatAvailableReactions#14050ea6 peer:InputPeer available_reactions:Vector<string> = Updates;
@ -1735,6 +1736,7 @@ messages.rateTranscribedAudio#7f1d072f peer:InputPeer msg_id:int transcription_i
messages.getCustomEmojiDocuments#d9ab0f54 document_id:Vector<long> = Vector<Document>;
messages.getEmojiStickers#fbfca18f hash:long = messages.AllStickers;
messages.getFeaturedEmojiStickers#ecf6736 hash:long = messages.FeaturedStickers;
messages.reportReaction#61422a48 peer:InputPeer id:int user_id:InputUser = Bool;
updates.getState#edd4882a = updates.State;
updates.getDifference#25939651 flags:# pts:int pts_total_limit:flags.0?int date:int qts:int = updates.Difference;
@ -1841,7 +1843,6 @@ payments.exportInvoice#f91b065 invoice_media:InputMedia = payments.ExportedInvoi
payments.assignAppStoreTransaction#80ed747d receipt:bytes purpose:InputStorePaymentPurpose = Updates;
payments.assignPlayMarketTransaction#dffd50d3 receipt:DataJSON purpose:InputStorePaymentPurpose = Updates;
payments.canPurchasePremium#9fc19eb6 purpose:InputStorePaymentPurpose = Bool;
payments.requestRecurringPayment#146e958d user_id:InputUser recurring_init_charge:string invoice_media:InputMedia = Updates;
stickers.createStickerSet#9021ab67 flags:# masks:flags.0?true animated:flags.1?true videos:flags.4?true user_id:InputUser title:string short_name:string thumb:flags.2?InputDocument stickers:Vector<InputStickerSetItem> software:flags.3?string = messages.StickerSet;
stickers.removeStickerFromSet#f7760f51 sticker:InputDocument = messages.StickerSet;

View File

@ -2345,11 +2345,17 @@ void Updates::feedUpdate(const MTPUpdate &update) {
} break;
case mtpc_updateStickerSets: {
// Can't determine is it masks or stickers, so update both.
session().data().stickers().setLastUpdate(0);
session().api().updateStickers();
session().data().stickers().setLastMasksUpdate(0);
session().api().updateMasks();
const auto &d = update.c_updateStickerSets();
if (d.is_emojis()) {
session().data().stickers().setLastEmojiUpdate(0);
session().api().updateCustomEmoji();
} else if (d.is_masks()) {
session().data().stickers().setLastMasksUpdate(0);
session().api().updateMasks();
} else {
session().data().stickers().setLastUpdate(0);
session().api().updateStickers();
}
} break;
case mtpc_updateRecentStickers: {
@ -2370,6 +2376,17 @@ void Updates::feedUpdate(const MTPUpdate &update) {
session().api().updateStickers();
} break;
case mtpc_updateReadFeaturedEmojiStickers: {
// We don't track read status of them for now.
} break;
case mtpc_updateUserEmojiStatus: {
const auto &d = update.c_updateUserEmojiStatus();
if (const auto user = session().data().userLoaded(d.vuser_id())) {
user->setEmojiStatus(d.vemoji_status());
}
} break;
////// Cloud saved GIFs
case mtpc_updateSavedGifs: {
session().data().stickers().setLastSavedGifsUpdate(0);

View File

@ -399,7 +399,7 @@ void Reactions::send(not_null<HistoryItem*> item, const ReactionId &chosen) {
MTP_flags(flags),
item->history()->peer->input,
MTP_int(id.msg),
ReactionToMTP(chosen)
MTP_vector<MTPReaction>(1, ReactionToMTP(chosen))
)).done([=](const MTPUpdates &result) {
_sentRequests.remove(id);
_owner->session().api().applyUpdates(result);
@ -640,10 +640,10 @@ bool MessageReactions::change(
count.match([&](const MTPDreactionCount &data) {
const auto reaction = ReactionFromMTP(data.vreaction());
if (!ignoreChosen) {
if (data.is_chosen() && _chosen != reaction) {
if (data.vchosen_order() && _chosen != reaction) {
_chosen = reaction;
changed = true;
} else if (!data.is_chosen() && _chosen == reaction) {
} else if (!data.vchosen_order() && _chosen == reaction) {
_chosen = ReactionId();
changed = true;
}

View File

@ -555,12 +555,7 @@ not_null<UserData*> Session::processUser(const MTPUser &data) {
status = data.vstatus();
}
if (const auto &status = data.vemoji_status()) {
result->setEmojiStatus(status->match([&](
const MTPDemojiStatus &data) {
return DocumentId(data.vdocument_id().v);
}, [&](const MTPDemojiStatusEmpty &) {
return DocumentId();
}));
result->setEmojiStatus(*status);
} else {
result->setEmojiStatus(0);
}

View File

@ -57,6 +57,14 @@ void UserData::setPhoto(const MTPUserProfilePhoto &photo) {
});
}
void UserData::setEmojiStatus(const MTPEmojiStatus &status) {
setEmojiStatus(status.match([&](const MTPDemojiStatus &data) {
return DocumentId(data.vdocument_id().v);
}, [&](const MTPDemojiStatusEmpty &) {
return DocumentId();
}));
}
void UserData::setEmojiStatus(DocumentId emojiStatusId) {
if (_emojiStatusId != emojiStatusId) {
_emojiStatusId = emojiStatusId;

View File

@ -64,6 +64,7 @@ public:
UserData(not_null<Data::Session*> owner, PeerId id);
void setPhoto(const MTPUserProfilePhoto &photo);
void setEmojiStatus(const MTPEmojiStatus &status);
void setName(
const QString &newFirstName,