Compare commits
3 Commits
342da3b773
...
c9bfab0b14
| Author | SHA1 | Date | |
|---|---|---|---|
| c9bfab0b14 | |||
| 3e1811fa51 | |||
| bd83abda04 |
@ -1053,7 +1053,14 @@
|
|||||||
|
|
||||||
},
|
},
|
||||||
"Неизвестный пользователь" : {
|
"Неизвестный пользователь" : {
|
||||||
|
"localizations" : {
|
||||||
|
"en" : {
|
||||||
|
"stringUnit" : {
|
||||||
|
"state" : "translated",
|
||||||
|
"value" : "Unknown User"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"Некорректный ответ от сервера." : {
|
"Некорректный ответ от сервера." : {
|
||||||
|
|
||||||
|
|||||||
@ -640,12 +640,24 @@ private struct ChatRowView: View {
|
|||||||
officialFullName != nil
|
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 {
|
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 {
|
private var avatarTextColor: Color {
|
||||||
isOfficial ? Color.white : Color.accentColor
|
if isDeletedUser {
|
||||||
|
return Color.accentColor
|
||||||
|
}
|
||||||
|
return isOfficial ? Color.white : Color.accentColor
|
||||||
}
|
}
|
||||||
|
|
||||||
private var messagePreview: String {
|
private var messagePreview: String {
|
||||||
@ -742,6 +754,10 @@ private struct ChatRowView: View {
|
|||||||
return "?"
|
return "?"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private var deletedUserSymbolName: String {
|
||||||
|
return "person.slash"
|
||||||
|
}
|
||||||
|
|
||||||
private var subtitleColor: Color {
|
private var subtitleColor: Color {
|
||||||
chat.unreadCount > 0 ? .primary : .secondary
|
chat.unreadCount > 0 ? .primary : .secondary
|
||||||
}
|
}
|
||||||
@ -768,19 +784,37 @@ private struct ChatRowView: View {
|
|||||||
.fill(avatarBackgroundColor)
|
.fill(avatarBackgroundColor)
|
||||||
.frame(width: 44, height: 44)
|
.frame(width: 44, height: 44)
|
||||||
.overlay(
|
.overlay(
|
||||||
|
Group {
|
||||||
|
if isDeletedUser {
|
||||||
|
Image(systemName: deletedUserSymbolName)
|
||||||
|
.symbolRenderingMode(.hierarchical)
|
||||||
|
.font(.system(size: 20, weight: .semibold))
|
||||||
|
.foregroundColor(avatarTextColor)
|
||||||
|
} else {
|
||||||
Text(initial)
|
Text(initial)
|
||||||
.font(.headline)
|
.font(.headline)
|
||||||
.foregroundColor(avatarTextColor)
|
.foregroundColor(avatarTextColor)
|
||||||
|
}
|
||||||
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
VStack(alignment: .leading, spacing: 4) {
|
VStack(alignment: .leading, spacing: 4) {
|
||||||
if let officialName = officialFullName {
|
if let officialName = officialFullName {
|
||||||
HStack(spacing: 6) {
|
HStack(spacing: 6) {
|
||||||
|
if #available(iOS 16.0, *) {
|
||||||
Text(officialName)
|
Text(officialName)
|
||||||
.fontWeight(.semibold)
|
.fontWeight(.semibold)
|
||||||
.foregroundColor(.primary)
|
.foregroundColor(.primary)
|
||||||
.lineLimit(1)
|
.lineLimit(1)
|
||||||
.truncationMode(.tail)
|
.truncationMode(.tail)
|
||||||
|
.strikethrough(isDeletedUser, color: Color.secondary)
|
||||||
|
} else {
|
||||||
|
Text(officialName)
|
||||||
|
.fontWeight(.semibold)
|
||||||
|
.foregroundColor(.primary)
|
||||||
|
.lineLimit(1)
|
||||||
|
.truncationMode(.tail)
|
||||||
|
}
|
||||||
|
|
||||||
Image(systemName: "checkmark.seal.fill")
|
Image(systemName: "checkmark.seal.fill")
|
||||||
.foregroundColor(Color.accentColor)
|
.foregroundColor(Color.accentColor)
|
||||||
@ -795,11 +829,20 @@ private struct ChatRowView: View {
|
|||||||
// .truncationMode(.tail)
|
// .truncationMode(.tail)
|
||||||
// }
|
// }
|
||||||
} else {
|
} else {
|
||||||
|
if #available(iOS 16.0, *) {
|
||||||
Text(title)
|
Text(title)
|
||||||
.fontWeight(chat.unreadCount > 0 ? .semibold : .regular)
|
.fontWeight(chat.unreadCount > 0 ? .semibold : .regular)
|
||||||
.foregroundColor(.primary)
|
.foregroundColor(.primary)
|
||||||
.lineLimit(1)
|
.lineLimit(1)
|
||||||
.truncationMode(.tail)
|
.truncationMode(.tail)
|
||||||
|
.strikethrough(isDeletedUser, color: Color.secondary)
|
||||||
|
} else {
|
||||||
|
Text(title)
|
||||||
|
.fontWeight(chat.unreadCount > 0 ? .semibold : .regular)
|
||||||
|
.foregroundColor(.primary)
|
||||||
|
.lineLimit(1)
|
||||||
|
.truncationMode(.tail)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Text(messagePreview)
|
Text(messagePreview)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user