Support pageBlockKicker.

GitOrigin-RevId: c2eb81a7041b62ddc2214eb3e9bfcbf87a4f2818
This commit is contained in:
levlam 2019-02-06 03:50:38 +03:00
parent c6bbc4265e
commit 13b54369b7
4 changed files with 44 additions and 1 deletions

View File

@ -726,6 +726,9 @@ pageBlockHeader header:RichText = PageBlock;
//@description A subheader @subheader Subheader
pageBlockSubheader subheader:RichText = PageBlock;
//@description A kicker @kicker Kicker
pageBlockKicker kicker:RichText = PageBlock;
//@description A text paragraph @text Paragraph text
pageBlockParagraph text:RichText = PageBlock;

Binary file not shown.

View File

@ -502,7 +502,8 @@ class WebPagesManager::PageBlock {
Collage,
Slideshow,
ChatLink,
Audio
Audio,
Kicker
};
virtual Type get_type() const = 0;
@ -719,6 +720,38 @@ class WebPagesManager::PageBlockSubheader : public PageBlock {
}
};
class WebPagesManager::PageBlockKicker : public PageBlock {
RichText kicker;
public:
PageBlockKicker() = default;
explicit PageBlockKicker(RichText &&kicker) : kicker(std::move(kicker)) {
}
Type get_type() const override {
return Type::Kicker;
}
void append_file_ids(vector<FileId> &file_ids) const override {
append_rich_text_file_ids(kicker, file_ids);
}
tl_object_ptr<td_api::PageBlock> get_page_block_object() const override {
return make_tl_object<td_api::pageBlockKicker>(get_rich_text_object(kicker));
}
template <class T>
void store(T &storer) const {
using ::td::store;
store(kicker, storer);
}
template <class T>
void parse(T &parser) {
using ::td::parse;
parse(kicker, parser);
}
};
class WebPagesManager::PageBlockParagraph : public PageBlock {
RichText text;
@ -1541,6 +1574,8 @@ void WebPagesManager::PageBlock::call_impl(Type type, const PageBlock *ptr, F &&
return f(static_cast<const WebPagesManager::PageBlockHeader *>(ptr));
case Type::Subheader:
return f(static_cast<const WebPagesManager::PageBlockSubheader *>(ptr));
case Type::Kicker:
return f(static_cast<const WebPagesManager::PageBlockKicker *>(ptr));
case Type::Paragraph:
return f(static_cast<const WebPagesManager::PageBlockParagraph *>(ptr));
case Type::Preformatted:
@ -2613,6 +2648,10 @@ unique_ptr<WebPagesManager::PageBlock> WebPagesManager::get_page_block(
auto page_block = move_tl_object_as<telegram_api::pageBlockSubheader>(page_block_ptr);
return make_unique<PageBlockSubheader>(get_rich_text(std::move(page_block->text_), documents));
}
case telegram_api::pageBlockKicker::ID: {
auto page_block = move_tl_object_as<telegram_api::pageBlockKicker>(page_block_ptr);
return make_unique<PageBlockKicker>(get_rich_text(std::move(page_block->text_), documents));
}
case telegram_api::pageBlockParagraph::ID: {
auto page_block = move_tl_object_as<telegram_api::pageBlockParagraph>(page_block_ptr);
return make_unique<PageBlockParagraph>(get_rich_text(std::move(page_block->text_), documents));

View File

@ -108,6 +108,7 @@ class WebPagesManager : public Actor {
class PageBlockAuthorDate;
class PageBlockHeader;
class PageBlockSubheader;
class PageBlockKicker;
class PageBlockParagraph;
class PageBlockPreformatted;
class PageBlockFooter;