Add country_code to getTermsOfService.

GitOrigin-RevId: 35480bdb801373122d7e0536b30becb45c312db4
This commit is contained in:
levlam 2018-05-25 11:49:00 +03:00
parent 266722112e
commit 3631815cc6
7 changed files with 16 additions and 12 deletions

View File

@ -3155,8 +3155,8 @@ getCountryCode = Text;
//@description Returns the default text for invitation messages to be used as a placeholder when the current user invites friends to Telegram
getInviteText = Text;
//@description Returns the terms of service. Can be called before authorization
getTermsOfService = Text;
//@description Returns the terms of service. Can be called before authorization @country_code A two-letter ISO 3166-1 alpha-2 country code of user's country
getTermsOfService country_code:string = Text;
//@description Returns information about a tg:// deep link. Use "tg://need_update_for_some_feature" or "tg:some_unsupported_feature" for testing. Returns a 404 error for unknown links. Can be called before authorization @link The link
getDeepLinkInfo link:string = DeepLinkInfo;

Binary file not shown.

View File

@ -1095,7 +1095,7 @@ help.saveAppLog#6f02f748 events:Vector<InputAppEvent> = Bool;
help.getInviteText#4d392343 = help.InviteText;
help.getSupport#9cdf08cd = help.Support;
help.getAppChangelog#9010ef6f prev_app_version:string = Updates;
help.getTermsOfService#fa796a44 country_iso2:string lang_code:string = help.TermsOfService;
help.getTermsOfService#8e59b7e7 country_iso2:string = help.TermsOfService;
help.setBotUpdatesStatus#ec22cfcd pending_updates_count:int message:string = Bool;
help.getCdnConfig#52029342 = CdnConfig;
help.getRecentMeUrls#3dc0f114 referer:string = help.RecentMeUrls;

Binary file not shown.

View File

@ -440,9 +440,9 @@ class GetTermsOfServiceQuery : public Td::ResultHandler {
explicit GetTermsOfServiceQuery(Promise<string> &&promise) : promise_(std::move(promise)) {
}
void send() {
send_query(G()->net_query_creator().create(create_storer(telegram_api::help_getTermsOfService()), DcId::main(),
NetQuery::Type::Common, NetQuery::AuthFlag::Off));
void send(const string &country_code) {
send_query(G()->net_query_creator().create(create_storer(telegram_api::help_getTermsOfService(country_code)),
DcId::main(), NetQuery::Type::Common, NetQuery::AuthFlag::Off));
}
void on_result(uint64 id, BufferSlice packet) override {
@ -3838,6 +3838,8 @@ class GetInviteTextRequest : public RequestActor<string> {
};
class GetTermsOfServiceRequest : public RequestActor<string> {
string country_code_;
string text_;
void do_run(Promise<string> &&promise) override {
@ -3846,7 +3848,7 @@ class GetTermsOfServiceRequest : public RequestActor<string> {
return;
}
td->create_handler<GetTermsOfServiceQuery>(std::move(promise))->send();
td->create_handler<GetTermsOfServiceQuery>(std::move(promise))->send(country_code_);
}
void do_set_result(string &&result) override {
@ -3858,7 +3860,8 @@ class GetTermsOfServiceRequest : public RequestActor<string> {
}
public:
GetTermsOfServiceRequest(ActorShared<Td> td, uint64 request_id) : RequestActor(std::move(td), request_id) {
GetTermsOfServiceRequest(ActorShared<Td> td, uint64 request_id, string country_code)
: RequestActor(std::move(td), request_id), country_code_(country_code) {
}
};
@ -7006,8 +7009,9 @@ void Td::on_request(uint64 id, const td_api::getInviteText &request) {
CREATE_NO_ARGS_REQUEST(GetInviteTextRequest);
}
void Td::on_request(uint64 id, const td_api::getTermsOfService &request) {
CREATE_NO_ARGS_REQUEST(GetTermsOfServiceRequest);
void Td::on_request(uint64 id, td_api::getTermsOfService &request) {
CLEAN_INPUT_STRING(request.country_code_);
CREATE_REQUEST(GetTermsOfServiceRequest, std::move(request.country_code_));
}
void Td::on_request(uint64 id, td_api::getDeepLinkInfo &request) {

View File

@ -811,7 +811,7 @@ class Td final : public NetQueryCallback {
void on_request(uint64 id, const td_api::getInviteText &request);
void on_request(uint64 id, const td_api::getTermsOfService &request);
void on_request(uint64 id, td_api::getTermsOfService &request);
void on_request(uint64 id, td_api::getDeepLinkInfo &request);

View File

@ -1718,7 +1718,7 @@ class CliClient final : public Actor {
} else if (op == "git") {
send_request(make_tl_object<td_api::getInviteText>());
} else if (op == "gtos") {
send_request(make_tl_object<td_api::getTermsOfService>());
send_request(make_tl_object<td_api::getTermsOfService>(args));
} else if (op == "gdli") {
send_request(make_tl_object<td_api::getDeepLinkInfo>(args));
} else if (op == "tme") {