From 8383caa2b5b970ed720ceedbce84eac9d89cdacf Mon Sep 17 00:00:00 2001 From: John Preston Date: Mon, 18 Jul 2022 12:09:12 +0300 Subject: [PATCH] Fix build with Xcode. --- .../chat_helpers/stickers_list_widget.cpp | 4 ++-- Telegram/SourceFiles/core/core_settings.h | 2 +- .../mac/touchbar/items/mac_scrubber_item.mm | 16 ++++++++++++++-- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/Telegram/SourceFiles/chat_helpers/stickers_list_widget.cpp b/Telegram/SourceFiles/chat_helpers/stickers_list_widget.cpp index e69fe1738..13b833014 100644 --- a/Telegram/SourceFiles/chat_helpers/stickers_list_widget.cpp +++ b/Telegram/SourceFiles/chat_helpers/stickers_list_widget.cpp @@ -2727,9 +2727,9 @@ void StickersListWidget::removeMegagroupSet(bool locally) { } close(); }), - .cancelled = crl::guard(this, [this](Fn &&close) { + .cancelled = [](Fn &&close) { close(); - }), + }, }))); } diff --git a/Telegram/SourceFiles/core/core_settings.h b/Telegram/SourceFiles/core/core_settings.h index d37af5c1b..93032fdf1 100644 --- a/Telegram/SourceFiles/core/core_settings.h +++ b/Telegram/SourceFiles/core/core_settings.h @@ -67,7 +67,7 @@ struct RecentEmojiDocument { struct RecentEmojiId { std::variant data; - friend inline auto operator<=>( + friend inline bool operator==( RecentEmojiId, RecentEmojiId) = default; }; diff --git a/Telegram/SourceFiles/platform/mac/touchbar/items/mac_scrubber_item.mm b/Telegram/SourceFiles/platform/mac/touchbar/items/mac_scrubber_item.mm index 318bc4888..f6cecda06 100644 --- a/Telegram/SourceFiles/platform/mac/touchbar/items/mac_scrubber_item.mm +++ b/Telegram/SourceFiles/platform/mac/touchbar/items/mac_scrubber_item.mm @@ -258,13 +258,25 @@ void AppendFavedStickers( } } +[[nodiscard]] EmojiPack RecentEmojiSection() { + const auto list = Core::App().settings().recentEmoji(); + auto result = EmojiPack(); + result.reserve(list.size()); + for (const auto &emoji : list) { + if (const auto one = std::get_if(&emoji.id.data)) { + result.push_back(*one); + } + } + return result; +} + void AppendEmojiPacks( const Data::StickersSets &sets, std::vector &to) { for (auto i = 0; i != ChatHelpers::kEmojiSectionCount; ++i) { const auto section = static_cast(i); const auto list = (section == Ui::Emoji::Section::Recent) - ? Core::App().settings().recentEmojiSection() + ? RecentEmojiSection() : Ui::Emoji::GetSection(section); const auto title = (section == Ui::Emoji::Section::Recent) ? TitleRecentlyUsed(sets) @@ -475,7 +487,7 @@ void AppendEmojiPacks( if (const auto inputField = qobject_cast( QApplication::focusWidget())) { Ui::InsertEmojiAtCursor(inputField->textCursor(), emoji); - Core::App().settings().incrementRecentEmoji(emoji); + Core::App().settings().incrementRecentEmoji({ emoji }); return true; } }