-
Notifications
You must be signed in to change notification settings - Fork 303
Add ability to cancel link previews #5832
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
Add ability to cancel link previews #5832
Conversation
SDK Size Comparison 📏
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Adds the ability for users to cancel link previews in the message composer and ensures no URL enrichment occurs after cancellation.
- Introduces
cancelLinkPreview
in the controller and view model - Updates UI components and factory interface to accept and invoke an
onCancelLinkPreviewClick
callback - Adjusts message-sending logic to skip URL enrichment when the preview list is empty
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
stream-chat-android-ui-common/src/.../MessageComposerController.kt | Adds skipEnrichUrl flag in sendMessage and a cancelLinkPreview method |
stream-chat-android-compose/src/.../MessageComposerViewModel.kt | Exposes cancelLinkPreview() on the view model |
stream-chat-android-compose/src/.../ChatComponentFactory.kt | Adds onCancelLinkPreviewClick callback to the factory interface |
stream-chat-android-compose/src/.../MessageComposer.kt | Propagates the new cancel callback through all MessageComposer overloads |
stream-chat-android-compose/src/.../ComposerLinkPreview.kt | Calls onCancel() before hiding the preview |
stream-chat-android-compose-sample/src/.../HyperLinksTests.kt | Removes ignored tests and updates assertions for no-preview cases |
Comments suppressed due to low confidence (3)
stream-chat-android-ui-common/src/main/kotlin/io/getstream/chat/android/ui/common/feature/messages/composer/MessageComposerController.kt:1095
- Provide a meaningful KDoc for
cancelLinkPreview()
or remove the empty doc comment to avoid an empty documentation stub.
/**
stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/theme/ChatComponentFactory.kt:1328
- Add KDoc to describe the
onCancelLinkPreviewClick
callback, explaining when it is invoked and how consumers should use it.
onCancelLinkPreviewClick: () -> Unit,
stream-chat-android-compose-sample/src/androidTestE2eDebug/kotlin/io/getstream/chat/android/compose/tests/HyperLinksTests.kt:57
- Consider adding an E2E test that verifies tapping the cancel icon on a link preview actually removes the preview and causes
skipEnrichUrl
to be applied when sending the message.
@Test
|
This pull request has been automatically marked as stale because it has been inactive for 14 days. It will be closed in 7 days if no further activity occurs. |
This commit introduces the ability to cancel link previews in the message composer. Key changes: - Added a `cancelLinkPreview` method to `MessageComposerController` and `MessageComposerViewModel`. - Updated `ComposerLinkPreview` to accept an `onCancel` callback. - When sending a message, if `linkPreviews` is empty, `skipEnrichUrl` will be set to `true`. - Connected the cancel action in the UI to the new methods. - Updated `ChatComponentFactory` and `MessageComposer` to pass the new `onCancelLinkPreviewClick` callback.
e318ea6
to
8f42c13
Compare
|
To be done when we can do breaking changes |
🎯 Goal
Introduce the ability to cancel link previews in the message composer.
🛠 Implementation details
cancelLinkPreview
method toMessageComposerController
andMessageComposerViewModel
.ComposerLinkPreview
to accept anonCancel
callback.linkPreviews
is empty,skipEnrichUrl
will be set totrue
.ChatComponentFactory
andMessageComposer
to pass the newonCancelLinkPreviewClick
callback.🎨 UI Changes
Screen_recording_20250617_140641.webm
Screen_recording_20250617_140525.webm
🧪 Testing
🎉 GIF
Please provide a suitable gif that describes your work on this pull request