mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 22:54:01 +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_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#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_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#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**.";
|
"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) {
|
if (error == u"CHANNELS_TOO_MUCH"_q) {
|
||||||
window->show(Box(ChannelsLimitBox, session));
|
window->show(Box(ChannelsLimitBox, session));
|
||||||
} else if (error == u"FILTER_INCLUDE_TOO_MUCH"_q) {
|
} 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) {
|
} else if (error == u"CHATLISTS_TOO_MUCH"_q) {
|
||||||
window->show(Box(ShareableFiltersLimitBox, session));
|
window->show(Box(ShareableFiltersLimitBox, session));
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -164,7 +164,8 @@ void FillChooseFilterMenu(
|
||||||
controller->show(Box(
|
controller->show(Box(
|
||||||
FilterChatsLimitBox,
|
FilterChatsLimitBox,
|
||||||
&controller->session(),
|
&controller->session(),
|
||||||
r.count));
|
r.count,
|
||||||
|
true));
|
||||||
} else if (validator.canAdd()) {
|
} else if (validator.canAdd()) {
|
||||||
validator.add(id);
|
validator.add(id);
|
||||||
}
|
}
|
||||||
|
|
|
@ -336,14 +336,18 @@ void EditExceptions(
|
||||||
Fn<void()> refresh) {
|
Fn<void()> refresh) {
|
||||||
const auto include = (options & Flag::Contacts) != Flags(0);
|
const auto include = (options & Flag::Contacts) != Flags(0);
|
||||||
const auto rules = data->current();
|
const auto rules = data->current();
|
||||||
|
const auto session = &window->session();
|
||||||
auto controller = std::make_unique<EditFilterChatsListController>(
|
auto controller = std::make_unique<EditFilterChatsListController>(
|
||||||
&window->session(),
|
session,
|
||||||
(include
|
(include
|
||||||
? tr::lng_filters_include_title()
|
? tr::lng_filters_include_title()
|
||||||
: tr::lng_filters_exclude_title()),
|
: tr::lng_filters_exclude_title()),
|
||||||
options,
|
options,
|
||||||
rules.flags() & 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();
|
const auto rawController = controller.get();
|
||||||
auto initBox = [=](not_null<PeerListBox*> box) {
|
auto initBox = [=](not_null<PeerListBox*> box) {
|
||||||
box->setCloseByOutsideClick(false);
|
box->setCloseByOutsideClick(false);
|
||||||
|
|
|
@ -7,9 +7,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
*/
|
*/
|
||||||
#include "boxes/filters/edit_filter_chats_list.h"
|
#include "boxes/filters/edit_filter_chats_list.h"
|
||||||
|
|
||||||
|
#include "data/data_premium_limits.h"
|
||||||
#include "history/history.h"
|
#include "history/history.h"
|
||||||
#include "window/window_session_controller.h"
|
#include "window/window_session_controller.h"
|
||||||
#include "boxes/premium_limits_box.h"
|
|
||||||
#include "lang/lang_keys.h"
|
#include "lang/lang_keys.h"
|
||||||
#include "ui/widgets/labels.h"
|
#include "ui/widgets/labels.h"
|
||||||
#include "ui/wrap/vertical_layout.h"
|
#include "ui/wrap/vertical_layout.h"
|
||||||
|
@ -99,22 +99,6 @@ private:
|
||||||
return PeerId(FakeChatId(static_cast<BareId>(flag))).value;
|
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)) {
|
TypeRow::TypeRow(Flag flag) : PeerListRow(TypeId(flag)) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -338,15 +322,18 @@ EditFilterChatsListController::EditFilterChatsListController(
|
||||||
rpl::producer<QString> title,
|
rpl::producer<QString> title,
|
||||||
Flags options,
|
Flags options,
|
||||||
Flags selected,
|
Flags selected,
|
||||||
const base::flat_set<not_null<History*>> &peers)
|
const base::flat_set<not_null<History*>> &peers,
|
||||||
|
LimitBoxFactory limitBox)
|
||||||
: ChatsListBoxController(session)
|
: ChatsListBoxController(session)
|
||||||
, _session(session)
|
, _session(session)
|
||||||
|
, _limitBox(std::move(limitBox))
|
||||||
, _title(std::move(title))
|
, _title(std::move(title))
|
||||||
, _peers(peers)
|
, _peers(peers)
|
||||||
, _options(options & ~Flag::Chatlist)
|
, _options(options & ~Flag::Chatlist)
|
||||||
, _selected(selected)
|
, _selected(selected)
|
||||||
, _limit(Limit(session))
|
, _limit(Data::PremiumLimits(session).dialogFiltersChatsCurrent())
|
||||||
, _chatlist(options & Flag::Chatlist) {
|
, _chatlist(options & Flag::Chatlist) {
|
||||||
|
Expects(_limitBox != nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
Main::Session &EditFilterChatsListController::session() const {
|
Main::Session &EditFilterChatsListController::session() const {
|
||||||
|
@ -375,8 +362,7 @@ void EditFilterChatsListController::rowClicked(not_null<PeerListRow*> row) {
|
||||||
delegate()->peerListSetRowChecked(row, !row->checked());
|
delegate()->peerListSetRowChecked(row, !row->checked());
|
||||||
updateTitle();
|
updateTitle();
|
||||||
} else {
|
} else {
|
||||||
delegate()->peerListShowBox(
|
delegate()->peerListShowBox(_limitBox(count));
|
||||||
Box(FilterChatsLimitBox, _session, count));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,13 +43,15 @@ class EditFilterChatsListController final : public ChatsListBoxController {
|
||||||
public:
|
public:
|
||||||
using Flag = Data::ChatFilter::Flag;
|
using Flag = Data::ChatFilter::Flag;
|
||||||
using Flags = Data::ChatFilter::Flags;
|
using Flags = Data::ChatFilter::Flags;
|
||||||
|
using LimitBoxFactory = Fn<object_ptr<Ui::BoxContent>(int)>;
|
||||||
|
|
||||||
EditFilterChatsListController(
|
EditFilterChatsListController(
|
||||||
not_null<Main::Session*> session,
|
not_null<Main::Session*> session,
|
||||||
rpl::producer<QString> title,
|
rpl::producer<QString> title,
|
||||||
Flags options,
|
Flags options,
|
||||||
Flags selected,
|
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]] Main::Session &session() const override;
|
||||||
[[nodiscard]] Flags chosenOptions() const {
|
[[nodiscard]] Flags chosenOptions() const {
|
||||||
|
@ -70,6 +72,7 @@ private:
|
||||||
void updateTitle();
|
void updateTitle();
|
||||||
|
|
||||||
const not_null<Main::Session*> _session;
|
const not_null<Main::Session*> _session;
|
||||||
|
const LimitBoxFactory _limitBox;
|
||||||
rpl::producer<QString> _title;
|
rpl::producer<QString> _title;
|
||||||
base::flat_set<not_null<History*>> _peers;
|
base::flat_set<not_null<History*>> _peers;
|
||||||
Flags _options;
|
Flags _options;
|
||||||
|
|
|
@ -694,7 +694,8 @@ void PublicLinksLimitBox(
|
||||||
void FilterChatsLimitBox(
|
void FilterChatsLimitBox(
|
||||||
not_null<Ui::GenericBox*> box,
|
not_null<Ui::GenericBox*> box,
|
||||||
not_null<Main::Session*> session,
|
not_null<Main::Session*> session,
|
||||||
int currentCount) {
|
int currentCount,
|
||||||
|
bool include) {
|
||||||
const auto premium = session->premium();
|
const auto premium = session->premium();
|
||||||
const auto premiumPossible = session->premiumPossible();
|
const auto premiumPossible = session->premiumPossible();
|
||||||
|
|
||||||
|
@ -707,10 +708,12 @@ void FilterChatsLimitBox(
|
||||||
premiumLimit);
|
premiumLimit);
|
||||||
|
|
||||||
auto text = rpl::combine(
|
auto text = rpl::combine(
|
||||||
tr::lng_filter_chats_limit1(
|
(include
|
||||||
lt_count,
|
? tr::lng_filter_chats_limit1
|
||||||
rpl::single(premium ? premiumLimit : defaultLimit),
|
: tr::lng_filter_chats_exlude_limit1)(
|
||||||
Ui::Text::RichLangValue),
|
lt_count,
|
||||||
|
rpl::single(premium ? premiumLimit : defaultLimit),
|
||||||
|
Ui::Text::RichLangValue),
|
||||||
((premium || !premiumPossible)
|
((premium || !premiumPossible)
|
||||||
? rpl::single(TextWithEntities())
|
? rpl::single(TextWithEntities())
|
||||||
: tr::lng_filter_chats_limit2(
|
: tr::lng_filter_chats_limit2(
|
||||||
|
|
|
@ -35,7 +35,8 @@ void PublicLinksLimitBox(
|
||||||
void FilterChatsLimitBox(
|
void FilterChatsLimitBox(
|
||||||
not_null<Ui::GenericBox*> box,
|
not_null<Ui::GenericBox*> box,
|
||||||
not_null<Main::Session*> session,
|
not_null<Main::Session*> session,
|
||||||
int currentCount);
|
int currentCount,
|
||||||
|
bool include);
|
||||||
void FilterLinksLimitBox(
|
void FilterLinksLimitBox(
|
||||||
not_null<Ui::GenericBox*> box,
|
not_null<Ui::GenericBox*> box,
|
||||||
not_null<Main::Session*> session);
|
not_null<Main::Session*> session);
|
||||||
|
|
Loading…
Add table
Reference in a new issue