mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-14 13:17:08 +02:00
Greeting category first in ChatIntro setup.
This commit is contained in:
parent
bb6fd4bc4d
commit
16ce5ef046
5 changed files with 30 additions and 4 deletions
|
@ -2619,6 +2619,8 @@ void StickersListWidget::setupSearch() {
|
|||
const auto session = &_show->session();
|
||||
const auto type = (_mode == Mode::UserpicBuilder)
|
||||
? TabbedSearchType::ProfilePhoto
|
||||
: (_mode == Mode::ChatIntro)
|
||||
? TabbedSearchType::Greeting
|
||||
: TabbedSearchType::Stickers;
|
||||
_search = MakeSearch(this, st(), [=](std::vector<QString> &&query) {
|
||||
auto set = base::flat_set<EmojiPtr>();
|
||||
|
|
|
@ -65,6 +65,7 @@ enum class StickersListMode {
|
|||
Full,
|
||||
Masks,
|
||||
UserpicBuilder,
|
||||
ChatIntro,
|
||||
};
|
||||
|
||||
struct StickersListDescriptor {
|
||||
|
|
|
@ -302,6 +302,21 @@ void TabbedSelector::Tab::saveScrollTop() {
|
|||
_scrollTop = widget()->getVisibleTop();
|
||||
}
|
||||
|
||||
[[nodiscard]] rpl::producer<std::vector<Ui::EmojiGroup>> GreetingGroupFirst(
|
||||
not_null<Data::Session*> owner) {
|
||||
return owner->emojiStatuses().stickerGroupsValue(
|
||||
) | rpl::map([](std::vector<Ui::EmojiGroup> &&groups) {
|
||||
const auto i = ranges::find(
|
||||
groups,
|
||||
Ui::EmojiGroupType::Greeting,
|
||||
&Ui::EmojiGroup::type);
|
||||
if (i != begin(groups) && i != end(groups)) {
|
||||
ranges::rotate(begin(groups), i, i + 1);
|
||||
}
|
||||
return std::move(groups);
|
||||
});
|
||||
}
|
||||
|
||||
std::unique_ptr<Ui::TabbedSearch> MakeSearch(
|
||||
not_null<Ui::RpWidget*> parent,
|
||||
const style::EmojiPan &st,
|
||||
|
@ -318,6 +333,8 @@ std::unique_ptr<Ui::TabbedSearch> MakeSearch(
|
|||
? owner->emojiStatuses().statusGroupsValue()
|
||||
: (type == TabbedSearchType::Stickers)
|
||||
? owner->emojiStatuses().stickerGroupsValue()
|
||||
: (type == TabbedSearchType::Greeting)
|
||||
? GreetingGroupFirst(owner)
|
||||
: owner->emojiStatuses().emojiGroupsValue()),
|
||||
.customEmojiFactory = owner->customEmojiManager().factory(
|
||||
Data::CustomEmojiManager::SizeTag::SetIcon,
|
||||
|
@ -379,7 +396,7 @@ TabbedSelector::TabbedSelector(
|
|||
tabs.reserve(2);
|
||||
tabs.push_back(createTab(SelectorTab::Stickers, 0));
|
||||
tabs.push_back(createTab(SelectorTab::Masks, 1));
|
||||
} else if (_mode == Mode::StickersOnly) {
|
||||
} else if (_mode == Mode::StickersOnly || _mode == Mode::ChatIntro) {
|
||||
tabs.reserve(1);
|
||||
tabs.push_back(createTab(SelectorTab::Stickers, 0));
|
||||
} else {
|
||||
|
@ -390,7 +407,9 @@ TabbedSelector::TabbedSelector(
|
|||
}())
|
||||
, _currentTabType(full()
|
||||
? session().settings().selectorTab()
|
||||
: (mediaEditor() || _mode == Mode::StickersOnly)
|
||||
: (mediaEditor()
|
||||
|| _mode == Mode::StickersOnly
|
||||
|| _mode == Mode::ChatIntro)
|
||||
? SelectorTab::Stickers
|
||||
: SelectorTab::Emoji)
|
||||
, _hasEmojiTab(ranges::contains(_tabs, SelectorTab::Emoji, &Tab::type))
|
||||
|
@ -555,7 +574,9 @@ TabbedSelector::Tab TabbedSelector::createTab(SelectorTab type, int index) {
|
|||
using Descriptor = StickersListDescriptor;
|
||||
return object_ptr<StickersListWidget>(this, Descriptor{
|
||||
.show = _show,
|
||||
.mode = StickersMode::Full,
|
||||
.mode = (_mode == Mode::ChatIntro
|
||||
? StickersMode::ChatIntro
|
||||
: StickersMode::Full),
|
||||
.paused = paused,
|
||||
.st = &_st,
|
||||
.features = _features,
|
||||
|
|
|
@ -87,6 +87,7 @@ enum class TabbedSelectorMode {
|
|||
FullReactions,
|
||||
RecentReactions,
|
||||
PeerTitle,
|
||||
ChatIntro,
|
||||
};
|
||||
|
||||
struct TabbedSelectorDescriptor {
|
||||
|
@ -103,6 +104,7 @@ enum class TabbedSearchType {
|
|||
Status,
|
||||
ProfilePhoto,
|
||||
Stickers,
|
||||
Greeting,
|
||||
};
|
||||
[[nodiscard]] std::unique_ptr<Ui::TabbedSearch> MakeSearch(
|
||||
not_null<Ui::RpWidget*> parent,
|
||||
|
|
|
@ -476,7 +476,7 @@ void StickerPanel::create(const Descriptor &descriptor) {
|
|||
.show = controller->uiShow(),
|
||||
.st = st::backgroundEmojiPan,
|
||||
.level = Window::GifPauseReason::Layer,
|
||||
.mode = Mode::StickersOnly,
|
||||
.mode = Mode::ChatIntro,
|
||||
.features = {
|
||||
.megagroupSet = false,
|
||||
.stickersSettings = false,
|
||||
|
|
Loading…
Add table
Reference in a new issue