Add "Show Topics List" button to topic profile.
This commit is contained in:
parent
d0d2a4f488
commit
4a8b5c3015
|
@ -3559,6 +3559,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
"lng_forum_no_messages" = "No messages";
|
"lng_forum_no_messages" = "No messages";
|
||||||
"lng_forum_messages#one" = "{count} message";
|
"lng_forum_messages#one" = "{count} message";
|
||||||
"lng_forum_messages#other" = "{count} messages";
|
"lng_forum_messages#other" = "{count} messages";
|
||||||
|
"lng_forum_show_topics_list" = "Show Topics List";
|
||||||
|
|
||||||
// Wnd specific
|
// Wnd specific
|
||||||
|
|
||||||
|
|
|
@ -194,6 +194,7 @@ private:
|
||||||
object_ptr<Ui::RpWidget> setupInfo();
|
object_ptr<Ui::RpWidget> setupInfo();
|
||||||
object_ptr<Ui::RpWidget> setupMuteToggle();
|
object_ptr<Ui::RpWidget> setupMuteToggle();
|
||||||
void setupMainButtons();
|
void setupMainButtons();
|
||||||
|
Ui::MultiSlideTracker fillTopicButtons();
|
||||||
Ui::MultiSlideTracker fillUserButtons(
|
Ui::MultiSlideTracker fillUserButtons(
|
||||||
not_null<UserData*> user);
|
not_null<UserData*> user);
|
||||||
Ui::MultiSlideTracker fillChannelButtons(
|
Ui::MultiSlideTracker fillChannelButtons(
|
||||||
|
@ -538,11 +539,15 @@ void DetailsFiller::setupMainButtons() {
|
||||||
auto tracker = callback();
|
auto tracker = callback();
|
||||||
topSkip->toggleOn(std::move(tracker).atLeastOneShownValue());
|
topSkip->toggleOn(std::move(tracker).atLeastOneShownValue());
|
||||||
};
|
};
|
||||||
if (auto user = _peer->asUser()) {
|
if (_topic) {
|
||||||
|
wrapButtons([=] {
|
||||||
|
return fillTopicButtons();
|
||||||
|
});
|
||||||
|
} else if (const auto user = _peer->asUser()) {
|
||||||
wrapButtons([=] {
|
wrapButtons([=] {
|
||||||
return fillUserButtons(user);
|
return fillUserButtons(user);
|
||||||
});
|
});
|
||||||
} else if (auto channel = _peer->asChannel()) {
|
} else if (const auto channel = _peer->asChannel()) {
|
||||||
if (!channel->isMegagroup()) {
|
if (!channel->isMegagroup()) {
|
||||||
wrapButtons([=] {
|
wrapButtons([=] {
|
||||||
return fillChannelButtons(channel);
|
return fillChannelButtons(channel);
|
||||||
|
@ -551,6 +556,26 @@ void DetailsFiller::setupMainButtons() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Ui::MultiSlideTracker DetailsFiller::fillTopicButtons() {
|
||||||
|
using namespace rpl::mappers;
|
||||||
|
|
||||||
|
Ui::MultiSlideTracker tracker;
|
||||||
|
const auto window = _controller->parentController();
|
||||||
|
|
||||||
|
const auto channel = _topic->channel().get();
|
||||||
|
auto showTopicsVisible = rpl::combine(
|
||||||
|
window->adaptive().oneColumnValue(),
|
||||||
|
window->openedForum().value(),
|
||||||
|
_1 || (_2 != channel));
|
||||||
|
AddMainButton(
|
||||||
|
_wrap,
|
||||||
|
tr::lng_forum_show_topics_list(),
|
||||||
|
std::move(showTopicsVisible),
|
||||||
|
[=] { window->openForum(channel); },
|
||||||
|
tracker);
|
||||||
|
return tracker;
|
||||||
|
}
|
||||||
|
|
||||||
Ui::MultiSlideTracker DetailsFiller::fillUserButtons(
|
Ui::MultiSlideTracker DetailsFiller::fillUserButtons(
|
||||||
not_null<UserData*> user) {
|
not_null<UserData*> user) {
|
||||||
using namespace rpl::mappers;
|
using namespace rpl::mappers;
|
||||||
|
|
|
@ -983,7 +983,9 @@ void SessionController::openForum(
|
||||||
if (_openedForum.current() != forum) {
|
if (_openedForum.current() != forum) {
|
||||||
resetFakeUnreadWhileOpened();
|
resetFakeUnreadWhileOpened();
|
||||||
}
|
}
|
||||||
if (forum && _activeChatEntry.current().key.peer()) {
|
if (forum
|
||||||
|
&& _activeChatEntry.current().key.peer()
|
||||||
|
&& adaptive().isOneColumn()) {
|
||||||
clearSectionStack(params);
|
clearSectionStack(params);
|
||||||
}
|
}
|
||||||
_openedForum = forum.get();
|
_openedForum = forum.get();
|
||||||
|
@ -996,6 +998,9 @@ void SessionController::openForum(
|
||||||
{ anim::type::normal, anim::activation::background });
|
{ anim::type::normal, anim::activation::background });
|
||||||
}, _openedForumLifetime);
|
}, _openedForumLifetime);
|
||||||
}
|
}
|
||||||
|
if (params.activation != anim::activation::background) {
|
||||||
|
hideLayer();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SessionController::closeForum() {
|
void SessionController::closeForum() {
|
||||||
|
|
Loading…
Reference in New Issue