From 943593526f85ac42790430eed41a3a8e8c951c0f Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Fri, 30 Oct 2020 13:16:03 +0300 Subject: [PATCH] Added ability to see attached stickers from sections. --- .../view/history_view_context_menu.cpp | 26 +++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/Telegram/SourceFiles/history/view/history_view_context_menu.cpp b/Telegram/SourceFiles/history/view/history_view_context_menu.cpp index 323476590..c4b5d101d 100644 --- a/Telegram/SourceFiles/history/view/history_view_context_menu.cpp +++ b/Telegram/SourceFiles/history/view/history_view_context_menu.cpp @@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ #include "history/view/history_view_context_menu.h" +#include "api/api_attached_stickers.h" #include "api/api_editing.h" #include "api/api_toggling_media.h" // Api::ToggleFavedSticker #include "base/unixtime.h" @@ -137,7 +138,8 @@ void ToggleFavedSticker( void AddPhotoActions( not_null menu, - not_null photo) { + not_null photo, + not_null list) { menu->addAction( tr::lng_context_save_image(tr::now), App::LambdaDelayed( @@ -147,6 +149,16 @@ void AddPhotoActions( menu->addAction(tr::lng_context_copy_image(tr::now), [=] { CopyImage(photo); }); + if (photo->hasAttachedStickers()) { + const auto controller = list->controller(); + auto callback = [=] { + auto &attached = photo->session().api().attachedStickers(); + attached.requestAttachedStickerSets(controller, photo); + }; + menu->addAction( + tr::lng_context_attached_stickers(tr::now), + std::move(callback)); + } } void OpenGif(not_null session, FullMsgId itemId) { @@ -239,6 +251,16 @@ void AddDocumentActions( : tr::lng_context_show_in_folder(tr::now)), [=] { ShowInFolder(document); }); } + if (document->hasAttachedStickers()) { + const auto controller = list->controller(); + auto callback = [=] { + auto &attached = session->api().attachedStickers(); + attached.requestAttachedStickerSets(controller, document); + }; + menu->addAction( + tr::lng_context_attached_stickers(tr::now), + std::move(callback)); + } AddSaveDocumentAction(menu, contextId, document); } @@ -768,7 +790,7 @@ base::unique_qptr FillContextMenu( AddTopMessageActions(result, request, list); if (linkPhoto) { - AddPhotoActions(result, photo); + AddPhotoActions(result, photo, list); } else if (linkDocument) { AddDocumentActions(result, document, itemId, list); //} else if (linkPeer) { // #feed