Skip to content

Commit c23ce15

Browse files
Added public init for ChatChannelListItem
1 parent c9d47fd commit c23ce15

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
55

66
### ✅ Added
77
- Configuring avatars visibility in groups
8+
- Method to swap the `MessageRepliesView`
9+
- Public init for `ChatChannelListItem`
810

911
### 🔄 Changed
1012
- Message list creation requires `shouldShowTypingIndicator` as a parameter

Sources/StreamChatSwiftUI/ChatChannelList/ChatChannelListItem.swift

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public struct ChatChannelListItem: View {
1313
@Injected(\.utils) private var utils
1414
@Injected(\.images) private var images
1515
@Injected(\.chatClient) private var chatClient
16-
16+
1717
var channel: ChatChannel
1818
var channelName: String
1919
var injectedChannelInfo: InjectedChannelInfo?
@@ -22,6 +22,24 @@ public struct ChatChannelListItem: View {
2222
var disabled = false
2323
var onItemTap: (ChatChannel) -> Void
2424

25+
public init(
26+
channel: ChatChannel,
27+
channelName: String,
28+
injectedChannelInfo: InjectedChannelInfo? = nil,
29+
avatar: UIImage,
30+
onlineIndicatorShown: Bool,
31+
disabled: Bool = false,
32+
onItemTap: @escaping (ChatChannel) -> Void
33+
) {
34+
self.channel = channel
35+
self.channelName = channelName
36+
self.injectedChannelInfo = injectedChannelInfo
37+
self.avatar = avatar
38+
self.onlineIndicatorShown = onlineIndicatorShown
39+
self.disabled = disabled
40+
self.onItemTap = onItemTap
41+
}
42+
2543
public var body: some View {
2644
Button {
2745
onItemTap(channel)

0 commit comments

Comments
 (0)