Skip to content

Conversation

@MarinTolic
Copy link
Contributor

@MarinTolic MarinTolic commented Mar 31, 2023

🎯 Goal

closes #4768

🛠 Implementation details

Propagated the property to the gallery.

🧪 Testing

Explain how this change can be tested (or why it can't be tested)

Provide a patch below if it is necessary for testing

Patch that sets `skipEnrichUrl` to true
Index: stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/viewmodel/imagepreview/ImagePreviewViewModel.kt
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/viewmodel/imagepreview/ImagePreviewViewModel.kt b/stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/viewmodel/imagepreview/ImagePreviewViewModel.kt
--- a/stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/viewmodel/imagepreview/ImagePreviewViewModel.kt	(revision 40903692fdfdd0365619ead1c157731f212b4910)
+++ b/stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/viewmodel/imagepreview/ImagePreviewViewModel.kt	(date 1680275212718)
@@ -16,6 +16,7 @@
 
 package io.getstream.chat.android.compose.viewmodel.imagepreview
 
+import android.util.Log
 import androidx.compose.runtime.getValue
 import androidx.compose.runtime.mutableStateOf
 import androidx.compose.runtime.setValue
@@ -118,6 +119,8 @@
                 it.assetUrl == imageUrl || it.imageUrl == imageUrl
             }
 
+            Log.d("VM: skipEnrichUrl", skipEnrichUrl.toString())
+
             chatClient.updateMessage(
                 message = message
                     .apply {
Index: stream-chat-android-compose-sample/src/main/java/io/getstream/chat/android/compose/sample/ui/MessagesActivity.kt
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/stream-chat-android-compose-sample/src/main/java/io/getstream/chat/android/compose/sample/ui/MessagesActivity.kt b/stream-chat-android-compose-sample/src/main/java/io/getstream/chat/android/compose/sample/ui/MessagesActivity.kt
--- a/stream-chat-android-compose-sample/src/main/java/io/getstream/chat/android/compose/sample/ui/MessagesActivity.kt	(revision 40903692fdfdd0365619ead1c157731f212b4910)
+++ b/stream-chat-android-compose-sample/src/main/java/io/getstream/chat/android/compose/sample/ui/MessagesActivity.kt	(date 1680272677019)
@@ -57,6 +57,7 @@
 import io.getstream.chat.android.compose.state.messages.SelectedMessageOptionsState
 import io.getstream.chat.android.compose.state.messages.SelectedMessageReactionsPickerState
 import io.getstream.chat.android.compose.state.messages.SelectedMessageReactionsState
+import io.getstream.chat.android.compose.ui.attachments.StreamAttachmentFactories
 import io.getstream.chat.android.compose.ui.components.composer.MessageInput
 import io.getstream.chat.android.compose.ui.components.messageoptions.defaultMessageOptionsState
 import io.getstream.chat.android.compose.ui.components.reactionpicker.ReactionsPicker
@@ -94,13 +95,17 @@
         val messageId = intent.getStringExtra(KEY_MESSAGE_ID)
 
         setContent {
-            ChatTheme(dateFormatter = ChatApp.dateFormatter) {
+            ChatTheme(
+                dateFormatter = ChatApp.dateFormatter,
+                attachmentFactories = StreamAttachmentFactories.defaultFactories(skipEnrichUrl = true)
+            ) {
                 MessagesScreen(
                     channelId = channelId,
                     onBackPressed = { finish() },
                     onHeaderActionClick = {},
                     messageId = messageId,
-                    navigateToThreadViaNotification = true
+                    navigateToThreadViaNotification = true,
+                    skipPushNotification = true,
                 )
 
                 // MyCustomUi()

  1. Run the Compose app and type VM: skipEnrichUrl in the logcat
  2. Apply the patch above
  3. Post a mesage with multiple image attachments
  4. Open the gallery and delete one of the attachments

Expected: With the patch aplied, you should see true in the logs under VM: skipEnrichUrl. If you remove the patch, the same action should result in false.

☑️Contributor Checklist

General

  • I have signed the Stream CLA (required)
  • Assigned a person / code owner group (required)
  • Thread with the PR link started in a respective Slack channel (#android-chat-core or #android-chat-ui) (required)
  • PR targets the develop branch
  • PR is linked to the GitHub issue it resolves

Code & documentation

  • Changelog is updated with client-facing changes
  • New code is covered by unit tests
  • Comparison screenshots added for visual changes
  • Affected documentation updated (KDocs, docusaurus, tutorial)

☑️Reviewer Checklist

  • UI Components sample runs & works
  • Compose sample runs & works
  • UI Changes correct (before & after images)
  • Bugs validated (bugfixes)
  • New feature tested and works
  • Release notes and docs clearly describe changes
  • All code we touched has new or updated KDocs

🎉 GIF

gif

@MarinTolic MarinTolic requested a review from a team as a code owner March 31, 2023 15:16
@MarinTolic MarinTolic requested review from a team and TGazica March 31, 2023 15:16
Copy link
Contributor

@kanat kanat left a comment

Choose a reason for hiding this comment

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

LGTM

@MarinTolic MarinTolic added the v5 label Apr 5, 2023
@JcMinarro JcMinarro enabled auto-merge (rebase) April 6, 2023 10:46
@JcMinarro JcMinarro force-pushed the bugfix/4768_propagate_skip_enrich_property_to_the_gallery branch from 6d98d74 to 37db2dd Compare April 6, 2023 10:46
@JcMinarro JcMinarro merged commit 9a79298 into v5 Apr 6, 2023
@JcMinarro JcMinarro deleted the bugfix/4768_propagate_skip_enrich_property_to_the_gallery branch April 6, 2023 10:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants