2018-06-07 20:42:17 +02:00
|
|
|
//
|
2024-01-01 01:07:21 +01:00
|
|
|
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2024
|
2018-06-07 20:42:17 +02:00
|
|
|
//
|
|
|
|
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
|
|
|
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
|
|
|
//
|
|
|
|
#include "td/telegram/TermsOfService.h"
|
|
|
|
|
|
|
|
namespace td {
|
|
|
|
|
|
|
|
TermsOfService::TermsOfService(telegram_api::object_ptr<telegram_api::help_termsOfService> terms) {
|
|
|
|
if (terms == nullptr) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
id_ = std::move(terms->id_->data_);
|
2024-05-04 22:12:26 +02:00
|
|
|
text_ =
|
|
|
|
get_formatted_text(nullptr, std::move(terms->text_), std::move(terms->entities_), true, false, "TermsOfService");
|
2024-04-23 18:43:12 +02:00
|
|
|
if (text_.text.empty()) {
|
2018-06-07 20:42:17 +02:00
|
|
|
id_.clear();
|
|
|
|
}
|
2021-11-01 19:53:23 +01:00
|
|
|
min_user_age_ = terms->min_age_confirm_;
|
|
|
|
show_popup_ = terms->popup_;
|
2018-06-07 20:42:17 +02:00
|
|
|
}
|
|
|
|
|
2024-08-01 12:24:05 +02:00
|
|
|
td_api::object_ptr<td_api::termsOfService> TermsOfService::get_terms_of_service_object() const {
|
|
|
|
if (id_.empty()) {
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
return td_api::make_object<td_api::termsOfService>(get_formatted_text_object(nullptr, text_, true, -1), min_user_age_,
|
|
|
|
show_popup_);
|
|
|
|
}
|
|
|
|
|
2018-06-08 00:19:34 +02:00
|
|
|
} // namespace td
|