2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-09-02 15:45:12 +00:00

Implement simple sub-column for topics list.

This commit is contained in:
John Preston
2022-11-30 10:31:33 +04:00
parent beaea9c57d
commit 5d8a2bc7b7
16 changed files with 321 additions and 182 deletions

View File

@@ -372,7 +372,7 @@ void SessionNavigation::showPeerByLinkResolved(
} else if (peer->isForum()) {
const auto itemId = info.messageId;
if (!itemId) {
parentController()->openForum(peer->asChannel(), params);
parentController()->showForum(peer->forum(), params);
} else if (const auto item = peer->owner().message(peer, itemId)) {
showMessageByLinkResolved(item, info);
} else {
@@ -974,13 +974,22 @@ void SessionController::closeFolder() {
_openedFolder = nullptr;
}
void SessionController::openForum(
not_null<ChannelData*> forum,
void SessionController::showForum(
not_null<Data::Forum*> forum,
const SectionShow &params) {
Expects(forum->isForum());
_openedForumLifetime.destroy();
if (_openedForum.current() != forum) {
if (!isPrimary()) {
const auto primary = Core::App().primaryWindow();
if (&primary->account() != &session().account()) {
primary->showAccount(&session().account());
}
if (&primary->account() == &session().account()) {
primary->sessionController()->showForum(forum, params);
}
primary->activate();
return;
}
_shownForumLifetime.destroy();
if (_shownForum.current() != forum) {
resetFakeUnreadWhileOpened();
}
if (forum
@@ -988,24 +997,23 @@ void SessionController::openForum(
&& adaptive().isOneColumn()) {
clearSectionStack(params);
}
_openedForum = forum.get();
if (_openedForum.current() == forum) {
forum->forum()->destroyed(
) | rpl::start_with_next([=] {
closeForum();
showPeerHistory(
forum,
{ anim::type::normal, anim::activation::background });
}, _openedForumLifetime);
}
if (params.activation != anim::activation::background) {
hideLayer();
_shownForum = forum.get();
if (_shownForum.current() != forum) {
return;
}
forum->destroyed(
) | rpl::start_with_next([=, history = forum->history()] {
closeForum();
showPeerHistory(
history,
{ anim::type::normal, anim::activation::background });
}, _shownForumLifetime);
content()->showForum(forum, params);
}
void SessionController::closeForum() {
_openedForumLifetime.destroy();
_openedForum = nullptr;
_shownForumLifetime.destroy();
_shownForum = nullptr;
}
void SessionController::setupPremiumToast() {
@@ -1037,8 +1045,8 @@ const rpl::variable<Data::Folder*> &SessionController::openedFolder() const {
return _openedFolder;
}
const rpl::variable<ChannelData*> &SessionController::openedForum() const {
return _openedForum;
const rpl::variable<Data::Forum*> &SessionController::shownForum() const {
return _shownForum;
}
void SessionController::setActiveChatEntry(Dialogs::RowDescriptor row) {
@@ -1062,9 +1070,9 @@ void SessionController::setActiveChatEntry(Dialogs::RowDescriptor row) {
) | rpl::start_with_next([=] {
clearSectionStack(
{ anim::type::normal, anim::activation::background });
openForum(channel,
showForum(channel->forum(),
{ anim::type::normal, anim::activation::background });
}, _openedForumLifetime);
}, _shownForumLifetime);
}
}
if (session().supportMode()) {
@@ -1674,7 +1682,7 @@ void SessionController::showPeerHistory(
PeerId peerId,
const SectionShow &params,
MsgId msgId) {
content()->ui_showPeerHistory(peerId, params, msgId);
content()->showPeerHistory(peerId, params, msgId);
}
void SessionController::showMessage(