avatar to deleted users
This commit is contained in:
parent
bd83abda04
commit
3e1811fa51
@ -640,12 +640,24 @@ private struct ChatRowView: View {
|
||||
officialFullName != nil
|
||||
}
|
||||
|
||||
private var isDeletedUser: Bool {
|
||||
guard chat.chatType != .self else { return false }
|
||||
let login = chat.chatData?.login?.trimmingCharacters(in: .whitespacesAndNewlines)
|
||||
return login?.isEmpty ?? true
|
||||
}
|
||||
|
||||
private var avatarBackgroundColor: Color {
|
||||
isOfficial ? Color.accentColor.opacity(0.85) : Color.accentColor.opacity(0.15)
|
||||
if isDeletedUser {
|
||||
return Color(.systemGray5)
|
||||
}
|
||||
return isOfficial ? Color.accentColor.opacity(0.85) : Color.accentColor.opacity(0.15)
|
||||
}
|
||||
|
||||
private var avatarTextColor: Color {
|
||||
isOfficial ? Color.white : Color.accentColor
|
||||
if isDeletedUser {
|
||||
return Color.accentColor
|
||||
}
|
||||
return isOfficial ? Color.white : Color.accentColor
|
||||
}
|
||||
|
||||
private var messagePreview: String {
|
||||
@ -742,6 +754,10 @@ private struct ChatRowView: View {
|
||||
return "?"
|
||||
}
|
||||
|
||||
private var deletedUserSymbolName: String {
|
||||
return "person.slash"
|
||||
}
|
||||
|
||||
private var subtitleColor: Color {
|
||||
chat.unreadCount > 0 ? .primary : .secondary
|
||||
}
|
||||
@ -768,9 +784,18 @@ private struct ChatRowView: View {
|
||||
.fill(avatarBackgroundColor)
|
||||
.frame(width: 44, height: 44)
|
||||
.overlay(
|
||||
Text(initial)
|
||||
.font(.headline)
|
||||
.foregroundColor(avatarTextColor)
|
||||
Group {
|
||||
if isDeletedUser {
|
||||
Image(systemName: deletedUserSymbolName)
|
||||
.symbolRenderingMode(.hierarchical)
|
||||
.font(.system(size: 20, weight: .semibold))
|
||||
.foregroundColor(avatarTextColor)
|
||||
} else {
|
||||
Text(initial)
|
||||
.font(.headline)
|
||||
.foregroundColor(avatarTextColor)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
VStack(alignment: .leading, spacing: 4) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user