How to send Giphy image to message list with customized button? #111
kai-leeee
announced in
1. Chatting in a channel
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Summary
Guide & Snippet
1.
To add a customized button to the input view, you need to change
messageInputView
. Specifically, you need to insert a new view ininputHStackView
and modify the icon position by adjusting the index ininsertArrangedSubview
.To handle the tap event from the
giphyButton
, define a custom delegate. You can relay the event externally by executing a delegate method inside the button's action.2
Now, create the
CustomGroupChannelModuleInputComponent
class with the custom input view,LeftButtonAddedMessageInputView
. All we need to do is switching itsmessageInputView
to ourLeftButtonAddedMessageInputView
instance whilesetupView
is in progress.Don't forget to implement
CustomMessageInputViewDelegate
to monitor tap events, and also declareCustomGroupChannelModuleInputDelegate
to further relay these events outside of the component, to the view controller in this example.3
For the next step, implement the
CustomGroupChannelModuleInputDelegate
within yourCustomGroupChannelViewController
. This will allow you to monitor tap events on thegiphyButton
.If you have obtained the URL of a GIF from your codes, use the
viewModel
'ssendFileMessage
method to transmit the GIF file. You just need to pass the URL to theFileMessageCreateParams
constructor in thefileURL
to send a message.4
Lastly, you need to update
SBUModuleSet
andSBUViewControllerSet
like below:References
Beta Was this translation helpful? Give feedback.
All reactions