| 2706 | } |
| 2707 | |
| 2708 | void MainWidget::updateThirdColumnToCurrentChat( |
| 2709 | Dialogs::Key key, |
| 2710 | bool canWrite) { |
| 2711 | auto saveOldThirdSection = [&] { |
| 2712 | if (saveThirdSectionToStackBack()) { |
| 2713 | _stack.back()->setThirdSectionMemento( |
| 2714 | _thirdSection->createMemento()); |
| 2715 | destroyThirdSection(); |
| 2716 | } |
| 2717 | }; |
| 2718 | auto &settings = Core::App().settings(); |
| 2719 | auto params = Window::SectionShow( |
| 2720 | Window::SectionShow::Way::ClearStack, |
| 2721 | anim::type::instant, |
| 2722 | anim::activation::background); |
| 2723 | auto switchInfoFast = [&] { |
| 2724 | saveOldThirdSection(); |
| 2725 | |
| 2726 | // |
| 2727 | // Like in _controller->showPeerInfo() |
| 2728 | // |
| 2729 | if (isThreeColumn() |
| 2730 | && !settings.thirdSectionInfoEnabled()) { |
| 2731 | settings.setThirdSectionInfoEnabled(true); |
| 2732 | Core::App().saveSettingsDelayed(); |
| 2733 | } |
| 2734 | |
| 2735 | _controller->showSection( |
| 2736 | thirdSectionForCurrentMainSection(key), |
| 2737 | params.withThirdColumn()); |
| 2738 | }; |
| 2739 | auto switchTabbedFast = [&](not_null<Data::Thread*> thread) { |
| 2740 | saveOldThirdSection(); |
| 2741 | return _mainSection |
| 2742 | ? _mainSection->pushTabbedSelectorToThirdSection(thread, params) |
| 2743 | : _history->pushTabbedSelectorToThirdSection(thread, params); |
| 2744 | }; |
| 2745 | if (isThreeColumn() |
| 2746 | && settings.tabbedSelectorSectionEnabled() |
| 2747 | && key) { |
| 2748 | if (!canWrite) { |
| 2749 | switchInfoFast(); |
| 2750 | settings.setTabbedSelectorSectionEnabled(true); |
| 2751 | settings.setTabbedReplacedWithInfo(true); |
| 2752 | } else if (settings.tabbedReplacedWithInfo() |
| 2753 | && key.thread() |
| 2754 | && switchTabbedFast(key.thread())) { |
| 2755 | settings.setTabbedReplacedWithInfo(false); |
| 2756 | } |
| 2757 | } else { |
| 2758 | settings.setTabbedReplacedWithInfo(false); |
| 2759 | if (!key) { |
| 2760 | if (_thirdSection) { |
| 2761 | destroyThirdSection(); |
| 2762 | _thirdShadow.destroy(); |
| 2763 | updateControlsGeometry(); |
| 2764 | } |
| 2765 | } else if (isThreeColumn() |
nothing calls this directly
no test coverage detected