GetStream / Streamoji

:godmode: Custom emoji rendering library for iOS apps with support for GIF & still images - plug-in extension for UITextView - performance, cache βœ… - Made with πŸ’˜ by @GetStream
https://getstream.io/
MIT License
253 stars 15 forks source link

Blank Images problem fix when using Streamoji in TableViewCell #6

Open mehmetdelikaya opened 2 years ago

mehmetdelikaya commented 2 years ago

Hi there,

First of all, thanks for the great library as it is one of the life savers for iOS devs, at least for me πŸ‘ πŸ‘

My task was binding some text with custom emoticons to UITextView which is inside UITableViewCell. Thanks to Stremoji, it was showing the emoticons. However when I tested it like scrolling the UITableView, I have noticed that library is a bit buggy as it shows blank images when the invisible cells reappear. I have checked the issues and seen one open issue similar to the my problem (https://github.com/GetStream/Streamoji/issues/4).

I have decided the fork the library and find a solution on my own. After digging a lot, I find a solution by giving a delay value for the addEmojisIfNeeded function. The operation was already async but with no delay. Giving a delay value fixed the situation for my side. I have duplicated the functions ..WithDelay postfix and new param delay : Double?

People who face the same problem can use the funcs that I have created. I could have added delay param intto your funcs but didn't want to break your example.

I posted a demo with two versions. The left one on the video uses configureEmojis, the right one on the video uses configureEmojisWithDelay of 0.5

I also provided my example repo as shown below: https://github.com/mehmetdelikaya/EmojiExample

https://user-images.githubusercontent.com/16878744/183697591-cf658fe1-b34d-4028-aa19-76ebf15b534a.mov

mehmetdelikaya commented 2 years ago

@cardoso fyi

cardoso commented 2 years ago

Hi @mehmetdelikaya ! Thanks for your contribution πŸ™Œ and thanks for being mindful of not breaking the API. πŸ™

Ideally the existing function would work in your case without the need for this workaround, but it will require some investigation.

I'll merge this to keep things moving for you and others and look into how we can improve the solution in a future PR. If you have ideas, feel free to raise them!

cardoso commented 2 years ago

Ah, seems I don't have access to merge anymore.

Maybe someone at @getstream could take over? (cc: @Nash0x75E @polqf @amosgyamfi @nuno-vieira)

mehmetdelikaya commented 2 years ago

Hi @cardoso !

It would be good to know if there is a way to perform the desired output without my workaround. Also I use my own forked version for now, just in case that you cannot merge.

Thanks for your reply and good effort for the library.

cardoso commented 2 years ago

Sounds good @mehmetdelikaya

Alternatively, I could keep maintaining this if I'm given access to this particular repository to avoid everyone needing to fork it. There are some with macOS support and other bug fixes which I'd like to introduce here too.

mehmetdelikaya commented 2 years ago

That seems legit to me as this library is one kind of life saver :)