| 39 | } // namespace |
| 40 | |
| 41 | BuildHelper::BuildHelper( |
| 42 | SectionMeta &&meta, |
| 43 | FnMut<void(SectionBuilder&)> method) |
| 44 | : build([=]( |
| 45 | not_null<Ui::VerticalLayout*> container, |
| 46 | not_null<Window::SessionController*> controller, |
| 47 | Fn<void(Type)> showOther, |
| 48 | rpl::producer<> showFinished) { |
| 49 | auto &lifetime = container->lifetime(); |
| 50 | const auto highlights = lifetime.make_state<HighlightRegistry>(); |
| 51 | const auto isPaused = Window::PausedIn( |
| 52 | controller, |
| 53 | Window::GifPauseReason::Layer); |
| 54 | auto builder = SectionBuilder(WidgetContext{ |
| 55 | .container = static_cast<Ui::VerticalLayout*>( |
| 56 | container->add(object_ptr<Ui::OverrideMargins>( |
| 57 | container, |
| 58 | object_ptr<Ui::VerticalLayout>(container)))->entity()), |
| 59 | .controller = controller, |
| 60 | .showOther = std::move(showOther), |
| 61 | .isPaused = isPaused, |
| 62 | .highlights = highlights, |
| 63 | }); |
| 64 | _method(builder); |
| 65 | |
| 66 | std::move(showFinished) | rpl::on_next([=] { |
| 67 | for (const auto &[id, entry] : *highlights) { |
| 68 | if (entry.widget) { |
| 69 | controller->checkHighlightControl( |
| 70 | id, |
| 71 | entry.widget, |
| 72 | base::duplicate(entry.args)); |
| 73 | } |
| 74 | } |
| 75 | }, lifetime); |
| 76 | }) |
| 77 | , _meta(std::move(meta)) |
| 78 | , _method(std::move(method)) { |
| 79 | Expects(_method != nullptr); |
| 80 | |
| 81 | SearchRegistry::Instance().add( |
| 82 | &_meta, |
| 83 | [=](not_null<::Main::Session*> session) { return index(session); }); |
| 84 | } |
| 85 | |
| 86 | SearchRegistry &SearchRegistry::Instance() { |
| 87 | static SearchRegistry instance; |
nothing calls this directly
no test coverage detected