Skip to content

Commit 873f47f

Browse files
Exposed components from the ChatChannelInfoView
1 parent f8b7d58 commit 873f47f

File tree

5 files changed

+50
-20
lines changed

5 files changed

+50
-20
lines changed

CHANGELOG.md

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

44
# Upcoming
55

6-
### 🔄 Changed
6+
### ✅ Added
7+
- Added more parameters to the `sendMessage` method in the `MessageComposerViewModel`
8+
- Exposed components from the `ChatChannelInfoView`
79

810
# [4.29.0](https://github.com/GetStream/stream-chat-swiftui/releases/tag/4.29.0)
911
_March 17, 2023_

Sources/StreamChatSwiftUI/ChatChannel/ChannelInfo/ChatChannelInfoHelperViews.swift

Lines changed: 38 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -112,15 +112,18 @@ public struct ChatInfoOptionsView: View {
112112
}
113113
}
114114

115-
struct ChannelNameUpdateView: View {
116-
115+
public struct ChannelNameUpdateView: View {
117116
@Injected(\.images) private var images
118117
@Injected(\.colors) private var colors
119118
@Injected(\.fonts) private var fonts
120119

121120
@StateObject var viewModel: ChatChannelInfoViewModel
121+
122+
public init(viewModel: ChatChannelInfoViewModel) {
123+
_viewModel = StateObject(wrappedValue: viewModel)
124+
}
122125

123-
var body: some View {
126+
public var body: some View {
124127
HStack(spacing: 16) {
125128
Text(L10n.ChatInfo.Rename.name)
126129
.font(fonts.footnote)
@@ -154,13 +157,22 @@ struct ChannelNameUpdateView: View {
154157
}
155158
}
156159

157-
struct NavigatableChatInfoItemView<Destination: View>: View {
158-
160+
public struct NavigatableChatInfoItemView<Destination: View>: View {
159161
let icon: UIImage
160162
let title: String
161163
var destination: () -> Destination
164+
165+
public init(
166+
icon: UIImage,
167+
title: String,
168+
destination: @escaping () -> Destination
169+
) {
170+
self.icon = icon
171+
self.title = title
172+
self.destination = destination
173+
}
162174

163-
var body: some View {
175+
public var body: some View {
164176
NavigationLink {
165177
destination()
166178
} label: {
@@ -181,7 +193,7 @@ struct DisclosureIndicatorView: View {
181193
}
182194
}
183195

184-
struct ChannelInfoItemView<TrailingView: View>: View {
196+
public struct ChannelInfoItemView<TrailingView: View>: View {
185197

186198
@Injected(\.colors) private var colors
187199
@Injected(\.fonts) private var fonts
@@ -190,8 +202,20 @@ struct ChannelInfoItemView<TrailingView: View>: View {
190202
let title: String
191203
var verticalPadding: CGFloat = 16
192204
var trailingView: () -> TrailingView
205+
206+
public init(
207+
icon: UIImage,
208+
title: String,
209+
verticalPadding: CGFloat = 16,
210+
trailingView: @escaping () -> TrailingView
211+
) {
212+
self.icon = icon
213+
self.title = title
214+
self.verticalPadding = verticalPadding
215+
self.trailingView = trailingView
216+
}
193217

194-
var body: some View {
218+
public var body: some View {
195219
HStack(spacing: 16) {
196220
Image(uiImage: icon)
197221
.customizable()
@@ -234,13 +258,17 @@ struct ChatInfoDirectChannelView: View {
234258
}
235259
}
236260

237-
struct ChatInfoMentionText: View {
261+
public struct ChatInfoMentionText: View {
238262

239263
@Injected(\.colors) private var colors
240264

241265
var participant: ParticipantInfo?
266+
267+
public init(participant: ParticipantInfo? = nil) {
268+
self.participant = participant
269+
}
242270

243-
var body: some View {
271+
public var body: some View {
244272
let mentionText = "@\(participant?.chatUser.mentionText ?? "")"
245273
ChannelInfoItemView(
246274
icon: UIImage(systemName: "person")!,

Sources/StreamChatSwiftUI/ChatChannel/ChannelInfo/FileAttachmentsView.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ import StreamChat
66
import SwiftUI
77

88
/// View displaying file attachments.
9-
struct FileAttachmentsView: View {
9+
public struct FileAttachmentsView: View {
1010

1111
@StateObject private var viewModel: FileAttachmentsViewModel
1212

1313
@Injected(\.colors) private var colors
1414
@Injected(\.fonts) private var fonts
1515

16-
init(channel: ChatChannel) {
16+
public init(channel: ChatChannel) {
1717
_viewModel = StateObject(
1818
wrappedValue: FileAttachmentsViewModel(channel: channel)
1919
)
@@ -23,7 +23,7 @@ struct FileAttachmentsView: View {
2323
_viewModel = StateObject(wrappedValue: viewModel)
2424
}
2525

26-
var body: some View {
26+
public var body: some View {
2727
ZStack {
2828
if viewModel.loading {
2929
LoadingView()

Sources/StreamChatSwiftUI/ChatChannel/ChannelInfo/MediaAttachmentsView.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import StreamChat
66
import SwiftUI
77

88
/// View displaying media attachments.
9-
struct MediaAttachmentsView: View {
9+
public struct MediaAttachmentsView: View {
1010

1111
@StateObject private var viewModel: MediaAttachmentsViewModel
1212

@@ -22,7 +22,7 @@ struct MediaAttachmentsView: View {
2222

2323
private let columns = [GridItem(.adaptive(minimum: itemWidth), spacing: spacing)]
2424

25-
init(channel: ChatChannel) {
25+
public init(channel: ChatChannel) {
2626
_viewModel = StateObject(
2727
wrappedValue: MediaAttachmentsViewModel(channel: channel)
2828
)
@@ -34,7 +34,7 @@ struct MediaAttachmentsView: View {
3434
)
3535
}
3636

37-
var body: some View {
37+
public var body: some View {
3838
ZStack {
3939
if viewModel.loading {
4040
LoadingView()

Sources/StreamChatSwiftUI/ChatChannel/ChannelInfo/PinnedMessagesView.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,17 @@ import StreamChat
66
import SwiftUI
77

88
/// View displaying pinned messages in the chat info screen.
9-
struct PinnedMessagesView: View {
9+
public struct PinnedMessagesView: View {
1010

1111
@StateObject private var viewModel: PinnedMessagesViewModel
1212

13-
init(channel: ChatChannel) {
13+
public init(channel: ChatChannel) {
1414
_viewModel = StateObject(
1515
wrappedValue: PinnedMessagesViewModel(channel: channel)
1616
)
1717
}
1818

19-
var body: some View {
19+
public var body: some View {
2020
ZStack {
2121
if !viewModel.pinnedMessages.isEmpty {
2222
ScrollView {

0 commit comments

Comments
 (0)