mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-20 08:07:09 +02:00
Moved out extracting of attached stickers from Scene to FileLoadTask.
This commit is contained in:
parent
ab248febcd
commit
f8be5731a5
3 changed files with 15 additions and 18 deletions
|
@ -120,18 +120,6 @@ std::vector<ItemPtr> Scene::items(
|
|||
return copyItems;
|
||||
}
|
||||
|
||||
std::vector<not_null<DocumentData*>> Scene::attachedStickers() const {
|
||||
const auto allItems = items();
|
||||
|
||||
return ranges::views::all(
|
||||
allItems
|
||||
) | ranges::views::filter([](const ItemPtr &i) {
|
||||
return i->isVisible() && (i->type() == ItemSticker::Type);
|
||||
}) | ranges::views::transform([](const ItemPtr &i) {
|
||||
return static_cast<ItemSticker*>(i.get())->sticker();
|
||||
}) | ranges::to_vector;
|
||||
}
|
||||
|
||||
std::shared_ptr<float64> Scene::lastZ() const {
|
||||
return _lastZ;
|
||||
}
|
||||
|
|
|
@ -39,9 +39,6 @@ public:
|
|||
[[nodiscard]] rpl::producer<> addsItem() const;
|
||||
[[nodiscard]] rpl::producer<> removesItem() const;
|
||||
|
||||
[[nodiscard]] auto attachedStickers() const
|
||||
-> std::vector<not_null<DocumentData*>>;
|
||||
|
||||
[[nodiscard]] std::shared_ptr<float64> lastZ() const;
|
||||
|
||||
void updateZoom(float64 zoom);
|
||||
|
|
|
@ -15,7 +15,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "core/mime_type.h"
|
||||
#include "base/unixtime.h"
|
||||
#include "base/random.h"
|
||||
#include "editor/scene/scene.h" // Editor::Scene::attachedStickers
|
||||
#include "editor/scene/scene_item_sticker.h"
|
||||
#include "editor/scene/scene.h"
|
||||
#include "media/audio/media_audio.h"
|
||||
#include "media/clip/media_clip_reader.h"
|
||||
#include "mtproto/facade.h"
|
||||
|
@ -148,6 +149,18 @@ MTPInputSingleMedia PrepareAlbumItemMedia(
|
|||
sentEntities);
|
||||
}
|
||||
|
||||
std::vector<not_null<DocumentData*>> ExtractStickersFromScene(
|
||||
not_null<const Ui::PreparedFileInformation::Image*> info) {
|
||||
const auto allItems = info->modifications.paint->items();
|
||||
|
||||
return ranges::views::all(
|
||||
allItems
|
||||
) | ranges::views::filter([](const Editor::Scene::ItemPtr &i) {
|
||||
return i->isVisible() && (i->type() == Editor::ItemSticker::Type);
|
||||
}) | ranges::views::transform([](const Editor::Scene::ItemPtr &i) {
|
||||
return static_cast<Editor::ItemSticker*>(i.get())->sticker();
|
||||
}) | ranges::to_vector;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
|
@ -948,8 +961,7 @@ void FileLoadTask::process(Args &&args) {
|
|||
if (auto image = std::get_if<Ui::PreparedFileInformation::Image>(
|
||||
&_information->media)) {
|
||||
if (image->modifications.paint) {
|
||||
const auto documents
|
||||
= image->modifications.paint->attachedStickers();
|
||||
const auto documents = ExtractStickersFromScene(image);
|
||||
_result->attachedStickers = documents
|
||||
| ranges::view::transform(&DocumentData::mtpInput)
|
||||
| ranges::to_vector;
|
||||
|
|
Loading…
Add table
Reference in a new issue