2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 14:38:15 +00:00

Update API scheme on layer 148.

This commit is contained in:
John Preston
2022-10-04 08:55:43 +04:00
parent 001c46f68a
commit d15173e09d
9 changed files with 34 additions and 20 deletions

View File

@@ -85,6 +85,7 @@ void UnreadThings::requestMentions(not_null<History*> history, int loaded) {
if (_mentionsRequests.contains(history)) {
return;
}
const auto topMsgId = 0;
const auto offsetId = std::max(
history->unreadMentions().maxLoaded(),
MsgId(1));
@@ -93,7 +94,9 @@ void UnreadThings::requestMentions(not_null<History*> history, int loaded) {
const auto maxId = 0;
const auto minId = 0;
const auto requestId = _api->request(MTPmessages_GetUnreadMentions(
MTP_flags(0),
history->peer->input,
MTP_int(topMsgId),
MTP_int(offsetId),
MTP_int(addOffset),
MTP_int(limit),
@@ -112,6 +115,7 @@ void UnreadThings::requestReactions(not_null<History*> history, int loaded) {
if (_reactionsRequests.contains(history)) {
return;
}
const auto topMsgId = 0;
const auto offsetId = loaded
? std::max(history->unreadReactions().maxLoaded(), MsgId(1))
: MsgId(1);
@@ -120,7 +124,9 @@ void UnreadThings::requestReactions(not_null<History*> history, int loaded) {
const auto maxId = 0;
const auto minId = 0;
const auto requestId = _api->request(MTPmessages_GetUnreadReactions(
MTP_flags(0),
history->peer->input,
MTP_int(topMsgId),
MTP_int(offsetId),
MTP_int(addOffset),
MTP_int(limit),

View File

@@ -2428,8 +2428,7 @@ void ApiWrap::refreshFileReference(
MTP_string(Data::CloudThemes::Format()),
MTP_inputTheme(
MTP_long(data.themeId),
MTP_long(data.accessHash)),
MTP_long(0)));
MTP_long(data.accessHash))));
}, [&](Data::FileOriginRingtones data) {
request(MTPaccount_GetSavedRingtones(MTP_long(0)));
}, [&](Data::FileOriginPremiumPreviews data) {

View File

@@ -62,7 +62,8 @@ PeerId GenerateUser(not_null<History*> history, const QString &name) {
MTPVector<MTPRestrictionReason>(), // restrictions
MTPstring(), // bot placeholder
MTPstring(), // lang code
MTPEmojiStatus()));
MTPEmojiStatus(),
MTPVector<MTPUsername>()));
return peerId;
}

View File

@@ -188,8 +188,7 @@ void CloudThemes::reloadCurrent() {
const auto &fields = Window::Theme::Background()->themeObject().cloud;
_session->api().request(MTPaccount_GetTheme(
MTP_string(Format()),
MTP_inputTheme(MTP_long(fields.id), MTP_long(fields.accessHash)),
MTP_long(fields.documentId)
MTP_inputTheme(MTP_long(fields.id), MTP_long(fields.accessHash))
)).done([=](const MTPTheme &result) {
applyUpdate(result);
}).fail([=] {
@@ -218,8 +217,7 @@ void CloudThemes::resolve(
_session->api().request(_resolveRequestId).cancel();
_resolveRequestId = _session->api().request(MTPaccount_GetTheme(
MTP_string(Format()),
MTP_inputThemeSlug(MTP_string(slug)),
MTP_long(0)
MTP_inputThemeSlug(MTP_string(slug))
)).done([=](const MTPTheme &result) {
showPreview(controller, result);
}).fail([=](const MTP::Error &error) {

View File

@@ -3932,7 +3932,8 @@ void Session::serviceNotification(
MTPVector<MTPRestrictionReason>(),
MTPstring(), // bot_inline_placeholder
MTPstring(), // lang_code
MTPEmojiStatus()));
MTPEmojiStatus(),
MTPVector<MTPUsername>()));
}
const auto history = this->history(PeerData::kServiceNotificationsId);
if (!history->folderKnown()) {

View File

@@ -170,7 +170,8 @@ void Account::createSession(
MTPVector<MTPRestrictionReason>(),
MTPstring(), // bot_inline_placeholder
MTPstring(), // lang_code
MTPEmojiStatus()),
MTPEmojiStatus(),
MTPVector<MTPUsername>()),
serialized,
streamVersion,
std::move(settings));

View File

@@ -187,10 +187,13 @@ void SetupReadAllMenu(
void SetupUnreadMentionsMenu(
not_null<Ui::RpWidget*> button,
Fn<PeerData*()> currentPeer) {
const auto topMsgId = 0;
const auto text = tr::lng_context_mark_read_mentions_all(tr::now);
const auto sendRequest = [=](not_null<PeerData*> peer, Fn<void()> done) {
peer->session().api().request(MTPmessages_ReadMentions(
peer->input
MTP_flags(0),
peer->input,
MTP_int(topMsgId)
)).done([=](const MTPmessages_AffectedHistory &result) {
done();
peer->session().api().applyAffectedHistory(peer, result);

View File

@@ -738,8 +738,7 @@ void SaveTheme(
if (cloud.id) {
window->account().session().api().request(MTPaccount_GetTheme(
MTP_string(Data::CloudThemes::Format()),
MTP_inputTheme(MTP_long(cloud.id), MTP_long(cloud.accessHash)),
MTP_long(0)
MTP_inputTheme(MTP_long(cloud.id), MTP_long(cloud.accessHash))
)).done([=](const MTPTheme &result) {
result.match([&](const MTPDtheme &data) {
save(CloudTheme::Parse(&window->account().session(), data));