Update layer to 89.

GitOrigin-RevId: acdaebced325dd66a169264621567b17dd42762c
This commit is contained in:
levlam 2019-02-07 23:25:27 +03:00
parent de7befcbd2
commit bf9842bff1
6 changed files with 80 additions and 12 deletions

View File

@ -701,6 +701,9 @@ richTextPhoneNumber text:RichText phone_number:string = RichText;
//@height Height of a bounding box in which the image should be shown, 0 if unknown
richTextIcon document:document width:int32 height:int32 = RichText;
//@description A rich text anchor @text Text @name Anchor name
richTextAnchor text:RichText name:string = RichText;
//@description A concatenation of rich texts @texts Texts
richTexts texts:vector<RichText> = RichText;
@ -738,8 +741,9 @@ pageBlockVerticalAlignmentBottom = PageBlockVerticalAlignment;
//@align Horizontal cell content alignment @valign Vertical cell content alignment
pageBlockTableCell text:RichText is_header:Bool colspan:int32 rowspan:int32 align:PageBlockHorizontalAlignment valign:PageBlockVerticalAlignment = PageBlockTableCell;
//@description Contains information about a related article @url Related article URL @title Article title; can be empty @param_description Article description, can be empty @photo Article photo; may be null
pageBlockRelatedArticle url:string title:string description:string photo:photo = PageBlockRelatedArticle;
//@description Contains information about a related article @url Related article URL @title Article title; can be empty @param_description Article description, can be empty
//@photo Article photo; may be null @author Article author, can be empty @published_date Article publish date; 0 if unknown
pageBlockRelatedArticle url:string title:string description:string photo:photo author:string published_date:int32 = PageBlockRelatedArticle;
//@class PageBlock @description Describes a block of an instant view web page
@ -829,9 +833,11 @@ pageBlockRelatedArticles header:RichText articles:vector<pageBlockRelatedArticle
pageBlockMap location:location zoom:int32 width:int32 height:int32 caption:pageBlockCaption = PageBlock;
//@description Describes an instant view page for a web page @page_blocks Content of the web page @is_rtl True, if the instant view must be shown from right to left
//@description Describes an instant view page for a web page @page_blocks Content of the web page
//@url Instant view URL; may be different from WebPage.url and must be used for the correct anchors handling
//@is_rtl True, if the instant view must be shown from right to left
//@is_full True, if the instant view contains the full page. A network request might be needed to get the full web page instant view
webPageInstantView page_blocks:vector<PageBlock> is_rtl:Bool is_full:Bool = WebPageInstantView;
webPageInstantView page_blocks:vector<PageBlock> url:string is_rtl:Bool is_full:Bool = WebPageInstantView;
//@description Describes a web page preview @url Original URL of the link @display_url URL to display

Binary file not shown.

View File

@ -682,6 +682,7 @@ textSuperscript#c7fb5e01 text:RichText = RichText;
textMarked#34b8621 text:RichText = RichText;
textPhone#1ccb966a text:RichText phone:string = RichText;
textImage#81ccf4f document_id:long w:int h:int = RichText;
textAnchor#35553762 text:RichText name:string = RichText;
pageBlockUnsupported#13567e8a = PageBlock;
pageBlockTitle#70abc3fd text:RichText = PageBlock;
@ -792,7 +793,7 @@ langPackStringDeleted#2979eeb2 key:string = LangPackString;
langPackDifference#f385c1f6 lang_code:string from_version:int version:int strings:Vector<LangPackString> = LangPackDifference;
langPackLanguage#651b98d flags:# official:flags.0?true rtl:flags.2?true beta:flags.3?true name:string native_name:string lang_code:string base_lang_code:flags.1?string plural_code:string strings_count:int translated_count:int = LangPackLanguage;
langPackLanguage#eeca5ce3 flags:# official:flags.0?true rtl:flags.2?true beta:flags.3?true name:string native_name:string lang_code:string base_lang_code:flags.1?string plural_code:string strings_count:int translated_count:int translations_url:string = LangPackLanguage;
channelAdminRights#5d7ceba5 flags:# change_info:flags.0?true post_messages:flags.1?true edit_messages:flags.2?true delete_messages:flags.3?true ban_users:flags.4?true invite_users:flags.5?true invite_link:flags.6?true pin_messages:flags.7?true add_admins:flags.9?true = ChannelAdminRights;
@ -956,9 +957,14 @@ pageListItemBlocks#25e073fc blocks:Vector<PageBlock> = PageListItem;
pageListOrderedItemText#5e068047 num:string text:RichText = PageListOrderedItem;
pageListOrderedItemBlocks#98dd8936 num:string blocks:Vector<PageBlock> = PageListOrderedItem;
pageRelatedArticle#f186f93c flags:# url:string webpage_id:long title:flags.0?string description:flags.1?string photo_id:flags.2?long = PageRelatedArticle;
pageRelatedArticle#b390dc08 flags:# url:string webpage_id:long title:flags.0?string description:flags.1?string photo_id:flags.2?long author:flags.3?string published_date:flags.4?int = PageRelatedArticle;
page#f199a0a8 flags:# part:flags.0?true rtl:flags.1?true v2:flags.2?true blocks:Vector<PageBlock> photos:Vector<Photo> documents:Vector<Document> = Page;
page#ae891bec flags:# part:flags.0?true rtl:flags.1?true v2:flags.2?true url:string blocks:Vector<PageBlock> photos:Vector<Photo> documents:Vector<Document> = Page;
help.supportName#8c05f1c9 name:string = help.SupportName;
help.userInfoEmpty#f3ae2eed = help.UserInfo;
help.userInfo#1eb3758 message:string entities:Vector<MessageEntity> author:string date:int = help.UserInfo;
---functions---
@ -1028,6 +1034,9 @@ account.sendVerifyEmailCode#7011509f email:string = account.SentEmailCode;
account.verifyEmail#ecba39db email:string code:string = Bool;
account.initTakeoutSession#f05b4804 flags:# contacts:flags.0?true message_users:flags.1?true message_chats:flags.2?true message_megagroups:flags.3?true message_channels:flags.4?true files:flags.5?true file_max_size:flags.5?int = account.Takeout;
account.finishTakeoutSession#1d2652ee flags:# success:flags.0?true = Bool;
account.confirmPasswordEmail#8fdf1920 code:string = Bool;
account.resendPasswordEmail#7a7f2a15 = Bool;
account.cancelPasswordEmail#c1cbd5b6 = Bool;
users.getUsers#d91a548 id:Vector<InputUser> = Vector<User>;
users.getFullUser#ca30a5b1 id:InputUser = UserFull;
@ -1187,6 +1196,9 @@ help.getDeepLinkInfo#3fedc75f path:string = help.DeepLinkInfo;
help.getAppConfig#98914110 = JSONValue;
help.saveAppLog#6f02f748 events:Vector<InputAppEvent> = Bool;
help.getPassportConfig#c661ad08 hash:int = help.PassportConfig;
help.getSupportName#d360e72c = help.SupportName;
help.getUserInfo#38a08d3 user_id:InputUser = help.UserInfo;
help.editUserInfo#66b91b70 user_id:InputUser message:string entities:Vector<MessageEntity> = help.UserInfo;
channels.readHistory#cc104937 channel:InputChannel max_id:int = Bool;
channels.deleteMessages#84c1fd4e channel:InputChannel id:Vector<int> = messages.AffectedMessages;

Binary file not shown.

View File

@ -135,6 +135,7 @@ class GetWebPageQuery : public Td::ResultHandler {
class WebPagesManager::WebPageInstantView {
public:
vector<unique_ptr<PageBlock>> page_blocks;
string url;
int32 hash = 0;
bool is_v2 = false;
bool is_rtl = false;
@ -146,36 +147,46 @@ class WebPagesManager::WebPageInstantView {
template <class T>
void store(T &storer) const {
using ::td::store;
bool has_url = !url.empty();
BEGIN_STORE_FLAGS();
STORE_FLAG(is_full);
STORE_FLAG(is_loaded);
STORE_FLAG(is_rtl);
STORE_FLAG(is_v2);
STORE_FLAG(has_url);
END_STORE_FLAGS();
store(page_blocks, storer);
store(hash, storer);
if (has_url) {
store(url, storer);
}
CHECK(!is_empty);
}
template <class T>
void parse(T &parser) {
using ::td::parse;
bool has_url;
BEGIN_PARSE_FLAGS();
PARSE_FLAG(is_full);
PARSE_FLAG(is_loaded);
PARSE_FLAG(is_rtl);
PARSE_FLAG(is_v2);
PARSE_FLAG(has_url);
END_PARSE_FLAGS();
parse(page_blocks, parser);
parse(hash, parser);
if (has_url) {
parse(url, parser);
}
is_empty = false;
}
friend StringBuilder &operator<<(StringBuilder &string_builder,
const WebPagesManager::WebPageInstantView &instant_view) {
return string_builder << "InstantView(size = " << instant_view.page_blocks.size()
return string_builder << "InstantView(url = " << instant_view.url << ", size = " << instant_view.page_blocks.size()
<< ", hash = " << instant_view.hash << ", is_empty = " << instant_view.is_empty
<< ", is_v2 = " << instant_view.is_v2 << ", is_rtl = " << instant_view.is_rtl
<< ", is_full = " << instant_view.is_full << ", is_loaded = " << instant_view.is_loaded
@ -431,7 +442,8 @@ class WebPagesManager::RichText {
Superscript,
Marked,
PhoneNumber,
Icon
Icon,
Anchor
};
Type type = Type::Plain;
string content;
@ -583,6 +595,8 @@ class WebPagesManager::RelatedArticle {
string title;
string description;
Photo photo;
string author;
int32 published_date = 0;
template <class T>
void store(T &storer) const {
@ -590,10 +604,14 @@ class WebPagesManager::RelatedArticle {
bool has_title = !title.empty();
bool has_description = !description.empty();
bool has_photo = photo.id != -2;
bool has_author = !author.empty();
bool has_date = published_date != 0;
BEGIN_STORE_FLAGS();
STORE_FLAG(has_title);
STORE_FLAG(has_description);
STORE_FLAG(has_photo);
STORE_FLAG(has_author);
STORE_FLAG(has_date);
END_STORE_FLAGS();
store(url, storer);
store(web_page_id, storer);
@ -606,6 +624,12 @@ class WebPagesManager::RelatedArticle {
if (has_photo) {
store(photo, storer);
}
if (has_author) {
store(author, storer);
}
if (has_date) {
store(published_date, storer);
}
}
template <class T>
@ -614,10 +638,14 @@ class WebPagesManager::RelatedArticle {
bool has_title;
bool has_description;
bool has_photo;
bool has_author;
bool has_date;
BEGIN_PARSE_FLAGS();
PARSE_FLAG(has_title);
PARSE_FLAG(has_description);
PARSE_FLAG(has_photo);
PARSE_FLAG(has_author);
PARSE_FLAG(has_date);
END_PARSE_FLAGS();
parse(url, parser);
parse(web_page_id, parser);
@ -632,6 +660,12 @@ class WebPagesManager::RelatedArticle {
} else {
photo.id = -2;
}
if (has_author) {
parse(author, parser);
}
if (has_date) {
parse(published_date, parser);
}
}
};
@ -1925,7 +1959,8 @@ class WebPagesManager::PageBlockRelatedArticles : public PageBlock {
auto related_article_objects = transform(related_articles, [](const RelatedArticle &article) {
return td_api::make_object<td_api::pageBlockRelatedArticle>(
article.url, article.title, article.description,
get_photo_object(G()->td().get_actor_unsafe()->file_manager_.get(), &article.photo));
get_photo_object(G()->td().get_actor_unsafe()->file_manager_.get(), &article.photo), article.author,
article.published_date);
});
return make_tl_object<td_api::pageBlockRelatedArticles>(get_rich_text_object(header),
std::move(related_article_objects));
@ -2810,7 +2845,8 @@ tl_object_ptr<td_api::webPageInstantView> WebPagesManager::get_web_page_instant_
return nullptr;
}
return make_tl_object<td_api::webPageInstantView>(get_page_block_objects(web_page_instant_view->page_blocks),
web_page_instant_view->is_rtl, web_page_instant_view->is_full);
web_page_instant_view->url, web_page_instant_view->is_rtl,
web_page_instant_view->is_full);
}
void WebPagesManager::update_messages_content(WebPageId web_page_id, bool have_web_page) {
@ -2986,6 +3022,13 @@ WebPagesManager::RichText WebPagesManager::get_rich_text(tl_object_ptr<telegram_
}
break;
}
case telegram_api::textAnchor::ID: {
auto rich_text = move_tl_object_as<telegram_api::textAnchor>(rich_text_ptr);
result.type = RichText::Type::Anchor;
result.content = std::move(rich_text->name_);
result.texts.push_back(get_rich_text(std::move(rich_text->text_), documents));
break;
}
default:
UNREACHABLE();
}
@ -3036,6 +3079,8 @@ tl_object_ptr<td_api::RichText> WebPagesManager::get_rich_text_object(const Rich
G()->td().get_actor_unsafe()->documents_manager_->get_document_object(rich_text.document_file_id), width,
height);
}
case RichText::Type::Anchor:
return make_tl_object<td_api::richTextAnchor>(get_rich_text_object(rich_text.texts[0]), rich_text.content);
}
UNREACHABLE();
return nullptr;
@ -3412,6 +3457,10 @@ unique_ptr<WebPagesManager::PageBlock> WebPagesManager::get_page_block(
} else {
article.photo = it->second;
}
article.author = std::move(related_article->author_);
if ((related_article->flags_ & telegram_api::pageRelatedArticle::PUBLISHED_DATE_MASK) != 0) {
article.published_date = related_article->published_date_;
}
return article;
});
return td::make_unique<PageBlockRelatedArticles>(get_rich_text(std::move(page_block->title_), documents),
@ -3537,6 +3586,7 @@ void WebPagesManager::on_get_web_page_instant_view(WebPage *web_page, tl_object_
web_page->instant_view.is_v2 = (page->flags_ & telegram_api::page::V2_MASK) != 0;
web_page->instant_view.is_rtl = (page->flags_ & telegram_api::page::RTL_MASK) != 0;
web_page->instant_view.hash = hash;
web_page->instant_view.url = std::move(page->url_);
web_page->instant_view.is_empty = false;
web_page->instant_view.is_full = (page->flags_ & telegram_api::page::PART_MASK) == 0;
web_page->instant_view.is_loaded = true;

View File

@ -21,7 +21,7 @@ class HeaderStorer {
}
template <class StorerT>
void store(StorerT &storer) const {
constexpr int32 LAYER = 88;
constexpr int32 LAYER = 89;
using td::store;
// invokeWithLayer#da9b0d0d {X:Type} layer:int query:!X = X;