Add internalLinkTypePremiumFeatures.
This commit is contained in:
parent
d986c9bc27
commit
2c44f8c273
@ -3575,6 +3575,9 @@ internalLinkTypePassportDataRequest bot_user_id:int53 scope:string public_key:st
|
||||
//@hash Hash value from the link @phone_number Phone number value from the link
|
||||
internalLinkTypePhoneNumberConfirmation hash:string phone_number:string = InternalLinkType;
|
||||
|
||||
//@description The link is a link to the Premium features screen of the app, from which the user can subscribe to Telegram Premium. Call getPremiumFeatures with the given referrer to process the link @referrer Referrer specified in the link
|
||||
internalLinkTypePremiumFeatures referrer:string = InternalLinkType;
|
||||
|
||||
//@description The link is a link to the privacy and security settings section of the app
|
||||
internalLinkTypePrivacyAndSecuritySettings = InternalLinkType;
|
||||
|
||||
|
@ -377,6 +377,18 @@ class LinkManager::InternalLinkPassportDataRequest final : public InternalLink {
|
||||
}
|
||||
};
|
||||
|
||||
class LinkManager::InternalLinkPremiumFeatures final : public InternalLink {
|
||||
string referrer_;
|
||||
|
||||
td_api::object_ptr<td_api::InternalLinkType> get_internal_link_type_object() const final {
|
||||
return td_api::make_object<td_api::internalLinkTypePremiumFeatures>(referrer_);
|
||||
}
|
||||
|
||||
public:
|
||||
explicit InternalLinkPremiumFeatures(string referrer) : referrer_(std::move(referrer)) {
|
||||
}
|
||||
};
|
||||
|
||||
class LinkManager::InternalLinkPrivacyAndSecuritySettings final : public InternalLink {
|
||||
td_api::object_ptr<td_api::InternalLinkType> get_internal_link_type_object() const final {
|
||||
return td_api::make_object<td_api::internalLinkTypePrivacyAndSecuritySettings>();
|
||||
@ -1012,6 +1024,9 @@ unique_ptr<LinkManager::InternalLink> LinkManager::parse_tg_link_query(Slice que
|
||||
} else if (path.size() == 1 && path[0] == "passport") {
|
||||
// passport?bot_id=<bot_user_id>&scope=<scope>&public_key=<public_key>&nonce=<nonce>
|
||||
return get_internal_link_passport(query, url_query.args_);
|
||||
} else if (path.size() == 1 && path[0] == "premium_offer") {
|
||||
// premium_offer?ref=<referrer>
|
||||
return td::make_unique<InternalLinkPremiumFeatures>(get_arg("ref"));
|
||||
} else if (!path.empty() && path[0] == "settings") {
|
||||
if (path.size() == 2 && path[1] == "change_number") {
|
||||
// settings/change_number
|
||||
|
@ -102,6 +102,7 @@ class LinkManager final : public Actor {
|
||||
class InternalLinkMessage;
|
||||
class InternalLinkMessageDraft;
|
||||
class InternalLinkPassportDataRequest;
|
||||
class InternalLinkPremiumFeatures;
|
||||
class InternalLinkPrivacyAndSecuritySettings;
|
||||
class InternalLinkProxy;
|
||||
class InternalLinkPublicDialog;
|
||||
|
@ -159,6 +159,9 @@ TEST(Link, parse_internal_link) {
|
||||
auto phone_number_confirmation = [](const td::string &hash, const td::string &phone_number) {
|
||||
return td::td_api::make_object<td::td_api::internalLinkTypePhoneNumberConfirmation>(hash, phone_number);
|
||||
};
|
||||
auto premium_features = [](const td::string &referrer) {
|
||||
return td::td_api::make_object<td::td_api::internalLinkTypePremiumFeatures>(referrer);
|
||||
};
|
||||
auto privacy_and_security_settings = [] {
|
||||
return td::td_api::make_object<td::td_api::internalLinkTypePrivacyAndSecuritySettings>();
|
||||
};
|
||||
@ -823,6 +826,10 @@ TEST(Link, parse_internal_link) {
|
||||
parse_internal_link("t.me/telegrampassport?bot_id=12345&public_key=key&scope=asd&payload=nonce",
|
||||
public_chat("telegrampassport"));
|
||||
|
||||
parse_internal_link("tg:premium_offer?ref=abcdef", premium_features("abcdef"));
|
||||
parse_internal_link("tg:premium_offer?ref=abc%30ef", premium_features("abc0ef"));
|
||||
parse_internal_link("tg://premium_offer?ref=", premium_features(""));
|
||||
|
||||
parse_internal_link("tg://settings", settings());
|
||||
parse_internal_link("tg://setting", unknown_deep_link("tg://setting"));
|
||||
parse_internal_link("tg://settings?asdsa?D?SADasD?asD", settings());
|
||||
|
Loading…
Reference in New Issue
Block a user