mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 14:17:12 +02:00
Added phrase for limit of number of chats that never show in filter.
This commit is contained in:
parent
d6e1ee2a28
commit
1364dba015
8 changed files with 32 additions and 32 deletions
|
@ -189,6 +189,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
"lng_filter_chats_limit_title" = "Limit Reached";
|
||||
"lng_filter_chats_limit1#one" = "Sorry, you can't add more than **{count}** chat to a folder.";
|
||||
"lng_filter_chats_limit1#other" = "Sorry, you can't add more than **{count}** chats to a folder.";
|
||||
"lng_filter_chats_exlude_limit1#one" = "Sorry, you can't exlude more than **{count}** chat from a folder.";
|
||||
"lng_filter_chats_exlude_limit1#other" = "Sorry, you can't exlude more than **{count}** chats from a folder.";
|
||||
"lng_filter_chats_limit2#one" = "You can increase this limit to **{count}** by upgrading to **Telegram Premium**.";
|
||||
"lng_filter_chats_limit2#other" = "You can increase this limit to **{count}** by upgrading to **Telegram Premium**.";
|
||||
|
||||
|
|
|
@ -510,7 +510,7 @@ void ShowImportError(
|
|||
if (error == u"CHANNELS_TOO_MUCH"_q) {
|
||||
window->show(Box(ChannelsLimitBox, session));
|
||||
} else if (error == u"FILTER_INCLUDE_TOO_MUCH"_q) {
|
||||
window->show(Box(FilterChatsLimitBox, session, count));
|
||||
window->show(Box(FilterChatsLimitBox, session, count, true));
|
||||
} else if (error == u"CHATLISTS_TOO_MUCH"_q) {
|
||||
window->show(Box(ShareableFiltersLimitBox, session));
|
||||
} else {
|
||||
|
|
|
@ -164,7 +164,8 @@ void FillChooseFilterMenu(
|
|||
controller->show(Box(
|
||||
FilterChatsLimitBox,
|
||||
&controller->session(),
|
||||
r.count));
|
||||
r.count,
|
||||
true));
|
||||
} else if (validator.canAdd()) {
|
||||
validator.add(id);
|
||||
}
|
||||
|
|
|
@ -336,14 +336,18 @@ void EditExceptions(
|
|||
Fn<void()> refresh) {
|
||||
const auto include = (options & Flag::Contacts) != Flags(0);
|
||||
const auto rules = data->current();
|
||||
const auto session = &window->session();
|
||||
auto controller = std::make_unique<EditFilterChatsListController>(
|
||||
&window->session(),
|
||||
session,
|
||||
(include
|
||||
? tr::lng_filters_include_title()
|
||||
: tr::lng_filters_exclude_title()),
|
||||
options,
|
||||
rules.flags() & options,
|
||||
include ? rules.always() : rules.never());
|
||||
include ? rules.always() : rules.never(),
|
||||
[=](int count) {
|
||||
return Box(FilterChatsLimitBox, session, count, include);
|
||||
});
|
||||
const auto rawController = controller.get();
|
||||
auto initBox = [=](not_null<PeerListBox*> box) {
|
||||
box->setCloseByOutsideClick(false);
|
||||
|
|
|
@ -7,9 +7,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
*/
|
||||
#include "boxes/filters/edit_filter_chats_list.h"
|
||||
|
||||
#include "data/data_premium_limits.h"
|
||||
#include "history/history.h"
|
||||
#include "window/window_session_controller.h"
|
||||
#include "boxes/premium_limits_box.h"
|
||||
#include "lang/lang_keys.h"
|
||||
#include "ui/widgets/labels.h"
|
||||
#include "ui/wrap/vertical_layout.h"
|
||||
|
@ -99,22 +99,6 @@ private:
|
|||
return PeerId(FakeChatId(static_cast<BareId>(flag))).value;
|
||||
}
|
||||
|
||||
[[nodiscard]] int Limit(
|
||||
not_null<Main::Session*> session,
|
||||
const QString &key,
|
||||
int fallback) {
|
||||
return session->account().appConfig().get<int>(key, fallback);
|
||||
}
|
||||
|
||||
[[nodiscard]] int Limit(not_null<Main::Session*> session) {
|
||||
const auto premium = session->premium();
|
||||
return Limit(session,
|
||||
(premium
|
||||
? "dialog_filters_chats_limit_premium"
|
||||
: "dialog_filters_chats_limit_default"),
|
||||
premium ? 200 : 100);
|
||||
}
|
||||
|
||||
TypeRow::TypeRow(Flag flag) : PeerListRow(TypeId(flag)) {
|
||||
}
|
||||
|
||||
|
@ -338,15 +322,18 @@ EditFilterChatsListController::EditFilterChatsListController(
|
|||
rpl::producer<QString> title,
|
||||
Flags options,
|
||||
Flags selected,
|
||||
const base::flat_set<not_null<History*>> &peers)
|
||||
const base::flat_set<not_null<History*>> &peers,
|
||||
LimitBoxFactory limitBox)
|
||||
: ChatsListBoxController(session)
|
||||
, _session(session)
|
||||
, _limitBox(std::move(limitBox))
|
||||
, _title(std::move(title))
|
||||
, _peers(peers)
|
||||
, _options(options & ~Flag::Chatlist)
|
||||
, _selected(selected)
|
||||
, _limit(Limit(session))
|
||||
, _limit(Data::PremiumLimits(session).dialogFiltersChatsCurrent())
|
||||
, _chatlist(options & Flag::Chatlist) {
|
||||
Expects(_limitBox != nullptr);
|
||||
}
|
||||
|
||||
Main::Session &EditFilterChatsListController::session() const {
|
||||
|
@ -375,8 +362,7 @@ void EditFilterChatsListController::rowClicked(not_null<PeerListRow*> row) {
|
|||
delegate()->peerListSetRowChecked(row, !row->checked());
|
||||
updateTitle();
|
||||
} else {
|
||||
delegate()->peerListShowBox(
|
||||
Box(FilterChatsLimitBox, _session, count));
|
||||
delegate()->peerListShowBox(_limitBox(count));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -43,13 +43,15 @@ class EditFilterChatsListController final : public ChatsListBoxController {
|
|||
public:
|
||||
using Flag = Data::ChatFilter::Flag;
|
||||
using Flags = Data::ChatFilter::Flags;
|
||||
using LimitBoxFactory = Fn<object_ptr<Ui::BoxContent>(int)>;
|
||||
|
||||
EditFilterChatsListController(
|
||||
not_null<Main::Session*> session,
|
||||
rpl::producer<QString> title,
|
||||
Flags options,
|
||||
Flags selected,
|
||||
const base::flat_set<not_null<History*>> &peers);
|
||||
const base::flat_set<not_null<History*>> &peers,
|
||||
LimitBoxFactory limitBox);
|
||||
|
||||
[[nodiscard]] Main::Session &session() const override;
|
||||
[[nodiscard]] Flags chosenOptions() const {
|
||||
|
@ -70,6 +72,7 @@ private:
|
|||
void updateTitle();
|
||||
|
||||
const not_null<Main::Session*> _session;
|
||||
const LimitBoxFactory _limitBox;
|
||||
rpl::producer<QString> _title;
|
||||
base::flat_set<not_null<History*>> _peers;
|
||||
Flags _options;
|
||||
|
|
|
@ -694,7 +694,8 @@ void PublicLinksLimitBox(
|
|||
void FilterChatsLimitBox(
|
||||
not_null<Ui::GenericBox*> box,
|
||||
not_null<Main::Session*> session,
|
||||
int currentCount) {
|
||||
int currentCount,
|
||||
bool include) {
|
||||
const auto premium = session->premium();
|
||||
const auto premiumPossible = session->premiumPossible();
|
||||
|
||||
|
@ -707,10 +708,12 @@ void FilterChatsLimitBox(
|
|||
premiumLimit);
|
||||
|
||||
auto text = rpl::combine(
|
||||
tr::lng_filter_chats_limit1(
|
||||
lt_count,
|
||||
rpl::single(premium ? premiumLimit : defaultLimit),
|
||||
Ui::Text::RichLangValue),
|
||||
(include
|
||||
? tr::lng_filter_chats_limit1
|
||||
: tr::lng_filter_chats_exlude_limit1)(
|
||||
lt_count,
|
||||
rpl::single(premium ? premiumLimit : defaultLimit),
|
||||
Ui::Text::RichLangValue),
|
||||
((premium || !premiumPossible)
|
||||
? rpl::single(TextWithEntities())
|
||||
: tr::lng_filter_chats_limit2(
|
||||
|
|
|
@ -35,7 +35,8 @@ void PublicLinksLimitBox(
|
|||
void FilterChatsLimitBox(
|
||||
not_null<Ui::GenericBox*> box,
|
||||
not_null<Main::Session*> session,
|
||||
int currentCount);
|
||||
int currentCount,
|
||||
bool include);
|
||||
void FilterLinksLimitBox(
|
||||
not_null<Ui::GenericBox*> box,
|
||||
not_null<Main::Session*> session);
|
||||
|
|
Loading…
Add table
Reference in a new issue