fix disappearing messages for closed group control messages

pull/731/head
Ryan Zhao 2 years ago
parent f2629f193b
commit 70326b5c74

@ -101,6 +101,15 @@ final class InfoMessageCell: MessageCell {
iconImageView.themeTintColor = .textSecondary iconImageView.themeTintColor = .textSecondary
} }
self.label.text = cellViewModel.body
self.label.themeTextColor = (cellViewModel.variant == .infoClosedGroupCurrentUserErrorLeaving) ? .danger : .textSecondary
let shouldShowIcon: Bool = (icon != nil) || ((cellViewModel.expiresInSeconds ?? 0) > 0)
iconContainerViewWidthConstraint.constant = shouldShowIcon ? InfoMessageCell.iconSize : 0
iconContainerViewHeightConstraint.constant = shouldShowIcon ? InfoMessageCell.iconSize : 0
guard shouldShowIcon else { return }
// Timer // Timer
if if
let expiresStartedAtMs: Double = cellViewModel.expiresStartedAtMs, let expiresStartedAtMs: Double = cellViewModel.expiresStartedAtMs,
@ -120,14 +129,6 @@ final class InfoMessageCell: MessageCell {
timerView.isHidden = true timerView.isHidden = true
iconImageView.isHidden = false iconImageView.isHidden = false
} }
let shouldShowIcon: Bool = (icon != nil) || ((cellViewModel.expiresInSeconds ?? 0) > 0)
iconContainerViewWidthConstraint.constant = shouldShowIcon ? InfoMessageCell.iconSize : 0
iconContainerViewHeightConstraint.constant = shouldShowIcon ? InfoMessageCell.iconSize : 0
self.label.text = cellViewModel.body
self.label.themeTextColor = (cellViewModel.variant == .infoClosedGroupCurrentUserErrorLeaving) ? .danger : .textSecondary
} }
override func dynamicUpdate(with cellViewModel: MessageViewModel, playbackInfo: ConversationViewModel.PlaybackInfo?) { override func dynamicUpdate(with cellViewModel: MessageViewModel, playbackInfo: ConversationViewModel.PlaybackInfo?) {

@ -847,7 +847,7 @@ public extension Interaction {
// MARK: - Variables // MARK: - Variables
var isExpiringMessage: Bool { var isExpiringMessage: Bool {
guard variant == .standardIncoming || variant == .standardOutgoing else { return false } guard variant.shouldFollowDisappearingMessagesConfiguration else { return false }
return (expiresInSeconds ?? 0 > 0) return (expiresInSeconds ?? 0 > 0)
} }

Loading…
Cancel
Save