mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2026-07-25 06:54:43 +00:00
Added Add-to-Emoji-Set option to menu for small packless stickers.
This commit is contained in:
@@ -307,6 +307,24 @@ void AddAddToEmojiSetAction(
|
||||
});
|
||||
}
|
||||
|
||||
void AddAddToOwnedSetAction(
|
||||
const Ui::Menu::MenuCallback &addAction,
|
||||
std::shared_ptr<ChatHelpers::Show> show,
|
||||
not_null<DocumentData*> document) {
|
||||
const auto sticker = document->sticker();
|
||||
const auto isLottie = sticker && sticker->isLottie();
|
||||
const auto size = document->dimensions;
|
||||
const auto fitsEmoji = !size.isEmpty()
|
||||
&& (size.width() <= kEmojiStickerSideMax)
|
||||
&& (size.height() <= kEmojiStickerSideMax);
|
||||
if (isLottie || !fitsEmoji) {
|
||||
AddAddToStickerSetAction(addAction, show, document);
|
||||
}
|
||||
if (isLottie || fitsEmoji) {
|
||||
AddAddToEmojiSetAction(addAction, std::move(show), document);
|
||||
}
|
||||
}
|
||||
|
||||
void DeleteStickerSet(
|
||||
not_null<Main::Session*> session,
|
||||
const StickerSetIdentifier &set,
|
||||
|
||||
@@ -32,6 +32,7 @@ namespace Api {
|
||||
|
||||
inline constexpr auto kStickersInOwnedSetMax = 120;
|
||||
inline constexpr auto kEmojiInOwnedSetMax = 200;
|
||||
inline constexpr auto kEmojiStickerSideMax = 100;
|
||||
|
||||
void AddExistingStickerToSet(
|
||||
not_null<Main::Session*> session,
|
||||
@@ -73,6 +74,11 @@ void AddAddToEmojiSetAction(
|
||||
std::shared_ptr<ChatHelpers::Show> show,
|
||||
not_null<DocumentData*> document);
|
||||
|
||||
void AddAddToOwnedSetAction(
|
||||
const Ui::Menu::MenuCallback &addAction,
|
||||
std::shared_ptr<ChatHelpers::Show> show,
|
||||
not_null<DocumentData*> document);
|
||||
|
||||
class StickerUpload final : public base::has_weak_ptr {
|
||||
public:
|
||||
StickerUpload(
|
||||
|
||||
@@ -3186,7 +3186,7 @@ void HistoryInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) {
|
||||
showStickerPackInfo(document);
|
||||
}, &st::menuIconStickers);
|
||||
} else {
|
||||
Api::AddAddToStickerSetAction(
|
||||
Api::AddAddToOwnedSetAction(
|
||||
Ui::Menu::CreateAddActionCallback(_menu),
|
||||
_controller->uiShow(),
|
||||
document);
|
||||
|
||||
@@ -293,7 +293,7 @@ void AddDocumentActions(
|
||||
&st::menuIconStickers);
|
||||
}
|
||||
if (document->sticker() && !document->sticker()->set) {
|
||||
Api::AddAddToStickerSetAction(
|
||||
Api::AddAddToOwnedSetAction(
|
||||
Ui::Menu::CreateAddActionCallback(menu),
|
||||
controller->uiShow(),
|
||||
document);
|
||||
|
||||
Reference in New Issue
Block a user