Add web_app_data messages.

This commit is contained in:
levlam 2022-03-28 17:15:39 +03:00
parent 3252809448
commit c278251d8f
2 changed files with 24 additions and 0 deletions

View File

@ -1456,6 +1456,20 @@ class Client::JsonPassportData final : public Jsonable {
const Client *client_; const Client *client_;
}; };
class Client::JsonWebAppData final : public Jsonable {
public:
explicit JsonWebAppData(const td_api::messageWebAppDataReceived *web_app_data) : web_app_data_(web_app_data) {
}
void store(JsonValueScope *scope) const {
auto object = scope->enter_object();
object("button_text", web_app_data_->button_text_);
object("data", web_app_data_->data_);
}
private:
const td_api::messageWebAppDataReceived *web_app_data_;
};
class Client::JsonProximityAlertTriggered final : public Jsonable { class Client::JsonProximityAlertTriggered final : public Jsonable {
public: public:
JsonProximityAlertTriggered(const td_api::messageProximityAlertTriggered *proximity_alert_triggered, JsonProximityAlertTriggered(const td_api::messageProximityAlertTriggered *proximity_alert_triggered,
@ -1974,6 +1988,13 @@ void Client::JsonMessage::store(JsonValueScope *scope) const {
object("voice_chat_participants_invited", JsonInviteVideoChatParticipants(content, client_)); object("voice_chat_participants_invited", JsonInviteVideoChatParticipants(content, client_));
break; break;
} }
case td_api::messageWebAppDataSent::ID:
break;
case td_api::messageWebAppDataReceived::ID: {
auto content = static_cast<const td_api::messageWebAppDataReceived *>(message_->content.get());
object("web_app_data", JsonWebAppData(content));
break;
}
default: default:
UNREACHABLE(); UNREACHABLE();
} }
@ -9394,6 +9415,8 @@ bool Client::need_skip_update_message(int64 chat_id, const object_ptr<td_api::me
return true; return true;
case td_api::messageChatSetTheme::ID: case td_api::messageChatSetTheme::ID:
return true; return true;
case td_api::messageWebAppDataSent::ID:
return true;
default: default:
break; break;
} }

View File

@ -146,6 +146,7 @@ class Client final : public WebhookActor::Callback {
class JsonEncryptedPassportElement; class JsonEncryptedPassportElement;
class JsonEncryptedCredentials; class JsonEncryptedCredentials;
class JsonPassportData; class JsonPassportData;
class JsonWebAppData;
class JsonProximityAlertTriggered; class JsonProximityAlertTriggered;
class JsonVideoChatScheduled; class JsonVideoChatScheduled;
class JsonVideoChatStarted; class JsonVideoChatStarted;