| 582 | } |
| 583 | |
| 584 | Window::SessionController *Session::tryResolveWindow( |
| 585 | PeerData *forPeer) const { |
| 586 | if (forPeer) { |
| 587 | auto primary = (Window::SessionController*)nullptr; |
| 588 | for (const auto &window : _windows) { |
| 589 | const auto thread = window->windowId().thread; |
| 590 | if (thread && thread->peer() == forPeer) { |
| 591 | return window; |
| 592 | } else if (window->isPrimary()) { |
| 593 | primary = window; |
| 594 | } |
| 595 | } |
| 596 | if (primary) { |
| 597 | return primary; |
| 598 | } |
| 599 | } |
| 600 | if (_windows.empty() || forPeer) { |
| 601 | domain().activate(_account); |
| 602 | if (_windows.empty()) { |
| 603 | return nullptr; |
| 604 | } |
| 605 | } |
| 606 | for (const auto &window : _windows) { |
| 607 | if (window->isPrimary()) { |
| 608 | return window; |
| 609 | } |
| 610 | } |
| 611 | return _windows.front(); |
| 612 | } |
| 613 | |
| 614 | auto Session::colorIndicesValue() |
| 615 | -> rpl::producer<Ui::ColorIndicesCompressed> { |
no test coverage detected