From 2d354f8777d8cbc42c7f0c89b43e71861a3ffa90 Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Fri, 23 Jul 2021 22:03:08 +0300 Subject: [PATCH] Added ability to save GIFs from context menu in sections. Fixed #8739. --- .../history/view/history_view_context_menu.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Telegram/SourceFiles/history/view/history_view_context_menu.cpp b/Telegram/SourceFiles/history/view/history_view_context_menu.cpp index e931613513..a832e49265 100644 --- a/Telegram/SourceFiles/history/view/history_view_context_menu.cpp +++ b/Telegram/SourceFiles/history/view/history_view_context_menu.cpp @@ -156,6 +156,18 @@ void AddPhotoActions( } } +void SaveGif( + not_null controller, + FullMsgId itemId) { + if (const auto item = controller->session().data().message(itemId)) { + if (const auto media = item->media()) { + if (const auto document = media->document()) { + Api::ToggleSavedGif(document, item->fullId(), true); + } + } + } +} + void OpenGif( not_null controller, FullMsgId itemId) { @@ -227,6 +239,11 @@ void AddDocumentActions( OpenGif(list->controller(), contextId); }); } + if (document->isGifv()) { + menu->addAction(tr::lng_context_save_gif(tr::now), [=] { + SaveGif(list->controller(), contextId); + }); + } } if (document->sticker() && document->sticker()->set) { menu->addAction(