| 1407 | } |
| 1408 | |
| 1409 | Window::Controller *Application::ensureSeparateWindowFor( |
| 1410 | Window::SeparateId id, |
| 1411 | MsgId showAtMsgId) { |
| 1412 | const auto activate = [&](not_null<Window::Controller*> window) { |
| 1413 | window->activate(); |
| 1414 | return window; |
| 1415 | }; |
| 1416 | if (const auto existing = separateWindowFor(id)) { |
| 1417 | if (id.thread |
| 1418 | && id.type == Window::SeparateType::Chat |
| 1419 | && !passcodeLocked()) { |
| 1420 | existing->sessionController()->showThread( |
| 1421 | id.thread, |
| 1422 | showAtMsgId, |
| 1423 | Window::SectionShow::Way::ClearStack); |
| 1424 | } |
| 1425 | return activate(existing); |
| 1426 | } |
| 1427 | |
| 1428 | const auto result = _windows.emplace( |
| 1429 | id, |
| 1430 | std::make_unique<Window::Controller>(id, showAtMsgId) |
| 1431 | ).first->second.get(); |
| 1432 | processCreatedWindow(result); |
| 1433 | if (passcodeLocked()) { |
| 1434 | result->setupPasscodeLock(); |
| 1435 | } |
| 1436 | result->firstShow(); |
| 1437 | result->finishFirstShow(); |
| 1438 | return activate(result); |
| 1439 | } |
| 1440 | |
| 1441 | Window::Controller *Application::windowFor(Window::SeparateId id) const { |
| 1442 | if (const auto separate = separateWindowFor(id)) { |
no test coverage detected