@@ -15,15 +15,17 @@ class DemoAppFactory: ViewFactory {
1515
1616 public static let shared = DemoAppFactory ( )
1717
18- func makeChannelListHeaderViewModifier( title : String ) -> some ChannelListHeaderViewModifier {
19- CustomChannelModifier ( title: title)
18+ func makeChannelListHeaderViewModifier( options : ChannelListHeaderViewModifierOptions ) -> some ChannelListHeaderViewModifier {
19+ CustomChannelModifier ( title: options . title)
2020 }
2121
2222 func supportedMoreChannelActions(
23- for channel: ChatChannel ,
24- onDismiss: @escaping @MainActor ( ) -> Void ,
25- onError: @escaping @MainActor ( Error ) -> Void
23+ options: SupportedMoreChannelActionsOptions
2624 ) -> [ ChannelAction ] {
25+ let channel = options. channel
26+ let onDismiss = options. onDismiss
27+ let onError = options. onError
28+
2729 var actions = ChannelAction . defaultActions (
2830 for: channel,
2931 chatClient: chatClient,
@@ -42,19 +44,20 @@ class DemoAppFactory: ViewFactory {
4244 }
4345
4446 func makeChannelListItem(
45- channel: ChatChannel ,
46- channelName: String ,
47- avatar: UIImage ,
48- onlineIndicatorShown: Bool ,
49- disabled: Bool ,
50- selectedChannel: Binding < ChannelSelectionInfo ? > ,
51- swipedChannelId: Binding < String ? > ,
52- channelDestination: @escaping @MainActor ( ChannelSelectionInfo ) -> ChatChannelView < DemoAppFactory > ,
53- onItemTap: @escaping @MainActor ( ChatChannel ) -> Void ,
54- trailingSwipeRightButtonTapped: @escaping @MainActor ( ChatChannel ) -> Void ,
55- trailingSwipeLeftButtonTapped: @escaping @MainActor ( ChatChannel ) -> Void ,
56- leadingSwipeButtonTapped: @escaping @MainActor ( ChatChannel ) -> Void
47+ options: ChannelListItemOptions < ChannelDestination >
5748 ) -> some View {
49+ let channel = options. channel
50+ let channelName = options. channelName
51+ let avatar = options. avatar
52+ let onlineIndicatorShown = options. onlineIndicatorShown
53+ let disabled = options. disabled
54+ let selectedChannel = options. selectedChannel
55+ let swipedChannelId = options. swipedChannelId
56+ let channelDestination = options. channelDestination
57+ let onItemTap = options. onItemTap
58+ let trailingSwipeRightButtonTapped = options. trailingSwipeRightButtonTapped
59+ let trailingSwipeLeftButtonTapped = options. trailingSwipeLeftButtonTapped
60+ let leadingSwipeButtonTapped = options. leadingSwipeButtonTapped
5861 let listItem = DemoAppChatChannelNavigatableListItem (
5962 channel: channel,
6063 channelName: channelName,
@@ -231,35 +234,37 @@ class CustomFactory: ViewFactory {
231234
232235 public static let shared = CustomFactory ( )
233236
234- func makeGiphyBadgeViewType( for message : ChatMessage , availableWidth : CGFloat ) -> some View {
237+ func makeGiphyBadgeViewType( options : GiphyBadgeViewTypeOptions ) -> some View {
235238 EmptyView ( )
236239 }
237240
238- func makeLoadingView( ) -> some View {
241+ func makeLoadingView( options : LoadingViewOptions ) -> some View {
239242 VStack {
240243 Text ( " This is custom loading view " )
241244 ProgressView ( )
242245 }
243246 }
244247
245- func makeNoChannelsView( ) -> some View {
248+ func makeNoChannelsView( options : NoChannelsViewOptions ) -> some View {
246249 VStack {
247250 Spacer ( )
248251 Text ( " This is our own custom no channels view. " )
249252 Spacer ( )
250253 }
251254 }
252255
253- func makeChannelListHeaderViewModifier( title : String ) -> some ChannelListHeaderViewModifier {
254- CustomChannelModifier ( title: title)
256+ func makeChannelListHeaderViewModifier( options : ChannelListHeaderViewModifierOptions ) -> some ChannelListHeaderViewModifier {
257+ CustomChannelModifier ( title: options . title)
255258 }
256259
257260 // Example for an injected action. Uncomment to see it in action.
258261 func supportedMoreChannelActions(
259- for channel: ChatChannel ,
260- onDismiss: @escaping @MainActor ( ) -> Void ,
261- onError: @escaping @MainActor ( Error ) -> Void
262+ options: SupportedMoreChannelActionsOptions
262263 ) -> [ ChannelAction ] {
264+ let channel = options. channel
265+ let onDismiss = options. onDismiss
266+ let onError = options. onError
267+
263268 var defaultActions = ChannelAction . defaultActions (
264269 for: channel,
265270 chatClient: chatClient,
@@ -296,16 +301,14 @@ class CustomFactory: ViewFactory {
296301 }
297302
298303 func makeMoreChannelActionsView(
299- for channel: ChatChannel ,
300- onDismiss: @escaping @MainActor ( ) -> Void ,
301- onError: @escaping @MainActor ( Error ) -> Void
304+ options: MoreChannelActionsViewOptions
302305 ) -> some View {
303306 VStack {
304307 Text ( " This is our custom view " )
305308 Spacer ( )
306309 HStack {
307310 Button {
308- onDismiss ( )
311+ options . onDismiss ( )
309312 } label: {
310313 Text ( " Action " )
311314 }
@@ -315,22 +318,23 @@ class CustomFactory: ViewFactory {
315318 }
316319
317320 func makeMessageTextView(
318- for message: ChatMessage ,
319- isFirst: Bool ,
320- availableWidth: CGFloat
321+ options: MessageTextViewOptions
321322 ) -> some View {
322- CustomMessageTextView (
323+ let message = options. message
324+ let isFirst = options. isFirst
325+ return CustomMessageTextView (
323326 message: message,
324327 isFirst: isFirst
325328 )
326329 }
327330
328331 func makeCustomAttachmentViewType(
329- for message: ChatMessage ,
330- isFirst: Bool ,
331- availableWidth: CGFloat
332+ options: CustomAttachmentViewTypeOptions
332333 ) -> some View {
333- CustomAttachmentView (
334+ let message = options. message
335+ let isFirst = options. isFirst
336+ let availableWidth = options. availableWidth
337+ return CustomAttachmentView (
334338 message: message,
335339 width: availableWidth,
336340 isFirst: isFirst
0 commit comments