2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-30 22:25:12 +00:00

Improve info section navigation.

Also fix render glitch in StickersListWidget.
This commit is contained in:
John Preston
2017-11-13 21:40:25 +04:00
parent aecc119bac
commit a86788f4d7
2 changed files with 31 additions and 4 deletions

View File

@@ -590,9 +590,28 @@ bool WrapWidget::showInternal(
return false;
}
auto content = infoMemento->content();
if (_controller->validateMementoPeer(content)) {
if (_content->showInternal(content)) {
auto skipInternal = !_historyStack.empty()
&& (params.way == Window::SectionShow::Way::ClearStack);
if (_controller->validateMementoPeer(content)
&& infoMemento->stackSize() == 1) {
if (!skipInternal && _content->showInternal(content)) {
return true;
} else if (_topTabs) {
// If we open the profile being in the media tab.
// Just switch back to the profile tab.
auto type = content->section().type();
if (type == Section::Type::Profile
&& _tab != Tab::Profile) {
_anotherTabMemento = std::move(infoMemento->takeStack().back());
_topTabs->setActiveSection(static_cast<int>(Tab::Profile));
return true;
} else if (type == Section::Type::Media
&& _tab != Tab::Media
&& Media::TypeToTabIndex(content->section().mediaType()).has_value()) {
_anotherTabMemento = std::move(infoMemento->takeStack().back());
_topTabs->setActiveSection(static_cast<int>(Tab::Media));
return true;
}
}
}
showNewContent(