mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-06 15:13:57 +02:00
Fix filters in non-active accounts.
This commit is contained in:
parent
a45d088ee4
commit
1705a1aa4a
3 changed files with 14 additions and 19 deletions
|
@ -216,17 +216,6 @@ bool ChatFilter::contains(not_null<History*> history) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
ChatFilters::ChatFilters(not_null<Session*> owner) : _owner(owner) {
|
ChatFilters::ChatFilters(not_null<Session*> owner) : _owner(owner) {
|
||||||
//using Flag = ChatFilter::Flag;
|
|
||||||
//const auto all = Flag::Contacts
|
|
||||||
// | Flag::NonContacts
|
|
||||||
// | Flag::Groups
|
|
||||||
// | Flag::Channels
|
|
||||||
// | Flag::Bots
|
|
||||||
// | Flag::NoArchived;
|
|
||||||
//_list.push_back(
|
|
||||||
// ChatFilter(1, "Unmuted", all | Flag::NoMuted, {}, {}));
|
|
||||||
//_list.push_back(
|
|
||||||
// ChatFilter(2, "Unread", all | Flag::NoRead, {}, {}));
|
|
||||||
load();
|
load();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "data/data_session.h"
|
#include "data/data_session.h"
|
||||||
|
|
||||||
#include "main/main_session.h"
|
#include "main/main_session.h"
|
||||||
|
#include "main/main_session_settings.h"
|
||||||
|
#include "main/main_account.h"
|
||||||
#include "apiwrap.h"
|
#include "apiwrap.h"
|
||||||
#include "mainwidget.h"
|
#include "mainwidget.h"
|
||||||
#include "api/api_text_entities.h"
|
#include "api/api_text_entities.h"
|
||||||
|
@ -27,7 +29,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "inline_bots/inline_bot_layout_item.h"
|
#include "inline_bots/inline_bot_layout_item.h"
|
||||||
#include "storage/storage_account.h"
|
#include "storage/storage_account.h"
|
||||||
#include "storage/storage_encrypted_file.h"
|
#include "storage/storage_encrypted_file.h"
|
||||||
#include "main/main_account.h"
|
|
||||||
#include "media/player/media_player_instance.h" // instance()->play()
|
#include "media/player/media_player_instance.h" // instance()->play()
|
||||||
#include "boxes/abstract_box.h"
|
#include "boxes/abstract_box.h"
|
||||||
#include "passport/passport_form_controller.h"
|
#include "passport/passport_form_controller.h"
|
||||||
|
@ -239,6 +240,16 @@ Session::Session(not_null<Main::Session*> session)
|
||||||
) | rpl::start_with_next([=] {
|
) | rpl::start_with_next([=] {
|
||||||
notifyUnreadBadgeChanged();
|
notifyUnreadBadgeChanged();
|
||||||
}, _lifetime);
|
}, _lifetime);
|
||||||
|
|
||||||
|
_chatsFilters->changed(
|
||||||
|
) | rpl::start_with_next([=] {
|
||||||
|
const auto enabled = !_chatsFilters->list().empty();
|
||||||
|
if (enabled != session->settings().dialogsFiltersEnabled()) {
|
||||||
|
session->settings().setDialogsFiltersEnabled(enabled);
|
||||||
|
session->saveSettingsDelayed();
|
||||||
|
}
|
||||||
|
}, _lifetime);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Session::clear() {
|
void Session::clear() {
|
||||||
|
|
|
@ -141,7 +141,7 @@ SessionController::SessionController(
|
||||||
session->data().chatsFilters().changed(
|
session->data().chatsFilters().changed(
|
||||||
) | rpl::start_with_next([=] {
|
) | rpl::start_with_next([=] {
|
||||||
checkOpenedFilter();
|
checkOpenedFilter();
|
||||||
crl::on_main(session, [=] {
|
crl::on_main(this, [=] {
|
||||||
refreshFiltersMenu();
|
refreshFiltersMenu();
|
||||||
});
|
});
|
||||||
}, session->lifetime());
|
}, session->lifetime());
|
||||||
|
@ -216,12 +216,7 @@ void SessionController::toggleFiltersMenu(bool enabled) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void SessionController::refreshFiltersMenu() {
|
void SessionController::refreshFiltersMenu() {
|
||||||
const auto enabled = !session().data().chatsFilters().list().empty();
|
toggleFiltersMenu(!session().data().chatsFilters().list().empty());
|
||||||
if (enabled != session().settings().dialogsFiltersEnabled()) {
|
|
||||||
session().settings().setDialogsFiltersEnabled(enabled);
|
|
||||||
session().saveSettingsDelayed();
|
|
||||||
toggleFiltersMenu(enabled);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
rpl::producer<> SessionController::filtersMenuChanged() const {
|
rpl::producer<> SessionController::filtersMenuChanged() const {
|
||||||
|
|
Loading…
Add table
Reference in a new issue