Skip to content

Commit 2e67149

Browse files
Fixed visibility for deleted messages indicator for current user
1 parent ae41f3d commit 2e67149

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

CHANGELOG.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
33

44
# Upcoming
55

6-
### 🔄 Changed
6+
### 🐞 Fixed
7+
- Fixed visibility for deleted messages indicator for current user
78

89
# [4.38.0](https://github.com/GetStream/stream-chat-swiftui/releases/tag/4.38.0)
910
_September 29, 2023_

Sources/StreamChatSwiftUI/ChatChannel/MessageList/DeletedMessageView.swift

+14-7
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import SwiftUI
77

88
/// View displayed when a message is deleted.
99
public struct DeletedMessageView: View {
10+
@Injected(\.chatClient) private var chatClient
1011
@Injected(\.images) private var images
1112
@Injected(\.fonts) private var fonts
1213
@Injected(\.colors) private var colors
@@ -15,6 +16,10 @@ public struct DeletedMessageView: View {
1516
private var dateFormatter: DateFormatter {
1617
utils.dateFormatter
1718
}
19+
20+
private var deletedMessageVisibility: ChatClientConfig.DeletedMessageVisibility {
21+
chatClient.config.deletedMessagesVisibility
22+
}
1823

1924
var message: ChatMessage
2025
var isFirst: Bool
@@ -35,14 +40,16 @@ public struct DeletedMessageView: View {
3540
HStack {
3641
Spacer()
3742

38-
Image(uiImage: images.eye)
39-
.customizable()
40-
.frame(maxWidth: 12)
41-
.accessibilityIdentifier("onlyVisibleToYouImageView")
43+
if deletedMessageVisibility == .visibleForCurrentUser {
44+
Image(uiImage: images.eye)
45+
.customizable()
46+
.frame(maxWidth: 12)
47+
.accessibilityIdentifier("onlyVisibleToYouImageView")
4248

43-
Text(L10n.Message.onlyVisibleToYou)
44-
.font(fonts.footnote)
45-
.accessibilityIdentifier("onlyVisibleToYouLabel")
49+
Text(L10n.Message.onlyVisibleToYou)
50+
.font(fonts.footnote)
51+
.accessibilityIdentifier("onlyVisibleToYouLabel")
52+
}
4653

4754
Text(dateFormatter.string(from: message.createdAt))
4855
.font(fonts.footnote)

0 commit comments

Comments
 (0)