-
Notifications
You must be signed in to change notification settings - Fork 220
Add SendMessageInterceptor
to intercept send message request
#3671
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
nuno-vieira
wants to merge
12
commits into
develop
Choose a base branch
from
add/send-message-interceptor
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+569
−34
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SDK Size
|
6 tasks
14b91d7
to
8301b2d
Compare
SendMessageInterceptor
to intercept send message request
…e intercepted one
…ssible to expose an interceptor that uses our internal API
…tor" This reverts commit 3985f12.
6ec6b53
to
a278241
Compare
SDK Performance
|
SDK Size
|
Generated by 🚫 Danger |
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
🔗 Issue Links
IOS-857
🎯 Goal
Add a way to intercept our send message request
📝 Summary
SendMessageInterceptor
SendMessageInterceptorFactory
ChatMessage.changing()
ChatMessage.replacing()
🛠 Implementation
SendMessageInterceptor
A new protocol has been introduced,
SendMessageInterceptor
. This will only be used if the customer provides an interceptor. If no interceptor is provided, nothing is changed.The
SendMessageInterceptor
is not exposed directly in theChatClientConfig
. Instead, it can be injected through aSendMessageInterceptorFactory
. The factory gives us more flexibility, especially to make it possible to inject theChatClient
, which can be useful in case a customer wants to use the interceptor but still wants to use our internal APIClient to make the request. I created an example on how, in the future, we can provide this to customers here. For now, I reverted it, but if any customer needs to use our APIClient, it will be easy to provide it. It can be useful for customers who might want to intercept our message requests, but only for a certain type of messages, or simply want to override some data.ChatMessage.changing()
vsChatMessage.replacing()
I added documentation to
ChatMessage.replacing()
since it was lacking, and it could be misleading on how to use it. Thereplacing()
function is useful when overriding data, especially if the customer wants to delete some of it. For example, providing thestate
withnil
will make the message state as published. Since this behaviour might not be what some customers need, achanging()
function has been introduced for the case where customers just want to change some data, but the rest should be left unchanged (It is different fromreplacing()
because in this case it is not possible to erase data, sincenil
will fallback to the original data).🧪 Manual Testing Notes
N/A. Covered by unit tests.
☑️ Contributor Checklist
docs-content
repo