2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 06:35:14 +00:00

Added initial support for increased premium count of accounts.

This commit is contained in:
23rd
2022-05-31 15:32:41 +03:00
committed by John Preston
parent 78246aada7
commit 35e4dd5968
5 changed files with 24 additions and 7 deletions

View File

@@ -326,7 +326,7 @@ void FillMenu(
&st::menuIconCancel);
} else {
const auto &list = Core::App().domain().accounts();
if (list.size() < ::Main::Domain::kMaxAccounts) {
if (list.size() < Core::App().domain().maxAccounts()) {
addAction(tr::lng_menu_add_account(tr::now), [=] {
Core::App().domain().addActivated(MTP::Environment{});
}, &st::menuIconAddAccount);

View File

@@ -708,7 +708,13 @@ not_null<Ui::SlideWrap<Ui::SettingsButton>*> AccountsList::setupAdd() {
const auto add = [=](MTP::Environment environment) {
Core::App().preventOrInvoke([=] {
Core::App().domain().addActivated(environment);
auto &domain = _controller->session().domain();
if (domain.accounts().size() >= domain.maxAccounts()) {
_controller->show(
Box(AccountsLimitBox, &_controller->session()));
} else {
domain.addActivated(environment);
}
});
};
@@ -804,7 +810,7 @@ void AccountsList::rebuild() {
inner->resizeToWidth(_outer->width());
_addAccount->toggle(
(inner->count() < Main::Domain::kMaxAccounts),
(inner->count() < Main::Domain::kPremiumMaxAccounts),
anim::type::instant);
_reorder->start();