Update API scheme on layer 216.

This commit is contained in:
John Preston
2025-09-19 11:42:26 +04:00
parent b3ee80e495
commit 939045d606
7 changed files with 78 additions and 1 deletions

View File

@@ -1835,6 +1835,14 @@ ServiceAction ParseServiceAction(
? State::Hangup
: State::Invitation;
result.content = content;
}, [&](const MTPDmessageActionSuggestBirthday &data) {
auto content = ActionSuggestBirthday();
const auto &fields = data.vbirthday().data();
content.birthday = Birthday(
fields.vday().v,
fields.vmonth().v,
fields.vyear().value_or_empty());
result.content = content;
}, [](const MTPDmessageActionEmpty &data) {});
return result;
}

View File

@@ -11,6 +11,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "base/optional.h"
#include "base/variant.h"
#include "core/credits_amount.h"
#include "data/data_birthday.h"
#include "data/data_peer_id.h"
#include <QtCore/QSize>
@@ -45,6 +46,8 @@ inline auto NumberToString(Type value, int length = 0, char filler = '0')
filler).replace(',', '.');
}
using Birthday = ::Data::Birthday;
struct TextPart {
enum class Type {
Text,
@@ -720,6 +723,10 @@ struct ActionSuggestedPostRefund {
bool payerInitiated = false;
};
struct ActionSuggestBirthday {
Birthday birthday;
};
struct ServiceAction {
std::variant<
v::null_t,
@@ -772,7 +779,8 @@ struct ServiceAction {
ActionTodoAppendTasks,
ActionSuggestedPostApproval,
ActionSuggestedPostSuccess,
ActionSuggestedPostRefund> content;
ActionSuggestedPostRefund,
ActionSuggestBirthday> content;
};
ServiceAction ParseServiceAction(

View File

@@ -1475,6 +1475,29 @@ auto HtmlWriter::Wrap::pushMessage(
return QByteArray() + (data.payerInitiated
? "The user refunded the payment, post was deleted."
: "The admin deleted the post early, the payment was refunded.");
}, [&](const ActionSuggestBirthday &data) {
return serviceFrom
+ " suggests to add a date of birth: "
+ QByteArray::number(data.birthday.day())
+ [&] {
switch (data.birthday.month()) {
case 1: return " January";
case 2: return " February";
case 3: return " March";
case 4: return " April";
case 5: return " May";
case 6: return " June";
case 7: return " July";
case 8: return " August";
case 9: return " September";
case 10: return " October";
case 11: return " November";
case 12: return " December";
}
return "";
}() + (data.birthday.year()
? (' ' + QByteArray::number(data.birthday.year()))
: QByteArray());
}, [](v::null_t) { return QByteArray(); });
if (!serviceText.isEmpty()) {

View File

@@ -735,6 +735,14 @@ QByteArray SerializeMessage(
pushActor();
pushAction("suggested_post_refund");
push("user_initiated", data.payerInitiated);
}, [&](const ActionSuggestBirthday &data) {
pushActor();
pushAction("suggest_birthday");
push("day", data.birthday.day());
push("month", data.birthday.month());
if (const auto year = data.birthday.year()) {
push("year", year);
}
}, [](v::null_t) {});
if (v::is_null(message.action.content)) {