mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-08-31 06:26:18 +00:00
Added ability to pass preloaded chats filter tags toggle on logging in.
This commit is contained in:
@@ -358,8 +358,11 @@ void ChatFilters::clear() {
|
||||
_list.clear();
|
||||
}
|
||||
|
||||
void ChatFilters::setPreloaded(const QVector<MTPDialogFilter> &result) {
|
||||
void ChatFilters::setPreloaded(
|
||||
const QVector<MTPDialogFilter> &result,
|
||||
bool tagsEnabled) {
|
||||
_loadRequestId = -1;
|
||||
_tagsEnabled = tagsEnabled;
|
||||
received(result);
|
||||
crl::on_main(&_owner->session(), [=] {
|
||||
if (_loadRequestId == -1) {
|
||||
|
@@ -136,7 +136,9 @@ public:
|
||||
explicit ChatFilters(not_null<Session*> owner);
|
||||
~ChatFilters();
|
||||
|
||||
void setPreloaded(const QVector<MTPDialogFilter> &result);
|
||||
void setPreloaded(
|
||||
const QVector<MTPDialogFilter> &result,
|
||||
bool tagsEnabled);
|
||||
|
||||
void load();
|
||||
void reload();
|
||||
|
@@ -194,16 +194,18 @@ void Step::finish(const MTPUser &user, QImage &&photo) {
|
||||
|
||||
api().request(MTPmessages_GetDialogFilters(
|
||||
)).done([=](const MTPmessages_DialogFilters &result) {
|
||||
createSession(user, photo, result.data().vfilters().v);
|
||||
const auto &d = result.data();
|
||||
createSession(user, photo, d.vfilters().v, d.is_tags_enabled());
|
||||
}).fail([=] {
|
||||
createSession(user, photo, QVector<MTPDialogFilter>());
|
||||
createSession(user, photo, QVector<MTPDialogFilter>(), false);
|
||||
}).send();
|
||||
}
|
||||
|
||||
void Step::createSession(
|
||||
const MTPUser &user,
|
||||
QImage photo,
|
||||
const QVector<MTPDialogFilter> &filters) {
|
||||
const QVector<MTPDialogFilter> &filters,
|
||||
bool tagsEnabled) {
|
||||
// Save the default language if we've suggested some other and user ignored it.
|
||||
const auto currentId = Lang::Id();
|
||||
const auto defaultId = Lang::DefaultLanguageId();
|
||||
@@ -227,7 +229,7 @@ void Step::createSession(
|
||||
account->local().enforceModernStorageIdBots();
|
||||
account->local().writeMtpData();
|
||||
auto &session = account->session();
|
||||
session.data().chatsFilters().setPreloaded(filters);
|
||||
session.data().chatsFilters().setPreloaded(filters, tagsEnabled);
|
||||
if (hasFilters) {
|
||||
session.saveSettingsDelayed();
|
||||
}
|
||||
|
@@ -116,7 +116,8 @@ protected:
|
||||
void createSession(
|
||||
const MTPUser &user,
|
||||
QImage photo,
|
||||
const QVector<MTPDialogFilter> &filters);
|
||||
const QVector<MTPDialogFilter> &filters,
|
||||
bool tagsEnabled);
|
||||
|
||||
void goBack();
|
||||
|
||||
|
Reference in New Issue
Block a user