diff --git a/stream-chat-android-compose/api/stream-chat-android-compose.api b/stream-chat-android-compose/api/stream-chat-android-compose.api index 9735a9e8963..52911c626c6 100644 --- a/stream-chat-android-compose/api/stream-chat-android-compose.api +++ b/stream-chat-android-compose/api/stream-chat-android-compose.api @@ -477,7 +477,6 @@ public final class io/getstream/chat/android/compose/ui/attachments/content/Comp public static final field INSTANCE Lio/getstream/chat/android/compose/ui/attachments/content/ComposableSingletons$GiphyAttachmentContentKt; public fun ()V public final fun getLambda$-573709398$stream_chat_android_compose_release ()Lkotlin/jvm/functions/Function2; - public final fun getLambda$271803750$stream_chat_android_compose_release ()Lkotlin/jvm/functions/Function2; } public final class io/getstream/chat/android/compose/ui/attachments/content/ComposableSingletons$LinkAttachmentContentKt { @@ -525,7 +524,7 @@ public final class io/getstream/chat/android/compose/ui/attachments/content/Giph } public final class io/getstream/chat/android/compose/ui/attachments/content/GiphyAttachmentContentKt { - public static final fun GiphyAttachmentContent (Lio/getstream/chat/android/compose/state/messages/attachments/AttachmentState;Landroidx/compose/ui/Modifier;Lio/getstream/chat/android/ui/common/utils/GiphyInfoType;Lio/getstream/chat/android/ui/common/utils/GiphySizingMode;Landroidx/compose/ui/layout/ContentScale;Lkotlin/jvm/functions/Function1;Landroidx/compose/runtime/Composer;II)V + public static final fun GiphyAttachmentContent (Lio/getstream/chat/android/compose/state/messages/attachments/AttachmentState;Landroidx/compose/ui/Modifier;Lio/getstream/chat/android/ui/common/utils/GiphyInfoType;Lio/getstream/chat/android/ui/common/utils/GiphySizingMode;Landroidx/compose/ui/layout/ContentScale;ZLkotlin/jvm/functions/Function1;Landroidx/compose/runtime/Composer;II)V } public final class io/getstream/chat/android/compose/ui/attachments/content/LinkAttachmentClickData { @@ -1516,6 +1515,13 @@ public final class io/getstream/chat/android/compose/ui/components/messageoption public static final fun defaultMessageOptionsState (Lio/getstream/chat/android/models/Message;Lio/getstream/chat/android/models/User;ZLio/getstream/chat/android/models/Channel;Landroidx/compose/runtime/Composer;I)Ljava/util/List; } +public final class io/getstream/chat/android/compose/ui/components/messages/ComposableSingletons$GiphyMessageContentKt { + public static final field INSTANCE Lio/getstream/chat/android/compose/ui/components/messages/ComposableSingletons$GiphyMessageContentKt; + public fun ()V + public final fun getLambda$-2094128661$stream_chat_android_compose_release ()Lkotlin/jvm/functions/Function2; + public final fun getLambda$-223271185$stream_chat_android_compose_release ()Lkotlin/jvm/functions/Function2; +} + public final class io/getstream/chat/android/compose/ui/components/messages/ComposableSingletons$MessageAnnotationKt { public static final field INSTANCE Lio/getstream/chat/android/compose/ui/components/messages/ComposableSingletons$MessageAnnotationKt; public fun ()V @@ -3932,13 +3938,15 @@ public final class io/getstream/chat/android/compose/ui/theme/FileAttachmentItem public final class io/getstream/chat/android/compose/ui/theme/GiphyAttachmentContentParams { public static final field $stable I - public fun (Lio/getstream/chat/android/compose/state/messages/attachments/AttachmentState;Landroidx/compose/ui/Modifier;)V - public synthetic fun (Lio/getstream/chat/android/compose/state/messages/attachments/AttachmentState;Landroidx/compose/ui/Modifier;ILkotlin/jvm/internal/DefaultConstructorMarker;)V + public fun (Lio/getstream/chat/android/compose/state/messages/attachments/AttachmentState;Landroidx/compose/ui/Modifier;Z)V + public synthetic fun (Lio/getstream/chat/android/compose/state/messages/attachments/AttachmentState;Landroidx/compose/ui/Modifier;ZILkotlin/jvm/internal/DefaultConstructorMarker;)V public final fun component1 ()Lio/getstream/chat/android/compose/state/messages/attachments/AttachmentState; public final fun component2 ()Landroidx/compose/ui/Modifier; - public final fun copy (Lio/getstream/chat/android/compose/state/messages/attachments/AttachmentState;Landroidx/compose/ui/Modifier;)Lio/getstream/chat/android/compose/ui/theme/GiphyAttachmentContentParams; - public static synthetic fun copy$default (Lio/getstream/chat/android/compose/ui/theme/GiphyAttachmentContentParams;Lio/getstream/chat/android/compose/state/messages/attachments/AttachmentState;Landroidx/compose/ui/Modifier;ILjava/lang/Object;)Lio/getstream/chat/android/compose/ui/theme/GiphyAttachmentContentParams; + public final fun component3 ()Z + public final fun copy (Lio/getstream/chat/android/compose/state/messages/attachments/AttachmentState;Landroidx/compose/ui/Modifier;Z)Lio/getstream/chat/android/compose/ui/theme/GiphyAttachmentContentParams; + public static synthetic fun copy$default (Lio/getstream/chat/android/compose/ui/theme/GiphyAttachmentContentParams;Lio/getstream/chat/android/compose/state/messages/attachments/AttachmentState;Landroidx/compose/ui/Modifier;ZILjava/lang/Object;)Lio/getstream/chat/android/compose/ui/theme/GiphyAttachmentContentParams; public fun equals (Ljava/lang/Object;)Z + public final fun getInteractive ()Z public final fun getModifier ()Landroidx/compose/ui/Modifier; public final fun getState ()Lio/getstream/chat/android/compose/state/messages/attachments/AttachmentState; public fun hashCode ()I diff --git a/stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/attachments/content/GiphyAttachmentContent.kt b/stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/attachments/content/GiphyAttachmentContent.kt index 538c1cabb60..80c334180ac 100644 --- a/stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/attachments/content/GiphyAttachmentContent.kt +++ b/stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/attachments/content/GiphyAttachmentContent.kt @@ -83,6 +83,8 @@ import io.getstream.chat.android.ui.common.utils.giphyInfo * the default Giphy width and height dimensions, however you can still clip maximum dimensions. * Setting it to fixed size mode will make it respect all given dimensions. * @param contentScale Used to determine the way Giphys are scaled inside the [Image] composable. + * @param interactive When `true` (default), the container is clickable and long-clickable. When + * `false`, both handlers are disabled. * @param onItemClick Lambda called when an item gets clicked (no-action by default). */ @OptIn(ExperimentalFoundationApi::class) @@ -94,6 +96,7 @@ public fun GiphyAttachmentContent( giphyInfoType: GiphyInfoType = GiphyInfoType.ORIGINAL, giphySizingMode: GiphySizingMode = GiphySizingMode.ADAPTIVE, contentScale: ContentScale = ContentScale.Crop, + interactive: Boolean = true, onItemClick: (GiphyAttachmentClickData) -> Unit = {}, ) { val context = LocalContext.current @@ -115,6 +118,7 @@ public fun GiphyAttachmentContent( val giphyDimensions: DpSize = calculateSize(giphyInfo, giphySizingMode) val shouldBeFullSize = message.shouldBeDisplayedAsFullSizeAttachment() + val interactionSource = remember { MutableInteractionSource() } Box( modifier = modifier .testTag("Stream_GiphyContent") @@ -123,26 +127,34 @@ public fun GiphyAttachmentContent( padding(MessageStyling.messageSectionPadding) .clip(RoundedCornerShape(StreamTokens.radiusLg)) } - .combinedClickable( - indication = ripple(), - interactionSource = remember { MutableInteractionSource() }, - onClick = { - onItemClick( - GiphyAttachmentClickData( - context = context, - url = previewUrl, - attachment = attachment, - message = message, - ), - ) - }, - onLongClick = { state.onLongItemClick(message) }, - ), + // Workaround: `interactive` gates `combinedClickable` so the ephemeral preview path + // can disable the clickable (its inner click and long-click are no-ops there) and let + // the surrounding bubble announce as a single TalkBack focus. The proper fix is to + // make `onItemClick` (and `AttachmentState.onLongItemClick`) nullable and gate on + // `!= null`, but that is a binary-breaking type change on a published API. Revisit in + // v8 and drop `interactive` once the handlers are nullable. + .applyIf(interactive) { + combinedClickable( + indication = ripple(), + interactionSource = interactionSource, + onClick = { + onItemClick( + GiphyAttachmentClickData( + context = context, + url = previewUrl, + attachment = attachment, + message = message, + ), + ) + }, + onLongClick = { state.onLongItemClick(message) }, + ) + }, ) { StreamAsyncImage( data = giphyInfo?.url, modifier = Modifier.fillMaxSize(), - contentDescription = null, + contentDescription = attachment.title?.takeIf(String::isNotBlank), contentScale = contentScale, ) @@ -288,7 +300,10 @@ private fun GiphyAttachmentContentPreview() { } @Composable -internal fun GiphyAttachmentContent() { +internal fun GiphyAttachmentContent( + interactive: Boolean = true, + title: String? = "Funny cat", +) { val previewHandler = AsyncImagePreviewHandler { ColorImage(color = Color.Red.toArgb(), width = 200, height = 150) } @@ -301,10 +316,12 @@ internal fun GiphyAttachmentContent() { Attachment( titleLink = "https://giphy.com/gifs/funny-cat-3oEjI6SIIHBdRxXI40", type = AttachmentType.GIPHY, + title = title, ), ), ), ), + interactive = interactive, ) } } diff --git a/stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/components/messages/GiphyMessageContent.kt b/stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/components/messages/GiphyMessageContent.kt index b58590a399c..e1d26b9a7c0 100644 --- a/stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/components/messages/GiphyMessageContent.kt +++ b/stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/components/messages/GiphyMessageContent.kt @@ -16,7 +16,9 @@ package io.getstream.chat.android.compose.ui.components.messages +import android.view.accessibility.AccessibilityManager import androidx.compose.foundation.background +import androidx.compose.foundation.focusable import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column @@ -27,13 +29,31 @@ import androidx.compose.foundation.layout.padding import androidx.compose.material3.Icon import androidx.compose.material3.Text import androidx.compose.runtime.Composable +import androidx.compose.runtime.CompositionLocalProvider +import androidx.compose.runtime.DisposableEffect +import androidx.compose.runtime.LaunchedEffect +import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.remember +import androidx.compose.runtime.saveable.rememberSaveable +import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier +import androidx.compose.ui.focus.FocusRequester +import androidx.compose.ui.focus.focusRequester +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.graphics.toArgb +import androidx.compose.ui.platform.LocalContext +import androidx.compose.ui.platform.LocalView import androidx.compose.ui.platform.testTag import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource +import androidx.compose.ui.semantics.semantics import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp +import androidx.core.content.getSystemService +import coil3.ColorImage +import coil3.compose.LocalAsyncImagePreviewHandler import io.getstream.chat.android.compose.R import io.getstream.chat.android.compose.state.messages.attachments.AttachmentState import io.getstream.chat.android.compose.ui.components.button.StreamButtonStyleDefaults @@ -42,6 +62,8 @@ import io.getstream.chat.android.compose.ui.theme.ChatTheme import io.getstream.chat.android.compose.ui.theme.GiphyAttachmentContentParams import io.getstream.chat.android.compose.ui.theme.MessageStyling import io.getstream.chat.android.compose.ui.theme.StreamTokens +import io.getstream.chat.android.compose.ui.util.AsyncImagePreviewHandler +import io.getstream.chat.android.compose.ui.util.applyIf import io.getstream.chat.android.models.Attachment import io.getstream.chat.android.models.AttachmentType import io.getstream.chat.android.models.Message @@ -50,6 +72,7 @@ import io.getstream.chat.android.ui.common.state.messages.list.CancelGiphy import io.getstream.chat.android.ui.common.state.messages.list.GiphyAction import io.getstream.chat.android.ui.common.state.messages.list.SendGiphy import io.getstream.chat.android.ui.common.state.messages.list.ShuffleGiphy +import kotlinx.coroutines.delay /** * Represents the content of an ephemeral giphy message. @@ -68,44 +91,72 @@ public fun GiphyMessageContent( onGiphyActionClick: (GiphyAction) -> Unit = {}, ) { val colors = ChatTheme.colors + val view = LocalView.current + val sentAnnouncement = stringResource(R.string.stream_compose_message_list_giphy_sent) + val cancelledAnnouncement = stringResource(R.string.stream_compose_message_list_giphy_cancelled) + val shuffledAnnouncement = stringResource(R.string.stream_compose_message_list_giphy_shuffled) + + val isTouchExplorationEnabled = rememberIsTouchExplorationEnabled() + val previewFocusRequester = remember { FocusRequester() } + // Track whether the preview has already requested focus so that a LazyColumn dispose + + // re-entry (the preview scrolling out of the viewport and back) does not re-steal + // TalkBack focus from wherever the user has moved it in the meantime. + var hasRequestedFocus by rememberSaveable(message.id) { mutableStateOf(false) } + LaunchedEffect(message.id, isTouchExplorationEnabled) { + if (!isTouchExplorationEnabled || hasRequestedFocus) return@LaunchedEffect + // Let Compose layout + the accessibility tree settle before stealing TalkBack focus, + // otherwise our request loses to the composer's post-command focus reshuffling. + delay(PreviewFocusRequestDelayMs) + previewFocusRequester.requestFocus() + hasRequestedFocus = true + } Column( modifier = modifier, horizontalAlignment = Alignment.CenterHorizontally, ) { - Row( + Column( modifier = Modifier - .fillMaxWidth() - .height(40.dp) - .padding(horizontal = StreamTokens.spacingSm, vertical = StreamTokens.spacingXs), - verticalAlignment = Alignment.CenterVertically, - horizontalArrangement = Arrangement.spacedBy(StreamTokens.spacingXs), + .applyIf(isTouchExplorationEnabled) { + focusRequester(previewFocusRequester).focusable() + } + .semantics(mergeDescendants = true) {}, ) { - Icon( - painter = painterResource(R.drawable.stream_design_ic_eye_fill), - contentDescription = null, - tint = colors.chatTextOutgoing, + Row( + modifier = Modifier + .fillMaxWidth() + .height(40.dp) + .padding(horizontal = StreamTokens.spacingSm, vertical = StreamTokens.spacingXs), + verticalAlignment = Alignment.CenterVertically, + horizontalArrangement = Arrangement.spacedBy(StreamTokens.spacingXs), + ) { + Icon( + painter = painterResource(R.drawable.stream_design_ic_eye_fill), + contentDescription = null, + tint = colors.chatTextOutgoing, + ) + Text( + text = stringResource(R.string.stream_compose_only_visible_to_you), + style = ChatTheme.typography.captionEmphasis, + color = colors.chatTextOutgoing, + ) + } + + val attachmentState = AttachmentState( + message = message, + isMine = message.user.id == currentUser?.id, + onLongItemClick = {}, + onMediaGalleryPreviewResult = {}, ) - Text( - text = stringResource(R.string.stream_compose_only_visible_to_you), - style = ChatTheme.typography.captionEmphasis, - color = colors.chatTextOutgoing, + ChatTheme.componentFactory.GiphyAttachmentContent( + params = GiphyAttachmentContentParams( + modifier = Modifier.fillMaxWidth(), + state = attachmentState, + interactive = false, + ), ) } - val attachmentState = AttachmentState( - message = message, - isMine = message.user.id == currentUser?.id, - onLongItemClick = {}, - onMediaGalleryPreviewResult = {}, - ) - ChatTheme.componentFactory.GiphyAttachmentContent( - params = GiphyAttachmentContentParams( - modifier = Modifier.fillMaxWidth(), - state = attachmentState, - ), - ) - Row( modifier = Modifier .padding(vertical = StreamTokens.spacingXs) @@ -113,7 +164,10 @@ public fun GiphyMessageContent( horizontalArrangement = Arrangement.spacedBy(StreamTokens.spacingXs), ) { StreamTextButton( - onClick = { onGiphyActionClick(SendGiphy(message)) }, + onClick = { + view.announceForAccessibility(sentAnnouncement) + onGiphyActionClick(SendGiphy(message)) + }, text = stringResource(R.string.stream_compose_message_list_giphy_send), style = StreamButtonStyleDefaults.primaryGhost, modifier = Modifier @@ -122,7 +176,10 @@ public fun GiphyMessageContent( ) StreamTextButton( - onClick = { onGiphyActionClick(ShuffleGiphy(message)) }, + onClick = { + view.announceForAccessibility(shuffledAnnouncement) + onGiphyActionClick(ShuffleGiphy(message)) + }, text = stringResource(R.string.stream_compose_message_list_giphy_shuffle), style = StreamButtonStyleDefaults.secondaryGhost, modifier = Modifier @@ -131,7 +188,10 @@ public fun GiphyMessageContent( ) StreamTextButton( - onClick = { onGiphyActionClick(CancelGiphy(message)) }, + onClick = { + view.announceForAccessibility(cancelledAnnouncement) + onGiphyActionClick(CancelGiphy(message)) + }, text = stringResource(R.string.stream_compose_message_list_giphy_cancel), style = StreamButtonStyleDefaults.secondaryGhost, modifier = Modifier @@ -142,11 +202,39 @@ public fun GiphyMessageContent( } } -@Preview +private const val PreviewFocusRequestDelayMs = 100L + +/** + * Observes [AccessibilityManager.isTouchExplorationEnabled] and recomposes when it toggles. Used + * to gate focus-stealing behaviour so we only request TalkBack focus when an explore-by-touch + * service (e.g. TalkBack) is active — otherwise we would yank Compose focus away from the + * composer's text field for sighted users and dismiss the IME. + */ @Composable -private fun GiphyMessageContentPreview() { - val attachment = Attachment(type = AttachmentType.GIPHY, ogUrl = "") - ChatTheme { +private fun rememberIsTouchExplorationEnabled(): Boolean { + val context = LocalContext.current + val manager = remember(context) { context.getSystemService() } ?: return false + var enabled by remember(manager) { mutableStateOf(manager.isTouchExplorationEnabled) } + DisposableEffect(manager) { + val listener = AccessibilityManager.TouchExplorationStateChangeListener { enabled = it } + manager.addTouchExplorationStateChangeListener(listener) + enabled = manager.isTouchExplorationEnabled + onDispose { manager.removeTouchExplorationStateChangeListener(listener) } + } + return enabled +} + +@Composable +internal fun GiphyMessageContent() { + val previewHandler = AsyncImagePreviewHandler { + ColorImage(color = Color.Red.toArgb(), width = 200, height = 150) + } + CompositionLocalProvider(LocalAsyncImagePreviewHandler provides previewHandler) { + val attachment = Attachment( + type = AttachmentType.GIPHY, + titleLink = "https://giphy.com/gifs/funny-cat-3oEjI6SIIHBdRxXI40", + title = "Hello", + ) Box(Modifier.background(MessageStyling.backgroundColor(true))) { GiphyMessageContent( message = Message(attachments = listOf(attachment)), @@ -156,3 +244,11 @@ private fun GiphyMessageContentPreview() { } } } + +@Preview +@Composable +private fun GiphyMessageContentPreview() { + ChatTheme { + GiphyMessageContent() + } +} diff --git a/stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/theme/ChatComponentFactory.kt b/stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/theme/ChatComponentFactory.kt index 837d14ce6ba..05940bfb6dc 100644 --- a/stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/theme/ChatComponentFactory.kt +++ b/stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/theme/ChatComponentFactory.kt @@ -2480,6 +2480,7 @@ public interface ChatComponentFactory { io.getstream.chat.android.compose.ui.attachments.content.GiphyAttachmentContent( state = params.state, modifier = params.modifier, + interactive = params.interactive, ) } diff --git a/stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/theme/ChatComponentFactoryParams.kt b/stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/theme/ChatComponentFactoryParams.kt index 0da471b28a3..5cf379f1d74 100644 --- a/stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/theme/ChatComponentFactoryParams.kt +++ b/stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/theme/ChatComponentFactoryParams.kt @@ -2247,10 +2247,13 @@ public data class FileAttachmentContentParams( * * @param state State providing context for the attachment. * @param modifier Modifier for styling. + * @param interactive When `true` (default), the Giphy container is clickable and long-clickable. + * When `false`, both handlers are disabled. */ public data class GiphyAttachmentContentParams( val state: AttachmentState, val modifier: Modifier = Modifier, + val interactive: Boolean = true, ) /** diff --git a/stream-chat-android-compose/src/main/res/values-es/strings.xml b/stream-chat-android-compose/src/main/res/values-es/strings.xml index d7e4530a4f6..1c15c4224d5 100644 --- a/stream-chat-android-compose/src/main/res/values-es/strings.xml +++ b/stream-chat-android-compose/src/main/res/values-es/strings.xml @@ -146,8 +146,11 @@ "No hay ninguna aplicación para ver esta URL:\n%s" "Editado" "Cancelar" + "Vista previa de Giphy cancelada" "Enviar" + "Giphy enviado" "Aleatorio" + "Giphy intercambiado" "Recordarme" "Guardado para después" "Mostrar traducción" diff --git a/stream-chat-android-compose/src/main/res/values-fr/strings.xml b/stream-chat-android-compose/src/main/res/values-fr/strings.xml index 9a10ebe8c97..8830edbb168 100644 --- a/stream-chat-android-compose/src/main/res/values-fr/strings.xml +++ b/stream-chat-android-compose/src/main/res/values-fr/strings.xml @@ -146,8 +146,11 @@ "Aucune application pour ouvrir cette URL :\n%s" "Modifié" "Annuler" + "Aperçu Giphy annulé" "Envoyer" + "Giphy envoyé" "Mélanger" + "Giphy mélangé" "Me rappeler" "Enregistré pour plus tard" "Afficher la traduction" diff --git a/stream-chat-android-compose/src/main/res/values-hi/strings.xml b/stream-chat-android-compose/src/main/res/values-hi/strings.xml index 94f1dbbdf26..0e1e86ff72c 100644 --- a/stream-chat-android-compose/src/main/res/values-hi/strings.xml +++ b/stream-chat-android-compose/src/main/res/values-hi/strings.xml @@ -206,8 +206,11 @@ "इस url को देखने के लिए कोई ऐप नहीं है:\n%s" "संपादित" "रद्द करें" + "Giphy पूर्वावलोकन रद्द किया गया" "भेजें" + "Giphy भेजा गया" "बदलें" + "Giphy बदला गया" "मुझे याद दिलाएँ" "बाद के लिए सेव किया गया" "अनुवाद दिखाएँ" diff --git a/stream-chat-android-compose/src/main/res/values-in/strings.xml b/stream-chat-android-compose/src/main/res/values-in/strings.xml index be571420618..f3b5e0d0d92 100644 --- a/stream-chat-android-compose/src/main/res/values-in/strings.xml +++ b/stream-chat-android-compose/src/main/res/values-in/strings.xml @@ -146,8 +146,11 @@ "Tidak ada aplikasi untuk membuka URL ini:\n%s" "Diedit" "Batal" + "Pratinjau Giphy dibatalkan" "Kirim" + "Giphy terkirim" "Acak" + "Giphy diacak" "Ingatkan saya" "Disimpan untuk nanti" "Tampilkan terjemahan" diff --git a/stream-chat-android-compose/src/main/res/values-it/strings.xml b/stream-chat-android-compose/src/main/res/values-it/strings.xml index c6f90f00a10..9b136f7dfad 100644 --- a/stream-chat-android-compose/src/main/res/values-it/strings.xml +++ b/stream-chat-android-compose/src/main/res/values-it/strings.xml @@ -206,8 +206,11 @@ "Nessuna app per aprire questo url:\n%s" "Modificato" "Annulla" + "Anteprima Giphy annullata" "Invia" + "Giphy inviato" "Casuale" + "Giphy cambiato" "Ricordami" "Salvato per dopo" "Mostra traduzione" diff --git a/stream-chat-android-compose/src/main/res/values-ja/strings.xml b/stream-chat-android-compose/src/main/res/values-ja/strings.xml index c7628d76f80..c6c153db90d 100644 --- a/stream-chat-android-compose/src/main/res/values-ja/strings.xml +++ b/stream-chat-android-compose/src/main/res/values-ja/strings.xml @@ -158,8 +158,11 @@ "このURLを開くアプリがありません:\n%s" "編集済み" "キャンセル" + "Giphyプレビューをキャンセルしました" "送信" + "Giphyを送信しました" "シャッフル" + "Giphyをシャッフルしました" "リマインドする" "後で確認" "翻訳を表示" diff --git a/stream-chat-android-compose/src/main/res/values-ko/strings.xml b/stream-chat-android-compose/src/main/res/values-ko/strings.xml index ca3b52ca9d9..ca6b3327440 100644 --- a/stream-chat-android-compose/src/main/res/values-ko/strings.xml +++ b/stream-chat-android-compose/src/main/res/values-ko/strings.xml @@ -158,8 +158,11 @@ "이 URL을 열 수 있는 앱이 없습니다:\n%s" "수정됨" "취소" + "Giphy 미리보기 취소됨" "보내기" + "Giphy 전송됨" "섞기" + "Giphy 섞임" "리마인드" "나중에 보기" "번역 보기" diff --git a/stream-chat-android-compose/src/main/res/values/strings.xml b/stream-chat-android-compose/src/main/res/values/strings.xml index 25422da5cc2..c844db52210 100644 --- a/stream-chat-android-compose/src/main/res/values/strings.xml +++ b/stream-chat-android-compose/src/main/res/values/strings.xml @@ -88,6 +88,9 @@ Send Cancel Shuffle + Giphy sent + Giphy preview cancelled + Giphy shuffled Edited %d reply %d replies diff --git a/stream-chat-android-compose/src/test/kotlin/io/getstream/chat/android/compose/ui/attachments/content/AttachmentsContentTest.kt b/stream-chat-android-compose/src/test/kotlin/io/getstream/chat/android/compose/ui/attachments/content/AttachmentsContentTest.kt index 70c122903e5..fc229d003ba 100644 --- a/stream-chat-android-compose/src/test/kotlin/io/getstream/chat/android/compose/ui/attachments/content/AttachmentsContentTest.kt +++ b/stream-chat-android-compose/src/test/kotlin/io/getstream/chat/android/compose/ui/attachments/content/AttachmentsContentTest.kt @@ -21,6 +21,7 @@ import app.cash.paparazzi.DeviceConfig import app.cash.paparazzi.Paparazzi import com.android.ide.common.rendering.api.SessionParams import io.getstream.chat.android.compose.ui.PaparazziComposeTest +import io.getstream.chat.android.compose.ui.components.messages.GiphyMessageContent import org.junit.Rule import org.junit.Test @@ -70,6 +71,27 @@ internal class AttachmentsContentTest : PaparazziComposeTest { } } + @Test + fun `giphy attachment content non-interactive`() { + snapshotWithDarkModeRow { + GiphyAttachmentContent(interactive = false) + } + } + + @Test + fun `giphy attachment content blank title`() { + snapshotWithDarkModeRow { + GiphyAttachmentContent(title = "") + } + } + + @Test + fun `giphy message content`() { + snapshotWithDarkModeRow { + GiphyMessageContent() + } + } + @Test fun `single media attachment content`() { snapshotWithDarkModeRow { diff --git a/stream-chat-android-compose/src/test/snapshots/images/io.getstream.chat.android.compose.ui.attachments.content_AttachmentsContentTest_giphy_attachment_content_blank_title.png b/stream-chat-android-compose/src/test/snapshots/images/io.getstream.chat.android.compose.ui.attachments.content_AttachmentsContentTest_giphy_attachment_content_blank_title.png new file mode 100644 index 00000000000..15f0cfb3028 Binary files /dev/null and b/stream-chat-android-compose/src/test/snapshots/images/io.getstream.chat.android.compose.ui.attachments.content_AttachmentsContentTest_giphy_attachment_content_blank_title.png differ diff --git a/stream-chat-android-compose/src/test/snapshots/images/io.getstream.chat.android.compose.ui.attachments.content_AttachmentsContentTest_giphy_attachment_content_non-interactive.png b/stream-chat-android-compose/src/test/snapshots/images/io.getstream.chat.android.compose.ui.attachments.content_AttachmentsContentTest_giphy_attachment_content_non-interactive.png new file mode 100644 index 00000000000..15f0cfb3028 Binary files /dev/null and b/stream-chat-android-compose/src/test/snapshots/images/io.getstream.chat.android.compose.ui.attachments.content_AttachmentsContentTest_giphy_attachment_content_non-interactive.png differ diff --git a/stream-chat-android-compose/src/test/snapshots/images/io.getstream.chat.android.compose.ui.attachments.content_AttachmentsContentTest_giphy_message_content.png b/stream-chat-android-compose/src/test/snapshots/images/io.getstream.chat.android.compose.ui.attachments.content_AttachmentsContentTest_giphy_message_content.png new file mode 100644 index 00000000000..32d75ffb6c3 Binary files /dev/null and b/stream-chat-android-compose/src/test/snapshots/images/io.getstream.chat.android.compose.ui.attachments.content_AttachmentsContentTest_giphy_message_content.png differ