| 204 | } |
| 205 | |
| 206 | rpl::producer<rpl::no_value, QString> Statistics::request() { |
| 207 | return [=](auto consumer) { |
| 208 | auto lifetime = rpl::lifetime(); |
| 209 | |
| 210 | if (!channel()->isMegagroup()) { |
| 211 | makeRequest(MTPstats_GetBroadcastStats( |
| 212 | MTP_flags(MTPstats_GetBroadcastStats::Flags(0)), |
| 213 | channel()->inputChannel() |
| 214 | )).done([=](const MTPstats_BroadcastStats &result) { |
| 215 | _channelStats = ChannelStatisticsFromTL(result.data()); |
| 216 | consumer.put_done(); |
| 217 | }).fail([=](const MTP::Error &error) { |
| 218 | consumer.put_error_copy(error.type()); |
| 219 | }).send(); |
| 220 | } else { |
| 221 | makeRequest(MTPstats_GetMegagroupStats( |
| 222 | MTP_flags(MTPstats_GetMegagroupStats::Flags(0)), |
| 223 | channel()->inputChannel() |
| 224 | )).done([=](const MTPstats_MegagroupStats &result) { |
| 225 | const auto &data = result.data(); |
| 226 | _supergroupStats = SupergroupStatisticsFromTL(data); |
| 227 | channel()->owner().processUsers(data.vusers()); |
| 228 | consumer.put_done(); |
| 229 | }).fail([=](const MTP::Error &error) { |
| 230 | consumer.put_error_copy(error.type()); |
| 231 | }).send(); |
| 232 | } |
| 233 | |
| 234 | return lifetime; |
| 235 | }; |
| 236 | } |
| 237 | |
| 238 | Statistics::GraphResult Statistics::requestZoom( |
| 239 | const QString &token, |
no test coverage detected