Add internalLinkTypeUnknownDeepLink.

This commit is contained in:
levlam 2021-05-25 19:30:23 +03:00
parent 79bcfb4915
commit 472e0d9221
3 changed files with 19 additions and 1 deletions

View File

@ -3010,6 +3010,10 @@ internalLinkTypeMessage = InternalLinkType;
//@text Message draft text @contains_link True, if the first line of the text contains a link. If true, the input field needs to be focused and the text after the link should be selected
internalLinkTypeMessageDraft text:formattedText contains_link:Bool = InternalLinkType;
//@description The link is an unknown tg: link. Call getDeepLinkInfo to process the link
internalLinkTypeUnknownDeepLink = InternalLinkType;
//@description Contains an HTTPS link to a message in a supergroup or channel @link Message link @is_public True, if the link will work for non-members of the chat
messageLink link:string is_public:Bool = MessageLink;

View File

@ -67,6 +67,16 @@ class LinkManager::InternalLinkMessageDraft : public InternalLink {
}
};
class LinkManager::InternalLinkUnknownDeepLink : public InternalLink {
td_api::object_ptr<td_api::InternalLinkType> get_internal_link_type_object() const final {
return td_api::make_object<td_api::internalLinkTypeUnknownDeepLink>();
}
InternalLinkType get_type() const final {
return InternalLinkType::UnknownDeepLink;
}
};
class RequestUrlAuthQuery : public Td::ResultHandler {
Promise<td_api::object_ptr<td_api::LoginUrlInfo>> promise_;
string url_;
@ -377,6 +387,9 @@ unique_ptr<LinkManager::InternalLink> LinkManager::parse_tg_link_query(Slice que
// msg_url?url=<url>&text=<text>
return get_internal_link_message_draft(url_query.get_arg("url"), url_query.get_arg("text"));
}
if (!path.empty()) {
return td::make_unique<InternalLinkUnknownDeepLink>();
}
return nullptr;
}

View File

@ -33,7 +33,7 @@ class LinkManager : public Actor {
LinkManager &operator=(LinkManager &&) = delete;
~LinkManager() override;
enum class InternalLinkType : int32 { Background, Message, MessageDraft };
enum class InternalLinkType : int32 { Background, Message, MessageDraft, UnknownDeepLink };
class InternalLink {
public:
@ -80,6 +80,7 @@ class LinkManager : public Actor {
class InternalLinkBackground;
class InternalLinkMessage;
class InternalLinkMessageDraft;
class InternalLinkUnknownDeepLink;
static unique_ptr<InternalLink> parse_tg_link_query(Slice query);