Sort emotes alphabetically in emote picker (#1499)

This commit is contained in:
apa420 2020-01-25 13:05:59 +01:00 committed by pajlada
parent 410de82261
commit 4b1202437b
2 changed files with 12 additions and 1 deletions

View file

@ -482,6 +482,10 @@ void TwitchAccount::parseEmotes(const rapidjson::Document &root)
emoteData->emotes.emplace(code, emote);
}
std::sort(emoteSet->emotes.begin(), emoteSet->emotes.end(),
[](const TwitchEmote &l, const TwitchEmote &r) {
return l.name.string < r.name.string;
});
emoteData->emoteSets.emplace_back(emoteSet);
}
};

View file

@ -32,7 +32,14 @@ namespace {
if (!map.empty())
{
for (const auto &emote : map)
std::vector<std::pair<EmoteName, EmotePtr>> vec(map.begin(),
map.end());
std::sort(vec.begin(), vec.end(),
[](const std::pair<EmoteName, EmotePtr> &l,
const std::pair<EmoteName, EmotePtr> &r) {
return l.first.string < r.first.string;
});
for (const auto &emote : vec)
{
builder
.emplace<EmoteElement>(emote.second,