mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-08-31 06:26:18 +00:00
Implement simple sub-column for topics list.
This commit is contained in:
@@ -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 ¶ms) {
|
||||
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 ¶ms,
|
||||
MsgId msgId) {
|
||||
content()->ui_showPeerHistory(peerId, params, msgId);
|
||||
content()->showPeerHistory(peerId, params, msgId);
|
||||
}
|
||||
|
||||
void SessionController::showMessage(
|
||||
|
@@ -69,6 +69,7 @@ namespace Data {
|
||||
struct CloudTheme;
|
||||
enum class CloudThemeType;
|
||||
class Thread;
|
||||
class Forum;
|
||||
class ForumTopic;
|
||||
} // namespace Data
|
||||
|
||||
@@ -151,19 +152,25 @@ struct SectionShow {
|
||||
, activation(activation) {
|
||||
}
|
||||
|
||||
SectionShow withWay(Way newWay) const {
|
||||
[[nodiscard]] SectionShow withWay(Way newWay) const {
|
||||
return SectionShow(newWay, animated, activation);
|
||||
}
|
||||
SectionShow withThirdColumn() const {
|
||||
[[nodiscard]] SectionShow withThirdColumn() const {
|
||||
auto copy = *this;
|
||||
copy.thirdColumn = true;
|
||||
return copy;
|
||||
}
|
||||
[[nodiscard]] SectionShow withChildColumn() const {
|
||||
auto copy = *this;
|
||||
copy.childColumn = true;
|
||||
return copy;
|
||||
}
|
||||
|
||||
Way way = Way::Forward;
|
||||
anim::type animated = anim::type::normal;
|
||||
anim::activation activation = anim::activation::normal;
|
||||
bool thirdColumn = false;
|
||||
bool childColumn = false;
|
||||
Origin origin;
|
||||
|
||||
};
|
||||
@@ -358,11 +365,11 @@ public:
|
||||
void closeFolder();
|
||||
const rpl::variable<Data::Folder*> &openedFolder() const;
|
||||
|
||||
void openForum(
|
||||
not_null<ChannelData*> forum,
|
||||
void showForum(
|
||||
not_null<Data::Forum*> forum,
|
||||
const SectionShow ¶ms = SectionShow::Way::ClearStack);
|
||||
void closeForum();
|
||||
const rpl::variable<ChannelData*> &openedForum() const;
|
||||
const rpl::variable<Data::Forum*> &shownForum() const;
|
||||
|
||||
void setActiveChatEntry(Dialogs::RowDescriptor row);
|
||||
void setActiveChatEntry(Dialogs::Key key);
|
||||
@@ -634,8 +641,8 @@ private:
|
||||
|
||||
PeerData *_showEditPeer = nullptr;
|
||||
rpl::variable<Data::Folder*> _openedFolder;
|
||||
rpl::variable<ChannelData*> _openedForum;
|
||||
rpl::lifetime _openedForumLifetime;
|
||||
rpl::variable<Data::Forum*> _shownForum;
|
||||
rpl::lifetime _shownForumLifetime;
|
||||
|
||||
rpl::event_stream<> _filtersMenuChanged;
|
||||
|
||||
|
Reference in New Issue
Block a user