We have to remove the MessagesLayoutDelegate methods that are responsible for sizing cell content and replace it with properties on MessagesCollectionViewFlowLayout.
Example from:
func avatarSize(for message: MessageType, at indexPath: IndexPath, in messagesCollectionView: MessagesCollectionView) -> CGSize
Example to:
var incomingAvatarSize: CGSize
var outgoingAvatarSize: CGSize
This is a non-backward compatible change but it's pretty much necessary to move forwards.
The delegate methods don't maintain any state so we can't cache any information related to the layout. If we make this change we can start caching the size of already seen text for scrolling.
Related: #504 #519 #555
This will introduce 2 limitations:
MessageTypes different layoutsIndexPath (this is a good thing IMO)You can see this being worked on in #555
I know progress has been really slow, we're basically just rolling back to how JSQ handles things.
cc @zhongwuzw @nathantannar4 @cwalo
We can solve point 1 by adding a property for every MessageType... that's a bit much though...
var textIncomingAvatarSize: CGSize
var photoIncomingAvatarSize: CGSize
// ... etc
I guess it would be a really good idea to ping @MessageKit/contributors in this situation. This is a pretty big change
Most helpful comment
We can solve point 1 by adding a property for every
MessageType... that's a bit much though...I guess it would be a really good idea to ping @MessageKit/contributors in this situation. This is a pretty big change