2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Moved Settings::OrderedAccounts() to Main::Domain::orderedAccounts().

This commit is contained in:
23rd
2022-06-02 13:47:57 +03:00
parent a1736de977
commit 287fae858e
5 changed files with 24 additions and 27 deletions

View File

@@ -749,7 +749,7 @@ void AccountsList::rebuild() {
}
}, inner->lifetime());
const auto list = OrderedAccounts();
const auto list = _controller->session().domain().orderedAccounts();
for (const auto &account : list) {
auto i = _watched.find(account);
Assert(i != _watched.end());
@@ -830,29 +830,6 @@ AccountsEvents SetupAccounts(
};
}
std::vector<not_null<Main::Account*>> OrderedAccounts() {
using namespace Main;
const auto order = Core::App().settings().accountsOrder();
auto accounts = ranges::views::all(
Core::App().domain().accounts()
) | ranges::views::transform([](const Domain::AccountWithIndex &a) {
return not_null{ a.account.get() };
}) | ranges::to_vector;
ranges::stable_sort(accounts, [&](
not_null<Account*> a,
not_null<Account*> b) {
const auto aIt = a->sessionExists()
? ranges::find(order, a->session().uniqueId())
: end(order);
const auto bIt = b->sessionExists()
? ranges::find(order, b->session().uniqueId())
: end(order);
return aIt < bIt;
});
return accounts;
}
Dialogs::Ui::UnreadBadgeStyle BadgeStyle() {
auto result = Dialogs::Ui::UnreadBadgeStyle();
result.font = st::mainMenuBadgeFont;