@@ -72,12 +72,12 @@ open class MessageSizeCalculator: CellSizeCalculator {
7272 let indexPath = attributes. indexPath
7373 let message = dataSource. messageForItem ( at: indexPath, in: messagesLayout. messagesCollectionView)
7474
75- attributes. avatarSize = avatarSize ( for: message)
75+ attributes. avatarSize = avatarSize ( for: message, at : indexPath )
7676 attributes. avatarPosition = avatarPosition ( for: message)
7777 attributes. avatarLeadingTrailingPadding = avatarLeadingTrailingPadding
7878
7979 attributes. messageContainerPadding = messageContainerPadding ( for: message)
80- attributes. messageContainerSize = messageContainerSize ( for: message)
80+ attributes. messageContainerSize = messageContainerSize ( for: message, at : indexPath )
8181 attributes. cellTopLabelSize = cellTopLabelSize ( for: message, at: indexPath)
8282 attributes. cellTopLabelAlignment = cellTopLabelAlignment ( for: message)
8383 attributes. cellBottomLabelSize = cellBottomLabelSize ( for: message, at: indexPath)
@@ -103,13 +103,13 @@ open class MessageSizeCalculator: CellSizeCalculator {
103103
104104 open func cellContentHeight( for message: MessageType , at indexPath: IndexPath ) -> CGFloat {
105105
106- let messageContainerHeight = messageContainerSize ( for: message) . height
106+ let messageContainerHeight = messageContainerSize ( for: message, at : indexPath ) . height
107107 let cellBottomLabelHeight = cellBottomLabelSize ( for: message, at: indexPath) . height
108108 let messageBottomLabelHeight = messageBottomLabelSize ( for: message, at: indexPath) . height
109109 let cellTopLabelHeight = cellTopLabelSize ( for: message, at: indexPath) . height
110110 let messageTopLabelHeight = messageTopLabelSize ( for: message, at: indexPath) . height
111111 let messageVerticalPadding = messageContainerPadding ( for: message) . vertical
112- let avatarHeight = avatarSize ( for: message) . height
112+ let avatarHeight = avatarSize ( for: message, at : indexPath ) . height
113113 let avatarVerticalPosition = avatarPosition ( for: message) . vertical
114114 let accessoryViewHeight = accessoryViewSize ( for: message) . height
115115
@@ -163,7 +163,7 @@ open class MessageSizeCalculator: CellSizeCalculator {
163163 return position
164164 }
165165
166- open func avatarSize( for message: MessageType ) -> CGSize {
166+ open func avatarSize( for message: MessageType , at indexPath : IndexPath ) -> CGSize {
167167 let dataSource = messagesLayout. messagesDataSource
168168 let isFromCurrentSender = dataSource. isFromCurrentSender ( message: message)
169169 return isFromCurrentSender ? outgoingAvatarSize : incomingAvatarSize
@@ -282,13 +282,13 @@ open class MessageSizeCalculator: CellSizeCalculator {
282282 return isFromCurrentSender ? outgoingMessagePadding : incomingMessagePadding
283283 }
284284
285- open func messageContainerSize( for message: MessageType ) -> CGSize {
285+ open func messageContainerSize( for message: MessageType , at indexPath : IndexPath ) -> CGSize {
286286 // Returns .zero by default
287287 return . zero
288288 }
289289
290- open func messageContainerMaxWidth( for message: MessageType ) -> CGFloat {
291- let avatarWidth = avatarSize ( for: message) . width
290+ open func messageContainerMaxWidth( for message: MessageType , at indexPath : IndexPath ) -> CGFloat {
291+ let avatarWidth : CGFloat = avatarSize ( for: message, at : indexPath ) . width
292292 let messagePadding = messageContainerPadding ( for: message)
293293 let accessoryWidth = accessoryViewSize ( for: message) . width
294294 let accessoryPadding = accessoryViewPadding ( for: message)
0 commit comments