mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +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 session = &_show->session();
|
||||||
const auto type = (_mode == Mode::UserpicBuilder)
|
const auto type = (_mode == Mode::UserpicBuilder)
|
||||||
? TabbedSearchType::ProfilePhoto
|
? TabbedSearchType::ProfilePhoto
|
||||||
|
: (_mode == Mode::ChatIntro)
|
||||||
|
? TabbedSearchType::Greeting
|
||||||
: TabbedSearchType::Stickers;
|
: TabbedSearchType::Stickers;
|
||||||
_search = MakeSearch(this, st(), [=](std::vector<QString> &&query) {
|
_search = MakeSearch(this, st(), [=](std::vector<QString> &&query) {
|
||||||
auto set = base::flat_set<EmojiPtr>();
|
auto set = base::flat_set<EmojiPtr>();
|
||||||
|
|
|
@ -65,6 +65,7 @@ enum class StickersListMode {
|
||||||
Full,
|
Full,
|
||||||
Masks,
|
Masks,
|
||||||
UserpicBuilder,
|
UserpicBuilder,
|
||||||
|
ChatIntro,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct StickersListDescriptor {
|
struct StickersListDescriptor {
|
||||||
|
|
|
@ -302,6 +302,21 @@ void TabbedSelector::Tab::saveScrollTop() {
|
||||||
_scrollTop = widget()->getVisibleTop();
|
_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(
|
std::unique_ptr<Ui::TabbedSearch> MakeSearch(
|
||||||
not_null<Ui::RpWidget*> parent,
|
not_null<Ui::RpWidget*> parent,
|
||||||
const style::EmojiPan &st,
|
const style::EmojiPan &st,
|
||||||
|
@ -318,6 +333,8 @@ std::unique_ptr<Ui::TabbedSearch> MakeSearch(
|
||||||
? owner->emojiStatuses().statusGroupsValue()
|
? owner->emojiStatuses().statusGroupsValue()
|
||||||
: (type == TabbedSearchType::Stickers)
|
: (type == TabbedSearchType::Stickers)
|
||||||
? owner->emojiStatuses().stickerGroupsValue()
|
? owner->emojiStatuses().stickerGroupsValue()
|
||||||
|
: (type == TabbedSearchType::Greeting)
|
||||||
|
? GreetingGroupFirst(owner)
|
||||||
: owner->emojiStatuses().emojiGroupsValue()),
|
: owner->emojiStatuses().emojiGroupsValue()),
|
||||||
.customEmojiFactory = owner->customEmojiManager().factory(
|
.customEmojiFactory = owner->customEmojiManager().factory(
|
||||||
Data::CustomEmojiManager::SizeTag::SetIcon,
|
Data::CustomEmojiManager::SizeTag::SetIcon,
|
||||||
|
@ -379,7 +396,7 @@ TabbedSelector::TabbedSelector(
|
||||||
tabs.reserve(2);
|
tabs.reserve(2);
|
||||||
tabs.push_back(createTab(SelectorTab::Stickers, 0));
|
tabs.push_back(createTab(SelectorTab::Stickers, 0));
|
||||||
tabs.push_back(createTab(SelectorTab::Masks, 1));
|
tabs.push_back(createTab(SelectorTab::Masks, 1));
|
||||||
} else if (_mode == Mode::StickersOnly) {
|
} else if (_mode == Mode::StickersOnly || _mode == Mode::ChatIntro) {
|
||||||
tabs.reserve(1);
|
tabs.reserve(1);
|
||||||
tabs.push_back(createTab(SelectorTab::Stickers, 0));
|
tabs.push_back(createTab(SelectorTab::Stickers, 0));
|
||||||
} else {
|
} else {
|
||||||
|
@ -390,7 +407,9 @@ TabbedSelector::TabbedSelector(
|
||||||
}())
|
}())
|
||||||
, _currentTabType(full()
|
, _currentTabType(full()
|
||||||
? session().settings().selectorTab()
|
? session().settings().selectorTab()
|
||||||
: (mediaEditor() || _mode == Mode::StickersOnly)
|
: (mediaEditor()
|
||||||
|
|| _mode == Mode::StickersOnly
|
||||||
|
|| _mode == Mode::ChatIntro)
|
||||||
? SelectorTab::Stickers
|
? SelectorTab::Stickers
|
||||||
: SelectorTab::Emoji)
|
: SelectorTab::Emoji)
|
||||||
, _hasEmojiTab(ranges::contains(_tabs, SelectorTab::Emoji, &Tab::type))
|
, _hasEmojiTab(ranges::contains(_tabs, SelectorTab::Emoji, &Tab::type))
|
||||||
|
@ -555,7 +574,9 @@ TabbedSelector::Tab TabbedSelector::createTab(SelectorTab type, int index) {
|
||||||
using Descriptor = StickersListDescriptor;
|
using Descriptor = StickersListDescriptor;
|
||||||
return object_ptr<StickersListWidget>(this, Descriptor{
|
return object_ptr<StickersListWidget>(this, Descriptor{
|
||||||
.show = _show,
|
.show = _show,
|
||||||
.mode = StickersMode::Full,
|
.mode = (_mode == Mode::ChatIntro
|
||||||
|
? StickersMode::ChatIntro
|
||||||
|
: StickersMode::Full),
|
||||||
.paused = paused,
|
.paused = paused,
|
||||||
.st = &_st,
|
.st = &_st,
|
||||||
.features = _features,
|
.features = _features,
|
||||||
|
|
|
@ -87,6 +87,7 @@ enum class TabbedSelectorMode {
|
||||||
FullReactions,
|
FullReactions,
|
||||||
RecentReactions,
|
RecentReactions,
|
||||||
PeerTitle,
|
PeerTitle,
|
||||||
|
ChatIntro,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct TabbedSelectorDescriptor {
|
struct TabbedSelectorDescriptor {
|
||||||
|
@ -103,6 +104,7 @@ enum class TabbedSearchType {
|
||||||
Status,
|
Status,
|
||||||
ProfilePhoto,
|
ProfilePhoto,
|
||||||
Stickers,
|
Stickers,
|
||||||
|
Greeting,
|
||||||
};
|
};
|
||||||
[[nodiscard]] std::unique_ptr<Ui::TabbedSearch> MakeSearch(
|
[[nodiscard]] std::unique_ptr<Ui::TabbedSearch> MakeSearch(
|
||||||
not_null<Ui::RpWidget*> parent,
|
not_null<Ui::RpWidget*> parent,
|
||||||
|
|
|
@ -476,7 +476,7 @@ void StickerPanel::create(const Descriptor &descriptor) {
|
||||||
.show = controller->uiShow(),
|
.show = controller->uiShow(),
|
||||||
.st = st::backgroundEmojiPan,
|
.st = st::backgroundEmojiPan,
|
||||||
.level = Window::GifPauseReason::Layer,
|
.level = Window::GifPauseReason::Layer,
|
||||||
.mode = Mode::StickersOnly,
|
.mode = Mode::ChatIntro,
|
||||||
.features = {
|
.features = {
|
||||||
.megagroupSet = false,
|
.megagroupSet = false,
|
||||||
.stickersSettings = false,
|
.stickersSettings = false,
|
||||||
|
|
Loading…
Add table
Reference in a new issue