Wrapped raw SectionMemento with unique_ptr.

This commit is contained in:
23rd 2020-11-22 01:37:05 +03:00 committed by John Preston
parent de6b460754
commit c8643aa1ee
25 changed files with 67 additions and 63 deletions

View File

@ -3412,7 +3412,7 @@ void ApiWrap::jumpToHistoryDate(not_null<PeerData*> peer, const QDate &date) {
// requestMessageAfterDate(feed, date, [=](Data::MessagePosition result) { // requestMessageAfterDate(feed, date, [=](Data::MessagePosition result) {
// Ui::hideLayer(); // Ui::hideLayer();
// App::wnd()->sessionController()->showSection( // App::wnd()->sessionController()->showSection(
// HistoryFeed::Memento(feed, result)); // std::make_unique<HistoryFeed::Memento>(feed, result));
// }); // });
//} //}

View File

@ -1000,13 +1000,15 @@ void Controller::fillManageSection() {
st::infoIconBlacklist); st::infoIconBlacklist);
} }
if (hasRecentActions) { if (hasRecentActions) {
auto callback = [=] {
_navigation->showSection(
std::make_unique<AdminLog::SectionMemento>(channel));
};
AddButtonWithCount( AddButtonWithCount(
_controls.buttonsLayout, _controls.buttonsLayout,
tr::lng_manage_peer_recent_actions(), tr::lng_manage_peer_recent_actions(),
rpl::single(QString()), //Empty count. rpl::single(QString()), //Empty count.
[=] { std::move(callback),
_navigation->showSection(AdminLog::SectionMemento(channel));
},
st::infoIconRecentActions); st::infoIconRecentActions);
} }

View File

@ -1591,7 +1591,7 @@ void UpdateApplication() {
if (const auto window = App::wnd()) { if (const auto window = App::wnd()) {
if (const auto controller = window->sessionController()) { if (const auto controller = window->sessionController()) {
controller->showSection( controller->showSection(
Info::Memento( std::make_unique<Info::Memento>(
Info::Settings::Tag{ controller->session().user() }, Info::Settings::Tag{ controller->session().user() },
Info::Section::SettingsType::Advanced), Info::Section::SettingsType::Advanced),
Window::SectionShow()); Window::SectionShow());

View File

@ -56,7 +56,7 @@ void SharedMediaShowOverview(
return; return;
} }
} }
windows.front()->showSection(Info::Memento( windows.front()->showSection(std::make_unique<Info::Memento>(
history->peer, history->peer,
Info::Section(type))); Info::Section(type)));
} }

View File

@ -1776,7 +1776,7 @@ bool Widget::onCancelSearch() {
if (const auto peer = _searchInChat.peer()) { if (const auto peer = _searchInChat.peer()) {
Ui::showPeerHistory(peer, ShowAtUnreadMsgId); Ui::showPeerHistory(peer, ShowAtUnreadMsgId);
//} else if (const auto feed = _searchInChat.feed()) { // #feed //} else if (const auto feed = _searchInChat.feed()) { // #feed
// controller()->showSection(HistoryFeed::Memento(feed)); // controller()->showSection(std::make_unique<HistoryFeed::Memento>(feed));
} else { } else {
Unexpected("Empty key in onCancelSearch()."); Unexpected("Empty key in onCancelSearch().");
} }
@ -1800,7 +1800,7 @@ void Widget::onCancelSearchInChat() {
if (const auto peer = _searchInChat.peer()) { if (const auto peer = _searchInChat.peer()) {
Ui::showPeerHistory(peer, ShowAtUnreadMsgId); Ui::showPeerHistory(peer, ShowAtUnreadMsgId);
//} else if (const auto feed = _searchInChat.feed()) { // #feed //} else if (const auto feed = _searchInChat.feed()) { // #feed
// controller()->showSection(HistoryFeed::Memento(feed)); // controller()->showSection(std::make_unique<HistoryFeed::Memento>(feed));
} else { } else {
Unexpected("Empty key in onCancelSearchInPeer()."); Unexpected("Empty key in onCancelSearchInPeer().");
} }

View File

@ -687,7 +687,7 @@ HistoryWidget::HistoryWidget(
cancelReply(lastKeyboardUsed); cancelReply(lastKeyboardUsed);
crl::on_main(this, [=, history = action.history]{ crl::on_main(this, [=, history = action.history]{
controller->showSection( controller->showSection(
HistoryView::ScheduledMemento(history)); std::make_unique<HistoryView::ScheduledMemento>(history));
}); });
} else { } else {
fastShowAtEnd(action.history); fastShowAtEnd(action.history);
@ -1505,7 +1505,7 @@ bool HistoryWidget::notify_switchInlineBotButtonReceived(const QString &query, U
} else if (to.section == Section::Scheduled) { } else if (to.section == Section::Scheduled) {
history->setDraft(Data::DraftKey::Scheduled(), std::move(draft)); history->setDraft(Data::DraftKey::Scheduled(), std::move(draft));
controller()->showSection( controller()->showSection(
HistoryView::ScheduledMemento(history)); std::make_unique<HistoryView::ScheduledMemento>(history));
} else { } else {
history->setLocalDraft(std::move(draft)); history->setLocalDraft(std::move(draft));
if (history == _history) { if (history == _history) {
@ -2073,7 +2073,7 @@ void HistoryWidget::refreshScheduledToggle() {
_scheduled->show(); _scheduled->show();
_scheduled->addClickHandler([=] { _scheduled->addClickHandler([=] {
controller()->showSection( controller()->showSection(
HistoryView::ScheduledMemento(_history)); std::make_unique<HistoryView::ScheduledMemento>(_history));
}); });
orderWidgets(); // Raise drag areas to the top. orderWidgets(); // Raise drag areas to the top.
} else if (_scheduled && !has) { } else if (_scheduled && !has) {
@ -3883,7 +3883,7 @@ bool HistoryWidget::pushTabbedSelectorToThirdSection(
Core::App().settings().setTabbedReplacedWithInfo(false); Core::App().settings().setTabbedReplacedWithInfo(false);
controller()->resizeForThirdSection(); controller()->resizeForThirdSection();
controller()->showSection( controller()->showSection(
ChatHelpers::TabbedMemento(), std::make_unique<ChatHelpers::TabbedMemento>(),
params.withThirdColumn()); params.withThirdColumn());
return true; return true;
} }
@ -5382,7 +5382,7 @@ void HistoryWidget::refreshPinnedBarButton(bool many) {
const auto id = _pinnedTracker->currentMessageId(); const auto id = _pinnedTracker->currentMessageId();
if (id.message) { if (id.message) {
controller()->showSection( controller()->showSection(
HistoryView::PinnedMemento( std::make_unique<HistoryView::PinnedMemento>(
_history, _history,
((!_migrated || id.message.channel) ((!_migrated || id.message.channel)
? id.message.msg ? id.message.msg

View File

@ -1736,7 +1736,7 @@ bool ComposeControls::pushTabbedSelectorToThirdSection(
&st::historyRecordVoiceRippleBgActive); &st::historyRecordVoiceRippleBgActive);
_window->resizeForThirdSection(); _window->resizeForThirdSection();
_window->showSection( _window->showSection(
ChatHelpers::TabbedMemento(), std::make_unique<ChatHelpers::TabbedMemento>(),
params.withThirdColumn()); params.withThirdColumn());
return true; return true;
} }

View File

@ -493,15 +493,15 @@ void TopBarWidget::infoClicked() {
} else if (key.folder()) { } else if (key.folder()) {
_controller->closeFolder(); _controller->closeFolder();
//} else if (const auto feed = _activeChat.feed()) { // #feed //} else if (const auto feed = _activeChat.feed()) { // #feed
// _controller->showSection(Info::Memento( // _controller->showSection(std::make_unique<Info::Memento>(
// feed, // feed,
// Info::Section(Info::Section::Type::Profile))); // Info::Section(Info::Section::Type::Profile)));
} else if (key.peer()->isSelf()) { } else if (key.peer()->isSelf()) {
_controller->showSection(Info::Memento( _controller->showSection(std::make_unique<Info::Memento>(
key.peer(), key.peer(),
Info::Section(Storage::SharedMediaType::Photo))); Info::Section(Storage::SharedMediaType::Photo)));
} else if (key.peer()->isRepliesChat()) { } else if (key.peer()->isRepliesChat()) {
_controller->showSection(Info::Memento( _controller->showSection(std::make_unique<Info::Memento>(
key.peer(), key.peer(),
Info::Section(Storage::SharedMediaType::Photo))); Info::Section(Storage::SharedMediaType::Photo)));
} else { } else {

View File

@ -281,7 +281,7 @@ void Channels::showChannelsWithSearch(bool withSearch) {
auto mementoStack = std::vector<std::unique_ptr<ContentMemento>>(); auto mementoStack = std::vector<std::unique_ptr<ContentMemento>>();
mementoStack.push_back(std::move(contentMemento)); mementoStack.push_back(std::move(contentMemento));
_controller->showSection( _controller->showSection(
Info::Memento(std::move(mementoStack))); std::make_unique<Info::Memento>(std::move(mementoStack)));
} }
void Channels::visibleTopBottomUpdated( void Channels::visibleTopBottomUpdated(

View File

@ -84,7 +84,7 @@ void Cover::refreshStatusText() {
}(); }();
_status->setRichText(textcmdLink(1, statusText)); _status->setRichText(textcmdLink(1, statusText));
_status->setLink(1, std::make_shared<LambdaClickHandler>([=] { _status->setLink(1, std::make_shared<LambdaClickHandler>([=] {
_controller->showSection(Info::Memento( _controller->showSection(std::make_unique<Info::Memento>(
_feed, _feed,
Section::Type::Channels)); Section::Type::Channels));
})); }));

View File

@ -123,7 +123,7 @@ PollData *AbstractController::poll() const {
} }
void AbstractController::showSection( void AbstractController::showSection(
Window::SectionMemento &&memento, std::unique_ptr<Window::SectionMemento> &&memento,
const Window::SectionShow &params) { const Window::SectionShow &params) {
return parentController()->showSection(std::move(memento), params); return parentController()->showSection(std::move(memento), params);
} }
@ -170,7 +170,7 @@ void Controller::setupMigrationViewer() {
const auto section = _section; const auto section = _section;
InvokeQueued(_widget, [=] { InvokeQueued(_widget, [=] {
window->showSection( window->showSection(
Memento(peer, section), std::make_unique<Memento>(peer, section),
Window::SectionShow( Window::SectionShow(
Window::SectionShow::Way::Backward, Window::SectionShow::Way::Backward,
anim::type::instant, anim::type::instant,
@ -261,9 +261,9 @@ void Controller::saveSearchState(not_null<ContentMemento*> memento) {
} }
void Controller::showSection( void Controller::showSection(
Window::SectionMemento &&memento, std::unique_ptr<Window::SectionMemento> &&memento,
const Window::SectionShow &params) { const Window::SectionShow &params) {
if (!_widget->showInternal(&memento, params)) { if (!_widget->showInternal(memento.get(), params)) {
AbstractController::showSection(std::move(memento), params); AbstractController::showSection(std::move(memento), params);
} }
} }

View File

@ -136,7 +136,7 @@ public:
virtual rpl::producer<QString> mediaSourceQueryValue() const; virtual rpl::producer<QString> mediaSourceQueryValue() const;
void showSection( void showSection(
Window::SectionMemento &&memento, std::unique_ptr<Window::SectionMemento> &&memento,
const Window::SectionShow &params = Window::SectionShow()) override; const Window::SectionShow &params = Window::SectionShow()) override;
void showBackFromStack( void showBackFromStack(
const Window::SectionShow &params = Window::SectionShow()) override; const Window::SectionShow &params = Window::SectionShow()) override;
@ -202,7 +202,7 @@ public:
void saveSearchState(not_null<ContentMemento*> memento); void saveSearchState(not_null<ContentMemento*> memento);
void showSection( void showSection(
Window::SectionMemento &&memento, std::unique_ptr<Window::SectionMemento> &&memento,
const Window::SectionShow &params = Window::SectionShow()) override; const Window::SectionShow &params = Window::SectionShow()) override;
void showBackFromStack( void showBackFromStack(
const Window::SectionShow &params = Window::SectionShow()) override; const Window::SectionShow &params = Window::SectionShow()) override;

View File

@ -106,7 +106,7 @@ void LayerWidget::parentResized() {
Ui::FocusPersister persister(this); Ui::FocusPersister persister(this);
restoreFloatPlayerDelegate(); restoreFloatPlayerDelegate();
auto memento = MoveMemento(std::move(_content)); auto memento = std::make_unique<MoveMemento>(std::move(_content));
// We want to call hideSpecialLayer synchronously to avoid glitches, // We want to call hideSpecialLayer synchronously to avoid glitches,
// but we can't destroy LayerStackWidget from its' resizeEvent, // but we can't destroy LayerStackWidget from its' resizeEvent,

View File

@ -101,8 +101,8 @@ Section Memento::DefaultSection(not_null<PeerData*> peer) {
// return Section(Section::Type::Profile); // return Section(Section::Type::Profile);
//} //}
Memento Memento::Default(not_null<PeerData*> peer) { std::unique_ptr<Memento> Memento::Default(not_null<PeerData*> peer) {
return Memento(peer, DefaultSection(peer)); return std::make_unique<Memento>(peer, DefaultSection(peer));
} }
// // #feed // // #feed
//Memento Memento::Default(Dialogs::Key key) { //Memento Memento::Default(Dialogs::Key key) {

View File

@ -62,7 +62,7 @@ public:
static Section DefaultSection(not_null<PeerData*> peer); static Section DefaultSection(not_null<PeerData*> peer);
//static Section DefaultSection(Dialogs::Key key); // #feed //static Section DefaultSection(Dialogs::Key key); // #feed
static Memento Default(not_null<PeerData*> peer); static std::unique_ptr<Memento> Default(not_null<PeerData*> peer);
//static Memento Default(Dialogs::Key key); // #feed //static Memento Default(Dialogs::Key key); // #feed
~Memento(); ~Memento();

View File

@ -92,7 +92,7 @@ inline auto AddButton(
tracker)->entity(); tracker)->entity();
result->addClickHandler([=] { result->addClickHandler([=] {
navigation->showSection( navigation->showSection(
Info::Memento(peer, Section(type))); std::make_unique<Info::Memento>(peer, Section(type)));
}); });
return result; return result;
}; };
@ -111,7 +111,7 @@ inline auto AddCommonGroupsButton(
tracker)->entity(); tracker)->entity();
result->addClickHandler([=] { result->addClickHandler([=] {
navigation->showSection( navigation->showSection(
Info::Memento(user, Section::Type::CommonGroups)); std::make_unique<Info::Memento>(user, Section::Type::CommonGroups));
}); });
return result; return result;
}; };

View File

@ -843,7 +843,7 @@ object_ptr<Ui::RpWidget> SetupChannelMembers(
lt_count_decimal, lt_count_decimal,
MembersCountValue(channel) | tr::to_count()); MembersCountValue(channel) | tr::to_count());
auto membersCallback = [=] { auto membersCallback = [=] {
controller->showSection(Info::Memento( controller->showSection(std::make_unique<Info::Memento>(
channel, channel,
Section::Type::Members)); Section::Type::Members));
}; };

View File

@ -81,7 +81,8 @@ object_ptr<Ui::RpWidget> InnerWidget::setupContent(
_controller->parentController())); _controller->parentController()));
_cover->showSection( _cover->showSection(
) | rpl::start_with_next([=](Section section) { ) | rpl::start_with_next([=](Section section) {
_controller->showSection(Info::Memento(_peer, section)); _controller->showSection(
std::make_unique<Info::Memento>(_peer, section));
}, _cover->lifetime()); }, _cover->lifetime());
_cover->setOnlineCount(rpl::single(0)); _cover->setOnlineCount(rpl::single(0));
auto details = SetupDetails(_controller, parent, _peer); auto details = SetupDetails(_controller, parent, _peer);

View File

@ -349,7 +349,7 @@ void Members::showMembersWithSearch(bool withSearch) {
auto mementoStack = std::vector<std::unique_ptr<ContentMemento>>(); auto mementoStack = std::vector<std::unique_ptr<ContentMemento>>();
mementoStack.push_back(std::move(contentMemento)); mementoStack.push_back(std::move(contentMemento));
_controller->showSection( _controller->showSection(
Info::Memento(std::move(mementoStack))); std::make_unique<Info::Memento>(std::move(mementoStack)));
} }
//void Members::toggleSearch(anim::type animated) { //void Members::toggleSearch(anim::type animated) {

View File

@ -192,8 +192,8 @@ public:
StackItemType type() const override { StackItemType type() const override {
return SectionStackItem; return SectionStackItem;
} }
Window::SectionMemento *memento() const { std::unique_ptr<Window::SectionMemento> takeMemento() {
return _memento.get(); return std::move(_memento);
} }
private: private:
@ -1599,10 +1599,10 @@ void MainWidget::saveSectionInStack() {
} }
void MainWidget::showSection( void MainWidget::showSection(
Window::SectionMemento &&memento, std::unique_ptr<Window::SectionMemento> &&memento,
const SectionShow &params) { const SectionShow &params) {
if (_mainSection && _mainSection->showInternal( if (_mainSection && _mainSection->showInternal(
&memento, memento.get(),
params)) { params)) {
if (const auto entry = _mainSection->activeChat(); entry.key) { if (const auto entry = _mainSection->activeChat(); entry.key) {
_controller->setActiveChatEntry(entry); _controller->setActiveChatEntry(entry);
@ -1720,7 +1720,7 @@ Window::SectionSlideParams MainWidget::prepareDialogsAnimation() {
} }
void MainWidget::showNewSection( void MainWidget::showNewSection(
Window::SectionMemento &&memento, std::unique_ptr<Window::SectionMemento> &&memento,
const SectionShow &params) { const SectionShow &params) {
using Column = Window::Column; using Column = Window::Column;
@ -1732,7 +1732,7 @@ void MainWidget::showNewSection(
st::columnMinimalWidthThird, st::columnMinimalWidthThird,
height() - thirdSectionTop); height() - thirdSectionTop);
auto newThirdSection = (Adaptive::ThreeColumn() && params.thirdColumn) auto newThirdSection = (Adaptive::ThreeColumn() && params.thirdColumn)
? memento.createWidget( ? memento->createWidget(
this, this,
_controller, _controller,
Column::Third, Column::Third,
@ -1741,7 +1741,7 @@ void MainWidget::showNewSection(
const auto layerRect = parentWidget()->rect(); const auto layerRect = parentWidget()->rect();
if (newThirdSection) { if (newThirdSection) {
saveInStack = false; saveInStack = false;
} else if (auto layer = memento.createLayer(_controller, layerRect)) { } else if (auto layer = memento->createLayer(_controller, layerRect)) {
if (params.activation != anim::activation::background) { if (params.activation != anim::activation::background) {
Ui::hideLayer(anim::type::instant); Ui::hideLayer(anim::type::instant);
} }
@ -1766,7 +1766,7 @@ void MainWidget::showNewSection(
height() - mainSectionTop); height() - mainSectionTop);
auto newMainSection = newThirdSection auto newMainSection = newThirdSection
? nullptr ? nullptr
: memento.createWidget( : memento->createWidget(
this, this,
_controller, _controller,
Adaptive::OneColumn() ? Column::First : Column::Second, Adaptive::OneColumn() ? Column::First : Column::Second,
@ -1777,7 +1777,7 @@ void MainWidget::showNewSection(
if (_a_show.animating() if (_a_show.animating()
|| Core::App().passcodeLocked() || Core::App().passcodeLocked()
|| (params.animated == anim::type::instant) || (params.animated == anim::type::instant)
|| memento.instant()) { || memento->instant()) {
return false; return false;
} }
if (!Adaptive::OneColumn() && params.way == SectionShow::Way::ClearStack) { if (!Adaptive::OneColumn() && params.way == SectionShow::Way::ClearStack) {
@ -1908,12 +1908,12 @@ void MainWidget::showBackFromStack(
} else if (item->type() == SectionStackItem) { } else if (item->type() == SectionStackItem) {
auto sectionItem = static_cast<StackItemSection*>(item.get()); auto sectionItem = static_cast<StackItemSection*>(item.get());
showNewSection( showNewSection(
std::move(*sectionItem->memento()), sectionItem->takeMemento(),
params.withWay(SectionShow::Way::Backward)); params.withWay(SectionShow::Way::Backward));
} }
if (_thirdSectionFromStack && _thirdSection) { if (_thirdSectionFromStack && _thirdSection) {
_controller->showSection( _controller->showSection(
std::move(*base::take(_thirdSectionFromStack)), base::take(_thirdSectionFromStack),
SectionShow( SectionShow(
SectionShow::Way::ClearStack, SectionShow::Way::ClearStack,
anim::type::instant, anim::type::instant,
@ -2455,7 +2455,7 @@ void MainWidget::updateThirdColumnToCurrentChat(
} }
_controller->showSection( _controller->showSection(
std::move(*thirdSectionForCurrentMainSection(key)), thirdSectionForCurrentMainSection(key),
params.withThirdColumn()); params.withThirdColumn());
}; };
auto switchTabbedFast = [&](not_null<PeerData*> peer) { auto switchTabbedFast = [&](not_null<PeerData*> peer) {

View File

@ -134,7 +134,7 @@ public:
int backgroundFromY() const; int backgroundFromY() const;
void showSection( void showSection(
Window::SectionMemento &&memento, std::unique_ptr<Window::SectionMemento> &&memento,
const SectionShow &params); const SectionShow &params);
void updateColumnLayout(); void updateColumnLayout();
bool stackIsEmpty() const; bool stackIsEmpty() const;
@ -271,7 +271,7 @@ private:
Window::SectionSlideParams prepareShowAnimation( Window::SectionSlideParams prepareShowAnimation(
bool willHaveTopBarShadow); bool willHaveTopBarShadow);
void showNewSection( void showNewSection(
Window::SectionMemento &&memento, std::unique_ptr<Window::SectionMemento> &&memento,
const SectionShow &params); const SectionShow &params);
void dropMainSection(Window::SectionWidget *widget); void dropMainSection(Window::SectionWidget *widget);

View File

@ -650,7 +650,7 @@ void Manager::openNotificationMessage(
Ui::showPeerHistory(history, messageId); Ui::showPeerHistory(history, messageId);
//} else if (messageFeed) { // #feed //} else if (messageFeed) { // #feed
// App::wnd()->sessionController()->showSection( // App::wnd()->sessionController()->showSection(
// HistoryFeed::Memento(messageFeed)); // std::make_unique<HistoryFeed::Memento>(messageFeed));
} else { } else {
Ui::showPeerHistory(history, ShowAtUnreadMsgId); Ui::showPeerHistory(history, ShowAtUnreadMsgId);
} }

View File

@ -714,7 +714,7 @@ void Filler::addTogglesForArchive() {
// const auto controller = _controller; // const auto controller = _controller;
// const auto feed = _feed; // const auto feed = _feed;
// _addAction(tr::lng_context_view_feed_info(tr::now), [=] { // _addAction(tr::lng_context_view_feed_info(tr::now), [=] {
// controller->showSection(Info::Memento( // controller->showSection(std::make_unique<Info::Memento>(
// feed, // feed,
// Info::Section(Info::Section::Type::Profile))); // Info::Section(Info::Section::Type::Profile)));
// }); // });

View File

@ -253,12 +253,12 @@ void SessionNavigation::showRepliesForMessage(
const auto channelId = history->channelId(); const auto channelId = history->channelId();
//const auto item = _session->data().message(channelId, rootId); //const auto item = _session->data().message(channelId, rootId);
//if (!commentId && (!item || !item->repliesAreComments())) { //if (!commentId && (!item || !item->repliesAreComments())) {
// showSection(HistoryView::RepliesMemento(history, rootId)); // showSection(std::make_unique<HistoryView::RepliesMemento>(history, rootId));
// return; // return;
//} else if (const auto id = item ? item->commentsItemId() : FullMsgId()) { //} else if (const auto id = item ? item->commentsItemId() : FullMsgId()) {
// if (const auto commentsItem = _session->data().message(id)) { // if (const auto commentsItem = _session->data().message(id)) {
// showSection( // showSection(
// HistoryView::RepliesMemento(commentsItem)); // std::make_unique<HistoryView::RepliesMemento>(commentsItem));
// return; // return;
// } // }
//} //}
@ -314,8 +314,9 @@ void SessionNavigation::showRepliesForMessage(
post->setRepliesOutboxReadTill(readTill->v); post->setRepliesOutboxReadTill(readTill->v);
} }
} }
showSection( showSection(std::make_unique<HistoryView::RepliesMemento>(
HistoryView::RepliesMemento(item, commentId)); item,
commentId));
} }
}); });
}).fail([=](const RPCError &error) { }).fail([=](const RPCError &error) {
@ -341,7 +342,7 @@ void SessionNavigation::showPeerInfo(
// Core::App().settings().setThirdSectionInfoEnabled(true); // Core::App().settings().setThirdSectionInfoEnabled(true);
// Core::App().saveSettingsDelayed(); // Core::App().saveSettingsDelayed();
//} //}
showSection(Info::Memento(peer), params); showSection(std::make_unique<Info::Memento>(peer), params);
} }
void SessionNavigation::showPeerInfo( void SessionNavigation::showPeerInfo(
@ -374,7 +375,7 @@ void SessionNavigation::showSettings(
Settings::Type type, Settings::Type type,
const SectionShow &params) { const SectionShow &params) {
showSection( showSection(
Info::Memento( std::make_unique<Info::Memento>(
Info::Settings::Tag{ _session->user() }, Info::Settings::Tag{ _session->user() },
Info::Section(type)), Info::Section(type)),
params); params);
@ -388,7 +389,7 @@ void SessionNavigation::showPollResults(
not_null<PollData*> poll, not_null<PollData*> poll,
FullMsgId contextId, FullMsgId contextId,
const SectionShow &params) { const SectionShow &params) {
showSection(Info::Memento(poll, contextId), params); showSection(std::make_unique<Info::Memento>(poll, contextId), params);
} }
SessionController::SessionController( SessionController::SessionController(
@ -639,9 +640,9 @@ bool SessionController::jumpToChatListEntry(Dialogs::RowDescriptor row) {
return true; return true;
//} else if (const auto feed = row.key.feed()) { // #feed //} else if (const auto feed = row.key.feed()) { // #feed
// if (const auto item = session().data().message(row.fullId)) { // if (const auto item = session().data().message(row.fullId)) {
// showSection(HistoryFeed::Memento(feed, item->position())); // showSection(std::make_unique<HistoryFeed::Memento>(feed, item->position()));
// } else { // } else {
// showSection(HistoryFeed::Memento(feed)); // showSection(std::make_unique<HistoryFeed::Memento>(feed));
// } // }
} }
return false; return false;
@ -1086,10 +1087,10 @@ void SessionController::showPeerHistory(
} }
void SessionController::showSection( void SessionController::showSection(
SectionMemento &&memento, std::unique_ptr<SectionMemento> &&memento,
const SectionShow &params) { const SectionShow &params) {
if (!params.thirdColumn && widget()->showSectionInExistingLayer( if (!params.thirdColumn && widget()->showSectionInExistingLayer(
&memento, memento.get(),
params)) { params)) {
return; return;
} }

View File

@ -132,7 +132,7 @@ public:
Main::Session &session() const; Main::Session &session() const;
virtual void showSection( virtual void showSection(
SectionMemento &&memento, std::unique_ptr<SectionMemento> &&memento,
const SectionShow &params = SectionShow()) = 0; const SectionShow &params = SectionShow()) = 0;
virtual void showBackFromStack( virtual void showBackFromStack(
const SectionShow &params = SectionShow()) = 0; const SectionShow &params = SectionShow()) = 0;
@ -301,7 +301,7 @@ public:
bool confirmedLeaveOther = false); bool confirmedLeaveOther = false);
void showSection( void showSection(
SectionMemento &&memento, std::unique_ptr<SectionMemento> &&memento,
const SectionShow &params = SectionShow()) override; const SectionShow &params = SectionShow()) override;
void showBackFromStack( void showBackFromStack(
const SectionShow &params = SectionShow()) override; const SectionShow &params = SectionShow()) override;