Group multiple images in a grid for group channels

Hi guys!

I was wondering if there is an easy way to group and display a list of image messages in a grid (like whatsapp for example) using Sendbird’s UIKit without too much fuss. I found a channel instance method that sends multiple files, but are sent as individual messages and UIKit is displaying them as 1 message / file.
I was thinking of attaching extra info for this image messages, identifying, and display them as a single message in a grid. But I thing the biggest problem is overriding channel datasource logic.

Any idea on the best approach to achieve this?

Thank you! Have a nice day!

1 Like

Hi @vlad.preda,

Within the UIKit this isn’t possible without overriding the entire message display. When you send multiple images, they are send to Sendbird as individual images and thus returned as individual images so you would need to come up with a way to tag them together so you would know to group them. Further more, you’d need to implement your own view to display the images as such.

1 Like

@Tyler Thank you for your response!

But this basically means that I need to rewrite a very big part of SBUBaseChannelViewController & SBUChannelViewController if not all of it beside the custom view for displaying a group of images.

I think the easiest way would be to do a hack and update the way the UITableView is built, using a custom cell for messages starting from i to i+j, where j will be the size of the number of images from a grup, and using empty cells with height 0 for messages from i+1 to i+j. But I don’t know if this is the best solution, and if UIKit offers me the flexibility to do this.

But do you know if Sendbird is working or takes into account developing a feature like this for UIKit? Because I think this is an important feature for a modern chat. A lot of users need to send multiple files and it would be great to display them as a grid instead of distributing them across the scroll.

Thank you!

2 Likes

Hi @vlad.preda,

I definitely understand where you’re coming from. As it currently stands, adding in a feature like this to the UIKit is not part of the roadmap. The UIKit was originally designed to be easy drop in solution for chat with minimal customizations. I should note that we have open sourced our UIKit so that you can see the inner workings to potentially help you better implement customizations. You can find that link below:

1 Like

I understand. I will try to find a way to customize UIKit in order to achieve what I need.
Thank you for your support. Have a nice day!

1 Like