mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-07-27 07:52:57 +02:00
Improve topics layout management.
This commit is contained in:
parent
853757e611
commit
d0e5ea78a5
7 changed files with 37 additions and 16 deletions
|
@ -2078,6 +2078,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
"lng_action_changed_title" = "{from} changed group name to «{title}»";
|
||||
"lng_action_changed_title_channel" = "Channel name was changed to «{title}»";
|
||||
"lng_action_created_chat" = "{from} created the group «{title}»";
|
||||
"lng_action_created_monoforum" = "Direct messages were enabled in this channel.";
|
||||
"lng_action_ttl_changed" = "{from} set messages to auto-delete in {duration}";
|
||||
"lng_action_ttl_changed_you" = "You set messages to auto-delete in {duration}";
|
||||
"lng_action_ttl_changed_channel" = "Messages in this channel will be automatically deleted after {duration}";
|
||||
|
|
|
@ -1087,7 +1087,7 @@ void Controller::fillDirectMessagesButton() {
|
|||
tr::lng_manage_monoforum(),
|
||||
std::move(label),
|
||||
[=] { showEditDirectMessagesBox(); },
|
||||
{ &st::menuIconChatBubble });
|
||||
{ .icon = &st::menuIconChatBubble, .newBadge = true });
|
||||
}
|
||||
//
|
||||
//void Controller::fillInviteLinkButton() {
|
||||
|
@ -1127,7 +1127,7 @@ void Controller::fillForumButton() {
|
|||
changes->events_starting_with({}) | rpl::map(label),
|
||||
[] {},
|
||||
st::manageGroupTopicsButton,
|
||||
{ &st::menuIconTopics }));
|
||||
{ .icon = &st::menuIconTopics, .newBadge = true }));
|
||||
|
||||
button->setClickedCallback(crl::guard(this, [=] {
|
||||
if (!*_forumSavedValue && _controls.forumToggleLocked) {
|
||||
|
|
|
@ -81,6 +81,7 @@ LayoutButton::LayoutButton(
|
|||
const auto icon = iconWidget.release();
|
||||
setClickedCallback([=] {
|
||||
group->setValue(type);
|
||||
iconAnimate(anim::repeat::once);
|
||||
});
|
||||
group->value() | rpl::start_with_next([=](LayoutType value) {
|
||||
const auto active = (value == type);
|
||||
|
@ -93,9 +94,6 @@ LayoutButton::LayoutButton(
|
|||
}
|
||||
_active = active;
|
||||
_text.update();
|
||||
if (_active) {
|
||||
iconAnimate(anim::repeat::once);
|
||||
}
|
||||
_activeAnimation.start([=] {
|
||||
icon->update();
|
||||
}, _active ? 0. : 1., _active ? 0. : 1., st::fadeWrapDuration);
|
||||
|
@ -170,6 +168,10 @@ void ToggleTopicsBox(
|
|||
st::settingsButtonNoIcon));
|
||||
toggle->toggleOn(rpl::single(enabled));
|
||||
|
||||
Ui::AddSkip(container);
|
||||
Ui::AddDivider(container);
|
||||
Ui::AddSkip(container);
|
||||
|
||||
const auto group = std::make_shared<Ui::RadioenumGroup<LayoutType>>(tabs
|
||||
? LayoutType::Tabs
|
||||
: LayoutType::List);
|
||||
|
|
|
@ -110,6 +110,7 @@ void TopicsView::prepare(MsgId frontRootId, Fn<void()> customEmojiRepaint) {
|
|||
_jumpToTopic = false;
|
||||
}
|
||||
}
|
||||
_allLoaded = _forum->topicsList()->loaded();
|
||||
}
|
||||
|
||||
void TopicsView::prepare(PeerId frontPeerId, Fn<void()> customEmojiRepaint) {
|
||||
|
@ -182,6 +183,7 @@ void TopicsView::prepare(PeerId frontPeerId, Fn<void()> customEmojiRepaint) {
|
|||
_jumpToTopic = false;
|
||||
}
|
||||
}
|
||||
_allLoaded = _monoforum->chatsList()->loaded();
|
||||
}
|
||||
|
||||
int TopicsView::jumpToTopicWidth() const {
|
||||
|
@ -207,10 +209,13 @@ void TopicsView::paint(
|
|||
rect.setWidth(rect.width() - _lastTopicJumpGeometry.rightCut);
|
||||
auto skipBig = _jumpToTopic && !context.active;
|
||||
if (_titles.empty()) {
|
||||
const auto text = (_monoforum && _allLoaded)
|
||||
? tr::lng_filters_no_chats(tr::now)
|
||||
: tr::lng_contacts_loading(tr::now);
|
||||
p.drawText(
|
||||
rect.x(),
|
||||
rect.y() + st::normalFont->ascent,
|
||||
tr::lng_contacts_loading(tr::now));
|
||||
text);
|
||||
return;
|
||||
}
|
||||
for (const auto &title : _titles) {
|
||||
|
|
|
@ -121,6 +121,7 @@ private:
|
|||
JumpToLastGeometry _lastTopicJumpGeometry;
|
||||
int _version = -1;
|
||||
bool _jumpToTopic = false;
|
||||
bool _allLoaded = false;
|
||||
|
||||
rpl::lifetime _lifetime;
|
||||
|
||||
|
|
|
@ -4632,20 +4632,30 @@ void HistoryItem::setServiceMessageByAction(const MTPmessageAction &action) {
|
|||
|
||||
auto prepareChatCreate = [this](const MTPDmessageActionChatCreate &action) {
|
||||
auto result = PreparedServiceText();
|
||||
result.links.push_back(fromLink());
|
||||
result.text = tr::lng_action_created_chat(
|
||||
tr::now,
|
||||
lt_from,
|
||||
fromLinkText(), // Link 1.
|
||||
lt_title,
|
||||
{ .text = qs(action.vtitle()) },
|
||||
Ui::Text::WithEntities);
|
||||
if (_history->peer->isMonoforum()) {
|
||||
result.text = tr::lng_action_created_monoforum(
|
||||
tr::now,
|
||||
Ui::Text::WithEntities);
|
||||
} else {
|
||||
result.links.push_back(fromLink());
|
||||
result.text = tr::lng_action_created_chat(
|
||||
tr::now,
|
||||
lt_from,
|
||||
fromLinkText(), // Link 1.
|
||||
lt_title,
|
||||
{ .text = qs(action.vtitle()) },
|
||||
Ui::Text::WithEntities);
|
||||
}
|
||||
return result;
|
||||
};
|
||||
|
||||
auto prepareChannelCreate = [this](const MTPDmessageActionChannelCreate &action) {
|
||||
auto result = PreparedServiceText();
|
||||
if (isPost()) {
|
||||
if (_history->peer->isMonoforum()) {
|
||||
result.text = tr::lng_action_created_monoforum(
|
||||
tr::now,
|
||||
Ui::Text::WithEntities);
|
||||
} else if (isPost()) {
|
||||
result.text = tr::lng_action_created_channel(
|
||||
tr::now,
|
||||
Ui::Text::WithEntities);
|
||||
|
|
|
@ -1695,7 +1695,9 @@ void TopBarWidget::updateOnlineDisplay() {
|
|||
} else if (const auto monoforum = peer->monoforum()) {
|
||||
const auto chats = monoforum->chatsList();
|
||||
const auto count = chats->fullSize().current();
|
||||
text = tr::lng_filters_chats_count(tr::now, lt_count, count);
|
||||
text = (count > 0)
|
||||
? tr::lng_filters_chats_count(tr::now, lt_count, count)
|
||||
: tr::lng_filters_no_chats(tr::now);
|
||||
} else if (peer->isMonoforum()) {
|
||||
text = tr::lng_chat_status_direct(tr::now);
|
||||
} else if (const auto channel = peer->asChannel()) {
|
||||
|
|
Loading…
Add table
Reference in a new issue