Skip to content

Conversation

VelikovPetar
Copy link
Contributor

@VelikovPetar VelikovPetar commented Jun 25, 2025

🎯 Goal

Resolves: https://linear.app/stream/issue/AND-605/remove-deprecate-attachmenttypelink-from-android-sdk

The attachment type link is not an officially supported (see: https://getstream.io/chat/docs/android/message_format/#attachment-format and https://getstream.io/chat/docs/android/message_format/#open-graph-scraper). Exposing the AttachmentType.LINK as a public type can be confusing for customers, because it gives a false impression that links are a separate type of attachment. Because we cannot delete this directly, it is just deprecated for the moment, and to be removed in an upcoming release.

Additionally, this PR fixes a bug where the link styling (MessageReplyStyle.linkBackgroundColorMine/MessageReplyStyle.linkBackgroundColorTheirs/MessageReplyStyle.linkStyleMine/MessageReplyStyle.linkStyleTheirs) is not applied (because the current checks for isLink() were always returning false).

🛠 Implementation details

  • Deprecate AttachmentType.LINK (Note: currently there is only one usage remaining of AttachmentType.LINK in the AttachmentDestination - but its internal and not directly linked to the Attachment class)
  • Deprecate Attachment.isLink()
  • Rework isLink() check in MessageReplyView to correctly check if the message has a link (currently it always returns false)
  • Add a createIntent method for the AttachmentActivity to avoid using hard-coded argument keys.

🎨 UI Changes

Before After
quoted_links_before quoted_links_after

🧪 Testing

  1. Customise the MessageReplyStyle properties:
  • linkBackgroundColorMine
  • linkBackgroundColorTheirs
  • linkStyleMine
  • linkStyleTheirs
  1. Run the XML sample app
  2. Quote a message containing a link
  3. The quoted message should have the customisations (background color, text color) applied.

Copy link
Contributor

github-actions bot commented Jun 25, 2025

SDK Size Comparison 📏

SDK Before After Difference Status
stream-chat-android-client 3.21 MB 3.21 MB 0.00 MB 🟢
stream-chat-android-offline 3.43 MB 3.43 MB 0.00 MB 🟢
stream-chat-android-ui-components 10.50 MB 10.50 MB 0.00 MB 🟢
stream-chat-android-compose 12.69 MB 12.69 MB 0.00 MB 🟢

Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ≥ 80%)
B Maintainability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@VelikovPetar VelikovPetar requested a review from Copilot June 25, 2025 13:01
@VelikovPetar VelikovPetar marked this pull request as ready for review June 25, 2025 13:01
@VelikovPetar VelikovPetar requested a review from a team as a code owner June 25, 2025 13:01
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR deprecates AttachmentType.LINK and its related utility, and fixes a bug where link styling in MessageReplyView was not applied. Key changes include:

  • Deprecating AttachmentType.LINK and Attachment.isLink() in core, client, and documentation.
  • Fixing link detection in MessageReplyView by updating the check logic.
  • Introducing a createIntent method in AttachmentActivity to avoid hard-coded extras.

Reviewed Changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
stream-chat-android-ui-components/src/main/kotlin/io/getstream/chat/android/ui/navigation/destinations/AttachmentDestination.kt Replaced hard-coded intent creation with AttachmentActivity.createIntent.
stream-chat-android-ui-components/src/main/kotlin/io/getstream/chat/android/ui/feature/messages/list/adapter/viewholder/attachment/UnsupportedAttachmentFactory.kt Removed deprecated AttachmentType.LINK from the supported attachment types.
stream-chat-android-ui-components/src/main/kotlin/io/getstream/chat/android/ui/feature/messages/list/adapter/view/MessageReplyView.kt Updated link detection logic to correctly identify link attachments and apply styling.
stream-chat-android-ui-components/src/main/kotlin/io/getstream/chat/android/ui/feature/gallery/AttachmentActivity.kt Added a companion object with createIntent, replacing the use of hard-coded string keys.
stream-chat-android-components/api/stream-chat-android-ui-components.api Updated API definitions to include the new createIntent method.
stream-chat-android-core/src/main/java/io/getstream/chat/android/models/AttachmentType.kt Marked AttachmentType.LINK as deprecated with updated documentation.
stream-chat-android-client/src/main/java/io/getstream/chat/android/client/utils/attachment/AttachmentUtils.kt Deprecated isLink(), with a note about its returning false.
DEPRECATIONS.md Documented the deprecation of AttachmentType.LINK and Attachment.isLink().
CHANGELOG.md Updated changelog with deprecation and link styling fix information.

@andremion andremion marked this pull request as draft August 25, 2025 11:33
@VelikovPetar VelikovPetar marked this pull request as ready for review September 8, 2025 08:57
Copy link

sonarqubecloud bot commented Sep 9, 2025

Quality Gate Failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

@andremion andremion enabled auto-merge (squash) September 9, 2025 08:02
@andremion andremion merged commit 898c9cf into develop Sep 9, 2025
12 of 13 checks passed
@andremion andremion deleted the feature/deprecate-attachment-type-link branch September 9, 2025 09:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants