Remove unnecessary filter category rule

This commit is contained in:
Ali 2020-03-24 18:26:24 +04:00
parent 727bf6223c
commit 8e95642d8f

View File

@ -742,35 +742,33 @@ enum ChatListFilterType {
case nonContacts case nonContacts
} }
func chatListFilterType(_ filter: ChatListFilter) -> ChatListFilterType { func chatListFilterType(postbox: Postbox, filter: ChatListFilter) -> ChatListFilterType {
let filterType: ChatListFilterType let filterType: ChatListFilterType
if filter.data.includePeers.peers.isEmpty {
if filter.data.categories == .all { if filter.data.categories == .all {
if filter.data.excludeRead { if filter.data.excludeRead {
filterType = .unread filterType = .unread
} else if filter.data.excludeMuted { } else if filter.data.excludeMuted {
filterType = .unmuted filterType = .unmuted
} else {
filterType = .generic
}
} else { } else {
if filter.data.categories == .channels { filterType = .generic
filterType = .channels
} else if filter.data.categories == .groups {
filterType = .groups
} else if filter.data.categories == .bots {
filterType = .bots
} else if filter.data.categories == .contacts {
filterType = .contacts
} else if filter.data.categories == .nonContacts {
filterType = .nonContacts
} else {
filterType = .generic
}
} }
} else { } else {
filterType = .generic if filter.data.categories == .channels {
filterType = .channels
} else if filter.data.categories == .groups {
filterType = .groups
} else if filter.data.categories == .bots {
filterType = .bots
} else if filter.data.categories == .contacts {
filterType = .contacts
} else if filter.data.categories == .nonContacts {
filterType = .nonContacts
} else {
filterType = .generic
}
} }
return filterType return filterType
} }