Support 7 new filter icons.

This commit is contained in:
levlam 2022-06-24 14:27:49 +03:00
parent c51f283332
commit e2acc0ddab
2 changed files with 11 additions and 6 deletions

View File

@ -975,7 +975,7 @@ chatTypeSecret secret_chat_id:int32 user_id:int53 = ChatType;
//@description Represents a filter of user chats
//@title The title of the filter; 1-12 characters without line feeds
//@icon_name The chosen icon name for short filter representation. If non-empty, must be one of "All", "Unread", "Unmuted", "Bots", "Channels", "Groups", "Private", "Custom", "Setup", "Cat", "Crown", "Favorite", "Flower", "Game", "Home", "Love", "Mask", "Party", "Sport", "Study", "Trade", "Travel", "Work".
//@icon_name The chosen icon name for short filter representation. If non-empty, must be one of "All", "Unread", "Unmuted", "Bots", "Channels", "Groups", "Private", "Custom", "Setup", "Cat", "Crown", "Favorite", "Flower", "Game", "Home", "Love", "Mask", "Party", "Sport", "Study", "Trade", "Travel", "Work", "Airplane", "Book", "Light", "Like", "Money", "Note", "Palette".
//-If empty, use getChatFilterDefaultIconName to get default icon name for the filter
//@pinned_chat_ids The chat identifiers of pinned chats in the filtered chat list. There can be up to GetOption("chat_filter_chosen_chat_count_max") pinned and always included non-secret chats and the same number of secret chats, but the limit can be increased with Telegram Premium
//@included_chat_ids The chat identifiers of always included chats in the filtered chat list. There can be up to GetOption("chat_filter_chosen_chat_count_max") pinned and always included non-secret chats and the same number of secret chats, but the limit can be increased with Telegram Premium
@ -993,7 +993,7 @@ chatFilter title:string icon_name:string pinned_chat_ids:vector<int53> included_
//@description Contains basic information about a chat filter
//@id Unique chat filter identifier
//@title The title of the filter; 1-12 characters without line feeds
//@icon_name The chosen or default icon name for short filter representation. One of "All", "Unread", "Unmuted", "Bots", "Channels", "Groups", "Private", "Custom", "Setup", "Cat", "Crown", "Favorite", "Flower", "Game", "Home", "Love", "Mask", "Party", "Sport", "Study", "Trade", "Travel", "Work"
//@icon_name The chosen or default icon name for short filter representation. One of "All", "Unread", "Unmuted", "Bots", "Channels", "Groups", "Private", "Custom", "Setup", "Cat", "Crown", "Favorite", "Flower", "Game", "Home", "Love", "Mask", "Party", "Sport", "Study", "Trade", "Travel", "Work", "Airplane", "Book", "Light", "Like", "Money", "Note", "Palette"
chatFilterInfo id:int32 title:string icon_name:string = ChatFilterInfo;
//@description Describes a recommended chat filter @filter The chat filter @param_description Chat filter description

View File

@ -448,15 +448,20 @@ void DialogFilter::init_icon_names() {
"\xF0\x9F\x8C\xB9", "\xF0\x9F\x8E\xAE", "\xF0\x9F\x8F\xA0",
"\xE2\x9D\xA4\xEF\xB8\x8F", "\xF0\x9F\x8E\xAD", "\xF0\x9F\x8D\xB8",
"\xE2\x9A\xBD\xEF\xB8\x8F", "\xF0\x9F\x8E\x93", "\xF0\x9F\x93\x88",
"\xE2\x9C\x88\xEF\xB8\x8F", "\xF0\x9F\x92\xBC"};
"\xE2\x9C\x88\xEF\xB8\x8F", "\xF0\x9F\x92\xBC", "\xF0\x9F\x9B\xAB",
"\xF0\x9F\x93\x95", "\xF0\x9F\x92\xA1", "\xF0\x9F\x91\x8C",
"\xF0\x9F\x92\xB0", "\xF0\x9F\x8E\xB5", "\xF0\x9F\x8E\xA8"};
vector<string> icon_names{"All", "Unread", "Unmuted", "Bots", "Channels", "Groups", "Private", "Custom",
"Setup", "Cat", "Crown", "Favorite", "Flower", "Game", "Home", "Love",
"Mask", "Party", "Sport", "Study", "Trade", "Travel", "Work"};
"Mask", "Party", "Sport", "Study", "Trade", "Travel", "Work", "Airplane",
"Book", "Light", "Like", "Money", "Note", "Palette"};
CHECK(emojis.size() == icon_names.size());
for (size_t i = 0; i < emojis.size(); i++) {
remove_emoji_modifiers_in_place(emojis[i]);
emoji_to_icon_name_[emojis[i]] = icon_names[i];
icon_name_to_emoji_[icon_names[i]] = emojis[i];
bool is_inserted = emoji_to_icon_name_.emplace(emojis[i], icon_names[i]).second &&
icon_name_to_emoji_.emplace(icon_names[i], emojis[i]).second;
CHECK(is_inserted);
}
return true;
}();