Added ability to save GIFs from context menu in sections.

Fixed #8739.
This commit is contained in:
23rd 2021-07-23 22:03:08 +03:00
parent b27dc4ef8d
commit 2d354f8777
1 changed files with 17 additions and 0 deletions

View File

@ -156,6 +156,18 @@ void AddPhotoActions(
} }
} }
void SaveGif(
not_null<Window::SessionController*> 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( void OpenGif(
not_null<Window::SessionController*> controller, not_null<Window::SessionController*> controller,
FullMsgId itemId) { FullMsgId itemId) {
@ -227,6 +239,11 @@ void AddDocumentActions(
OpenGif(list->controller(), contextId); 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) { if (document->sticker() && document->sticker()->set) {
menu->addAction( menu->addAction(