minor refactor
This commit is contained in:
parent
102b4a67ad
commit
282230c87a
|
@ -97,6 +97,7 @@ final class InfoMessageCell: MessageCell {
|
|||
iconImageViewHeightConstraint.constant = (icon != nil) ? InfoMessageCell.iconSize : 0
|
||||
|
||||
self.label.text = cellViewModel.body
|
||||
self.label.themeTextColor = (cellViewModel.variant == .infoClosedGroupCurrentUserErrorLeaving) ? .danger : .textPrimary
|
||||
}
|
||||
|
||||
override func dynamicUpdate(with cellViewModel: MessageViewModel, playbackInfo: ConversationViewModel.PlaybackInfo?) {
|
||||
|
|
|
@ -493,7 +493,7 @@ public final class FullConversationCell: UITableViewCell {
|
|||
|
||||
if
|
||||
(cellViewModel.threadVariant == .closedGroup || cellViewModel.threadVariant == .openGroup) &&
|
||||
(![Interaction.Variant.infoClosedGroupCurrentUserErrorLeaving, Interaction.Variant.infoClosedGroupCurrentUserLeaving].contains(cellViewModel.interactionVariant))
|
||||
(cellViewModel.interactionVariant?.isGroupControlMessage == false)
|
||||
{
|
||||
let authorName: String = cellViewModel.authorName(for: cellViewModel.threadVariant)
|
||||
|
||||
|
|
|
@ -89,7 +89,7 @@ public struct Interaction: Codable, Identifiable, Equatable, FetchableRecord, Mu
|
|||
|
||||
public var isInfoMessage: Bool {
|
||||
switch self {
|
||||
case .infoClosedGroupCreated, .infoClosedGroupUpdated,
|
||||
case .infoClosedGroupCreated, .infoClosedGroupUpdated,
|
||||
.infoClosedGroupCurrentUserLeft, .infoClosedGroupCurrentUserLeaving, .infoClosedGroupCurrentUserErrorLeaving,
|
||||
.infoDisappearingMessagesUpdate, .infoScreenshotNotification, .infoMediaSavedNotification,
|
||||
.infoMessageRequestAccepted, .infoCall:
|
||||
|
@ -100,6 +100,16 @@ public struct Interaction: Codable, Identifiable, Equatable, FetchableRecord, Mu
|
|||
}
|
||||
}
|
||||
|
||||
public var isGroupControlMessage: Bool {
|
||||
switch self {
|
||||
case .infoClosedGroupCreated, .infoClosedGroupUpdated,
|
||||
.infoClosedGroupCurrentUserLeft, .infoClosedGroupCurrentUserLeaving, .infoClosedGroupCurrentUserErrorLeaving:
|
||||
return true
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
/// This flag controls whether the `wasRead` flag is automatically set to true based on the message variant (as a result it they will
|
||||
/// or won't affect the unread count)
|
||||
fileprivate var canBeUnread: Bool {
|
||||
|
|
Loading…
Reference in New Issue