Add more Settings links (#1884)
This commit is contained in:
parent
48a93aadb9
commit
a78245ee69
@ -3317,6 +3317,9 @@ internalLinkTypeGame bot_username:string game_short_name:string = InternalLinkTy
|
||||
//@description The link is a link to a language pack. Call getLanguagePackInfo with the given language pack identifier to process the link @language_pack_id Language pack identifier
|
||||
internalLinkTypeLanguagePack language_pack_id:string = InternalLinkType;
|
||||
|
||||
//@description The link is a link to the language settings section of the app
|
||||
internalLinkTypeLanguageSettings = InternalLinkType;
|
||||
|
||||
//@description The link is a link to a Telegram message. Call getMessageLinkInfo with the given URL to process the link @url URL to be passed to getMessageLinkInfo
|
||||
internalLinkTypeMessage url:string = InternalLinkType;
|
||||
|
||||
@ -3333,6 +3336,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 privacy and security settings section of the app
|
||||
internalLinkTypePrivacyAndSecuritySettings = InternalLinkType;
|
||||
|
||||
//@description The link is a link to a proxy. Call addProxy with the given parameters to process the link and add the proxy
|
||||
//@server Proxy server IP address @port Proxy server port @type Type of the proxy
|
||||
internalLinkTypeProxy server:string port:int32 type:ProxyType = InternalLinkType;
|
||||
|
@ -224,6 +224,12 @@ class LinkManager::InternalLinkLanguage final : public InternalLink {
|
||||
}
|
||||
};
|
||||
|
||||
class LinkManager::InternalLinkLanguageSettings final : public InternalLink {
|
||||
td_api::object_ptr<td_api::InternalLinkType> get_internal_link_type_object() const final {
|
||||
return td_api::make_object<td_api::internalLinkTypeLanguageSettings>();
|
||||
}
|
||||
};
|
||||
|
||||
class LinkManager::InternalLinkMessage final : public InternalLink {
|
||||
string url_;
|
||||
|
||||
@ -274,6 +280,12 @@ class LinkManager::InternalLinkPassportDataRequest final : public InternalLink {
|
||||
}
|
||||
};
|
||||
|
||||
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>();
|
||||
}
|
||||
};
|
||||
|
||||
class LinkManager::InternalLinkProxy final : public InternalLink {
|
||||
string server_;
|
||||
int32 port_;
|
||||
@ -859,6 +871,14 @@ unique_ptr<LinkManager::InternalLink> LinkManager::parse_tg_link_query(Slice que
|
||||
// settings/folders
|
||||
return td::make_unique<InternalLinkFilterSettings>();
|
||||
}
|
||||
if (path.size() == 2 && path[1] == "language") {
|
||||
// settings/language
|
||||
return td::make_unique<InternalLinkLanguageSettings>();
|
||||
}
|
||||
if (path.size() == 2 && path[1] == "privacy") {
|
||||
// settings/privacy
|
||||
return td::make_unique<InternalLinkPrivacyAndSecuritySettings>();
|
||||
}
|
||||
if (path.size() == 2 && path[1] == "themes") {
|
||||
// settings/themes
|
||||
return td::make_unique<InternalLinkThemeSettings>();
|
||||
|
@ -92,9 +92,11 @@ class LinkManager final : public Actor {
|
||||
class InternalLinkFilterSettings;
|
||||
class InternalLinkGame;
|
||||
class InternalLinkLanguage;
|
||||
class InternalLinkLanguageSettings;
|
||||
class InternalLinkMessage;
|
||||
class InternalLinkMessageDraft;
|
||||
class InternalLinkPassportDataRequest;
|
||||
class InternalLinkPrivacyAndSecuritySettings;
|
||||
class InternalLinkProxy;
|
||||
class InternalLinkPublicDialog;
|
||||
class InternalLinkQrCodeAuthentication;
|
||||
|
@ -125,6 +125,9 @@ TEST(Link, parse_internal_link) {
|
||||
auto language_pack = [](const td::string &language_pack_name) {
|
||||
return td::td_api::make_object<td::td_api::internalLinkTypeLanguagePack>(language_pack_name);
|
||||
};
|
||||
auto language_settings = [] {
|
||||
return td::td_api::make_object<td::td_api::internalLinkTypeLanguageSettings>();
|
||||
};
|
||||
auto message = [](const td::string &url) {
|
||||
return td::td_api::make_object<td::td_api::internalLinkTypeMessage>(url);
|
||||
};
|
||||
@ -141,6 +144,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 privacy_and_security_settings = [] {
|
||||
return td::td_api::make_object<td::td_api::internalLinkTypePrivacyAndSecuritySettings>();
|
||||
};
|
||||
auto proxy_mtproto = [](const td::string &server, td::int32 port, const td::string &secret) {
|
||||
return td::td_api::make_object<td::td_api::internalLinkTypeProxy>(
|
||||
server, port, td::td_api::make_object<td::td_api::proxyTypeMtproto>(secret));
|
||||
@ -686,4 +692,6 @@ TEST(Link, parse_internal_link) {
|
||||
parse_internal_link("tg://settings/change_number", change_phone_number());
|
||||
parse_internal_link("tg://settings/folders", filter_settings());
|
||||
parse_internal_link("tg://settings/filters", settings());
|
||||
parse_internal_link("tg://settings/language", language_settings());
|
||||
parse_internal_link("tg://settings/privacy", privacy_and_security_settings());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user