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

Show two hardcoded filters in Ui.

This commit is contained in:
John Preston
2020-02-07 15:34:05 +04:00
parent 71f7aae948
commit 2f1ee6f1fa
15 changed files with 179 additions and 105 deletions

View File

@@ -838,8 +838,8 @@ void History::setUnreadMentionsCount(int count) {
}
_unreadMentionsCount = count;
const auto has = (count > 0);
if (has != had && Global::DialogsFiltersEnabled()) { // #TODO filters
Notify::historyMuteUpdated(this);
if (has != had) {
owner().chatsFilters()->refreshHistory(this);
updateChatListEntry();
}
}
@@ -1782,7 +1782,11 @@ void History::setUnreadCount(int newUnreadCount) {
}
const auto notifier = unreadStateChangeNotifier(true);
const auto wasForBadge = (unreadCountForBadge() > 0);
_unreadCount = newUnreadCount;
if (wasForBadge != (unreadCountForBadge() > 0)) {
owner().chatsFilters()->refreshHistory(this);
}
if (newUnreadCount == 1) {
if (loadedAtBottom()) {
@@ -1819,6 +1823,7 @@ void History::setUnreadMark(bool unread) {
_unreadMark = unread;
if (inChatList() && noUnreadMessages) {
owner().chatsFilters()->refreshHistory(this);
updateChatListEntry();
}
Notify::peerUpdatedDelayed(
@@ -1844,7 +1849,7 @@ bool History::changeMute(bool newMute) {
_mute = newMute;
if (inChatList()) {
Notify::historyMuteUpdated(this);
owner().chatsFilters()->refreshHistory(this);
updateChatListEntry();
}
Notify::peerUpdatedDelayed(
@@ -1920,14 +1925,12 @@ void History::setFolderPointer(Data::Folder *folder) {
}
const auto wasKnown = folderKnown();
const auto wasInList = inChatList();
// #TODO filters
//const auto wasInImportant = wasInList && inChatList(Mode::Important);
//if (wasInList) {
// removeFromChatList(Mode::All);
// if (wasInImportant) {
// removeFromChatList(Mode::Important);
// }
//}
if (wasInList) {
removeFromChatList(0);
for (const auto &[filterId, _] : owner().chatsFilters()->list()) {
removeFromChatList(filterId);
}
}
const auto was = _folder.value_or(nullptr);
_folder = folder;
if (was) {
@@ -1935,9 +1938,11 @@ void History::setFolderPointer(Data::Folder *folder) {
}
if (wasInList) {
addToChatList(0);
//if (wasInImportant) { // #TODO filters
// addToChatList(Mode::Important);
//}
for (const auto &[filterId, filter] : owner().chatsFilters()->list()) {
if (filter.contains(this)) {
addToChatList(filterId);
}
}
owner().chatsListChanged(was);
owner().chatsListChanged(folder);
} else if (!wasKnown) {