ios: show muted user profiles in user menu, do not show badge on messages in hidden profiles (#2068)

This commit is contained in:
Evgeny Poberezkin 2023-03-23 23:09:37 +00:00 committed by GitHub
parent f349f124d8
commit b665dce383
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 4 deletions

View file

@ -85,7 +85,7 @@ struct ChatListView: View {
.frame(width: 32, height: 32) .frame(width: 32, height: 32)
.padding(.trailing, 4) .padding(.trailing, 4)
let allRead = chatModel.users let allRead = chatModel.users
.filter { !$0.user.activeUser } .filter { u in !u.user.activeUser && !u.user.hidden }
.allSatisfy { u in u.unreadCount == 0 } .allSatisfy { u in u.unreadCount == 0 }
if !allRead { if !allRead {
unreadBadge(size: 12) unreadBadge(size: 12)

View file

@ -126,7 +126,9 @@ struct UserPicker: View {
if user.activeUser { if user.activeUser {
Image(systemName: "checkmark") Image(systemName: "checkmark")
} else if u.unreadCount > 0 { } else if u.unreadCount > 0 {
unreadCounter(u.unreadCount) unreadCounter(u.unreadCount, color: user.showNtfs ? .accentColor : .secondary)
} else if !user.showNtfs {
Image(systemName: "speaker.slash")
} }
} }
.padding(.trailing) .padding(.trailing)
@ -152,13 +154,13 @@ struct UserPicker: View {
} }
} }
func unreadCounter(_ unread: Int) -> some View { private func unreadCounter(_ unread: Int, color: Color) -> some View {
unreadCountText(unread) unreadCountText(unread)
.font(.caption) .font(.caption)
.foregroundColor(.white) .foregroundColor(.white)
.padding(.horizontal, 4) .padding(.horizontal, 4)
.frame(minWidth: 18, minHeight: 18) .frame(minWidth: 18, minHeight: 18)
.background(Color.accentColor) .background(color)
.cornerRadius(10) .cornerRadius(10)
} }