Add is_dark parameter to getChatStatisticsUrl.

GitOrigin-RevId: f2381e8df342efa288fa191df27a79a799f972e2
This commit is contained in:
levlam 2019-04-20 20:49:21 +03:00
parent d71f8e375e
commit 651172ed85
6 changed files with 13 additions and 9 deletions

View File

@ -3613,8 +3613,8 @@ changeChatReportSpamState chat_id:int53 is_spam_chat:Bool = Ok;
reportChat chat_id:int53 reason:ChatReportReason message_ids:vector<int53> = Ok;
//@description Returns URL with chat statistics. Currently this method can be used only for channels @chat_id Chat identifier @parameters Parameters from "tg://statsrefresh?params=******" link
getChatStatisticsUrl chat_id:int53 parameters:string = HttpUrl;
//@description Returns URL with the chat statistics. Currently this method can be used only for channels @chat_id Chat identifier @parameters Parameters from "tg://statsrefresh?params=******" link @is_dark Pass true if a URL with the dark theme must be returned
getChatStatisticsUrl chat_id:int53 parameters:string is_dark:Bool = HttpUrl;
//@description Returns storage usage statistics. Can be called before authorization @chat_limit Maximum number of chats with the largest storage usage for which separate statistics should be returned. All other chats will be grouped in entries with chat_id == 0. If the chat info database is not used, the chat_limit is ignored and is always set to 0

Binary file not shown.

View File

@ -3295,7 +3295,8 @@ class GetStatsUrlQuery : public Td::ResultHandler {
explicit GetStatsUrlQuery(Promise<td_api::object_ptr<td_api::httpUrl>> &&promise) : promise_(std::move(promise)) {
}
void send(DialogId dialog_id, const string &parameters) {
void send(DialogId dialog_id, const string &parameters, bool is_dark) {
// TODO use parameters and is_dark
dialog_id_ = dialog_id;
auto input_peer = td->messages_manager_->get_input_peer(dialog_id, AccessRights::Read);
CHECK(input_peer != nullptr);
@ -6278,7 +6279,7 @@ void MessagesManager::on_get_peer_settings(DialogId dialog_id,
on_dialog_updated(dialog_id, "can_report_spam");
}
void MessagesManager::get_dialog_statistics_url(DialogId dialog_id, const string &parameters,
void MessagesManager::get_dialog_statistics_url(DialogId dialog_id, const string &parameters, bool is_dark,
Promise<td_api::object_ptr<td_api::httpUrl>> &&promise) {
Dialog *d = get_dialog_force(dialog_id);
if (d == nullptr) {
@ -6292,7 +6293,7 @@ void MessagesManager::get_dialog_statistics_url(DialogId dialog_id, const string
return promise.set_error(Status::Error(500, "There is no statistics for secret chats"));
}
td_->create_handler<GetStatsUrlQuery>(std::move(promise))->send(dialog_id, parameters);
td_->create_handler<GetStatsUrlQuery>(std::move(promise))->send(dialog_id, parameters, is_dark);
}
void MessagesManager::load_secret_thumbnail(FileId thumbnail_file_id) {

View File

@ -638,7 +638,7 @@ class MessagesManager : public Actor {
void report_dialog(DialogId dialog_id, const tl_object_ptr<td_api::ChatReportReason> &reason,
const vector<MessageId> &message_ids, Promise<Unit> &&promise);
void get_dialog_statistics_url(DialogId dialog_id, const string &parameters,
void get_dialog_statistics_url(DialogId dialog_id, const string &parameters, bool is_dark,
Promise<td_api::object_ptr<td_api::httpUrl>> &&promise);
void on_get_peer_settings(DialogId dialog_id, tl_object_ptr<telegram_api::peerSettings> &&peer_settings);

View File

@ -6293,7 +6293,8 @@ void Td::on_request(uint64 id, td_api::getChatStatisticsUrl &request) {
CHECK_IS_USER();
CREATE_REQUEST_PROMISE();
CLEAN_INPUT_STRING(request.parameters_);
messages_manager_->get_dialog_statistics_url(DialogId(request.chat_id_), request.parameters_, std::move(promise));
messages_manager_->get_dialog_statistics_url(DialogId(request.chat_id_), request.parameters_, request.is_dark_,
std::move(promise));
}
void Td::on_request(uint64 id, td_api::setChatNotificationSettings &request) {

View File

@ -3548,9 +3548,11 @@ class CliClient final : public Actor {
} else if (op == "gcsu") {
string chat_id;
string parameters;
std::tie(chat_id, parameters) = split(args);
string is_dark;
std::tie(chat_id, args) = split(args);
std::tie(parameters, is_dark) = split(args);
send_request(td_api::make_object<td_api::getChatStatisticsUrl>(as_chat_id(args), parameters));
send_request(td_api::make_object<td_api::getChatStatisticsUrl>(as_chat_id(args), parameters, as_bool(is_dark)));
} else if (op == "rsgs" || op == "rchs") {
string supergroup_id;
string user_id;