Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2060,16 +2060,17 @@ public final class io/getstream/chat/android/compose/ui/messages/composer/intern
public final class io/getstream/chat/android/compose/ui/messages/composer/internal/attachments/ComposableSingletons$MessageComposerAttachmentFileItemKt {
public static final field INSTANCE Lio/getstream/chat/android/compose/ui/messages/composer/internal/attachments/ComposableSingletons$MessageComposerAttachmentFileItemKt;
public fun <init> ()V
public final fun getLambda$-1126442206$stream_chat_android_compose_release ()Lkotlin/jvm/functions/Function2;
public final fun getLambda$1955682816$stream_chat_android_compose_release ()Lkotlin/jvm/functions/Function2;
}

public final class io/getstream/chat/android/compose/ui/messages/composer/internal/attachments/ComposableSingletons$MessageComposerAttachmentMediaItemKt {
public static final field INSTANCE Lio/getstream/chat/android/compose/ui/messages/composer/internal/attachments/ComposableSingletons$MessageComposerAttachmentMediaItemKt;
public fun <init> ()V
public final fun getLambda$-932284221$stream_chat_android_compose_release ()Lkotlin/jvm/functions/Function2;
public final fun getLambda$116152749$stream_chat_android_compose_release ()Lkotlin/jvm/functions/Function2;
public final fun getLambda$1523175629$stream_chat_android_compose_release ()Lkotlin/jvm/functions/Function2;
public final fun getLambda$369677867$stream_chat_android_compose_release ()Lkotlin/jvm/functions/Function2;
public final fun getLambda$384447459$stream_chat_android_compose_release ()Lkotlin/jvm/functions/Function2;
public final fun getLambda$485971275$stream_chat_android_compose_release ()Lkotlin/jvm/functions/Function2;
}

public final class io/getstream/chat/android/compose/ui/messages/composer/internal/attachments/ComposableSingletons$MessageComposerAttachmentsKt {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ internal fun MessageComposerAttachmentAudioRecordItem(
.align(Alignment.TopEnd)
.testTag("Stream_MessageComposerAttachmentCancelIcon"),
onClick = { onAttachmentRemoved(attachment) },
contentDescription = stringResource(R.string.stream_compose_remove_attachment),
contentDescription = stringResource(R.string.stream_compose_remove_attachment_voice_message),
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,21 @@ internal fun MessageComposerAttachmentFileItem(
.align(Alignment.TopEnd)
.testTag("Stream_MessageComposerAttachmentCancelIcon"),
onClick = { onAttachmentRemoved(attachment) },
contentDescription = stringResource(R.string.stream_compose_remove_attachment),
contentDescription = fileAttachmentRemoveDescription(attachment),
)
}
}

@Composable
private fun fileAttachmentRemoveDescription(attachment: Attachment): String {
val displayName = attachment.title ?: attachment.name
return if (displayName.isNullOrBlank()) {
stringResource(R.string.stream_compose_remove_attachment_file)
} else {
stringResource(R.string.stream_compose_remove_attachment_file_named, displayName)
}
}

private val FileItemShape = RoundedCornerShape(StreamTokens.radiusLg)

@Preview
Expand All @@ -129,3 +139,18 @@ internal fun MessageComposerAttachmentFileItem() {
attachment = PreviewAttachmentData.attachmentFile1,
)
}

@Preview
@Composable
private fun MessageComposerAttachmentFileItemUnnamedPreview() {
ChatTheme {
MessageComposerAttachmentFileItemUnnamed()
}
}

@Composable
internal fun MessageComposerAttachmentFileItemUnnamed() {
MessageComposerAttachmentFileItem(
attachment = PreviewAttachmentData.attachmentFile1.copy(name = null),
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,30 @@ internal fun MessageComposerAttachmentMediaItem(
.align(Alignment.TopEnd)
.testTag("Stream_MessageComposerAttachmentCancelIcon"),
onClick = { onAttachmentRemoved(attachment) },
contentDescription = stringResource(R.string.stream_compose_remove_attachment),
contentDescription = mediaAttachmentRemoveDescription(attachment),
)
}
}

@Composable
private fun mediaAttachmentRemoveDescription(attachment: Attachment): String {
val displayName = attachment.title ?: attachment.name
Comment thread
VelikovPetar marked this conversation as resolved.
val isVideo = attachment.type == AttachmentType.VIDEO
return when {
isVideo && !displayName.isNullOrBlank() ->
stringResource(R.string.stream_compose_remove_attachment_video_named, displayName)

isVideo ->
stringResource(R.string.stream_compose_remove_attachment_video)

!displayName.isNullOrBlank() ->
stringResource(R.string.stream_compose_remove_attachment_photo_named, displayName)

else ->
stringResource(R.string.stream_compose_remove_attachment_photo)
}
}

private val MediaItemImageShape = RoundedCornerShape(StreamTokens.radiusLg)

@Preview
Expand All @@ -105,16 +124,24 @@ private fun MessageComposerAttachmentImageItemPreview() {

@Composable
internal fun MessageComposerAttachmentImageItem() {
val previewHandler = AsyncImagePreviewHandler {
ColorImage(color = Color.Green.toArgb(), width = 200, height = 150)
}
CompositionLocalProvider(LocalAsyncImagePreviewHandler provides previewHandler) {
MessageComposerAttachmentMediaItem(
attachment = PreviewAttachmentData.attachmentImage1,
)
MessageComposerAttachmentItem(attachment = PreviewAttachmentData.attachmentImage1)
}

@Preview
@Composable
private fun MessageComposerAttachmentImageItemUnnamedPreview() {
ChatTheme {
MessageComposerAttachmentImageItemUnnamed()
}
}

@Composable
internal fun MessageComposerAttachmentImageItemUnnamed() {
MessageComposerAttachmentItem(
attachment = PreviewAttachmentData.attachmentImage1.copy(name = null),
)
}

@Preview
@Composable
private fun MessageComposerAttachmentVideoItemPreview() {
Expand All @@ -125,12 +152,32 @@ private fun MessageComposerAttachmentVideoItemPreview() {

@Composable
internal fun MessageComposerAttachmentVideoItem() {
MessageComposerAttachmentItem(attachment = PreviewAttachmentData.attachmentVideo1)
}

@Preview
@Composable
private fun MessageComposerAttachmentVideoItemUnnamedPreview() {
ChatTheme {
MessageComposerAttachmentVideoItemUnnamed()
}
}

@Composable
internal fun MessageComposerAttachmentVideoItemUnnamed() {
MessageComposerAttachmentItem(
attachment = PreviewAttachmentData.attachmentVideo1.copy(name = null),
)
}

@Composable
private fun MessageComposerAttachmentItem(attachment: Attachment) {
val previewHandler = AsyncImagePreviewHandler {
ColorImage(color = Color.Green.toArgb(), width = 200, height = 150)
}
CompositionLocalProvider(LocalAsyncImagePreviewHandler provides previewHandler) {
MessageComposerAttachmentMediaItem(
attachment = PreviewAttachmentData.attachmentVideo1,
attachment = attachment,
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,13 @@
<string name="stream_compose_reactions_you">"Tú"</string>
<string name="stream_compose_recent_files">"Archivos recientes"</string>
<string name="stream_compose_remaining_media_attachments_count">"+%1$d"</string>
<string name="stream_compose_remove_attachment">"Eliminar archivo adjunto"</string>
<string name="stream_compose_remove_attachment_photo">"Eliminar foto"</string>
<string name="stream_compose_remove_attachment_photo_named">"Eliminar foto %1$s"</string>
<string name="stream_compose_remove_attachment_video">"Eliminar vídeo"</string>
<string name="stream_compose_remove_attachment_video_named">"Eliminar vídeo %1$s"</string>
<string name="stream_compose_remove_attachment_file">"Eliminar archivo"</string>
<string name="stream_compose_remove_attachment_file_named">"Eliminar archivo %1$s"</string>
<string name="stream_compose_remove_attachment_voice_message">"Eliminar mensaje de voz"</string>
<string name="stream_compose_replied_to_thread">"Respondió en un hilo"</string>
<string name="stream_compose_reply">"Responder"</string>
<string name="stream_compose_resend_message">"Reenviar"</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,13 @@
<string name="stream_compose_reactions_you">"Vous"</string>
<string name="stream_compose_recent_files">"Fichiers récents"</string>
<string name="stream_compose_remaining_media_attachments_count">"+%1$d"</string>
<string name="stream_compose_remove_attachment">"Supprimer la pièce jointe"</string>
<string name="stream_compose_remove_attachment_photo">"Supprimer la photo"</string>
<string name="stream_compose_remove_attachment_photo_named">"Supprimer la photo %1$s"</string>
<string name="stream_compose_remove_attachment_video">"Supprimer la vidéo"</string>
<string name="stream_compose_remove_attachment_video_named">"Supprimer la vidéo %1$s"</string>
<string name="stream_compose_remove_attachment_file">"Supprimer le fichier"</string>
<string name="stream_compose_remove_attachment_file_named">"Supprimer le fichier %1$s"</string>
<string name="stream_compose_remove_attachment_voice_message">"Supprimer le message vocal"</string>
<string name="stream_compose_replied_to_thread">"A répondu dans un fil"</string>
<string name="stream_compose_reply">"Répondre"</string>
<string name="stream_compose_resend_message">"Renvoyer"</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,13 @@
<string name="stream_compose_reactions_you">"आप"</string>
<string name="stream_compose_recent_files">"हाल ही की फाइलें"</string>
<string name="stream_compose_remaining_media_attachments_count">"+%1$d"</string>
<string name="stream_compose_remove_attachment">"अटैचमेंट हटाएँ"</string>
<string name="stream_compose_remove_attachment_photo">"फ़ोटो हटाएँ"</string>
<string name="stream_compose_remove_attachment_photo_named">"फ़ोटो %1$s हटाएँ"</string>
<string name="stream_compose_remove_attachment_video">"वीडियो हटाएँ"</string>
<string name="stream_compose_remove_attachment_video_named">"वीडियो %1$s हटाएँ"</string>
<string name="stream_compose_remove_attachment_file">"फ़ाइल हटाएँ"</string>
<string name="stream_compose_remove_attachment_file_named">"फ़ाइल %1$s हटाएँ"</string>
<string name="stream_compose_remove_attachment_voice_message">"वॉइस मैसेज हटाएँ"</string>
<string name="stream_compose_replied_to_thread">"एक थ्रेड को जवाब दिया"</string>
<string name="stream_compose_reply">"जवाब दें"</string>
<string name="stream_compose_resend_message">"पुनः भेजें"</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,13 @@
<string name="stream_compose_reactions_you">"Anda"</string>
<string name="stream_compose_recent_files">"File Terbaru"</string>
<string name="stream_compose_remaining_media_attachments_count">"+%1$d"</string>
<string name="stream_compose_remove_attachment">"Hapus lampiran"</string>
<string name="stream_compose_remove_attachment_photo">"Hapus foto"</string>
<string name="stream_compose_remove_attachment_photo_named">"Hapus foto %1$s"</string>
<string name="stream_compose_remove_attachment_video">"Hapus video"</string>
<string name="stream_compose_remove_attachment_video_named">"Hapus video %1$s"</string>
<string name="stream_compose_remove_attachment_file">"Hapus file"</string>
<string name="stream_compose_remove_attachment_file_named">"Hapus file %1$s"</string>
<string name="stream_compose_remove_attachment_voice_message">"Hapus pesan suara"</string>
<string name="stream_compose_replied_to_thread">"Membalas di utas"</string>
<string name="stream_compose_reply">"Balas"</string>
<string name="stream_compose_resend_message">"Kirim ulang"</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,13 @@
<string name="stream_compose_reactions_you">"Tu"</string>
<string name="stream_compose_recent_files">"File recenti"</string>
<string name="stream_compose_remaining_media_attachments_count">"+%1$d"</string>
<string name="stream_compose_remove_attachment">"Rimuovi allegato"</string>
<string name="stream_compose_remove_attachment_photo">"Rimuovi foto"</string>
<string name="stream_compose_remove_attachment_photo_named">"Rimuovi foto %1$s"</string>
<string name="stream_compose_remove_attachment_video">"Rimuovi video"</string>
<string name="stream_compose_remove_attachment_video_named">"Rimuovi video %1$s"</string>
<string name="stream_compose_remove_attachment_file">"Rimuovi file"</string>
<string name="stream_compose_remove_attachment_file_named">"Rimuovi file %1$s"</string>
<string name="stream_compose_remove_attachment_voice_message">"Rimuovi messaggio vocale"</string>
<string name="stream_compose_replied_to_thread">"Ha risposto in un thread"</string>
<string name="stream_compose_reply">"Rispondi"</string>
<string name="stream_compose_resend_message">"Reinvia"</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,13 @@
<string name="stream_compose_reactions_you">"あなた"</string>
<string name="stream_compose_recent_files">"最近のファイル"</string>
<string name="stream_compose_remaining_media_attachments_count">"+%1$d"</string>
<string name="stream_compose_remove_attachment">"添付ファイルを削除"</string>
<string name="stream_compose_remove_attachment_photo">"写真を削除"</string>
<string name="stream_compose_remove_attachment_photo_named">"写真 %1$s を削除"</string>
<string name="stream_compose_remove_attachment_video">"動画を削除"</string>
<string name="stream_compose_remove_attachment_video_named">"動画 %1$s を削除"</string>
<string name="stream_compose_remove_attachment_file">"ファイルを削除"</string>
<string name="stream_compose_remove_attachment_file_named">"ファイル %1$s を削除"</string>
<string name="stream_compose_remove_attachment_voice_message">"音声メッセージを削除"</string>
Comment thread
andremion marked this conversation as resolved.
<string name="stream_compose_replied_to_thread">"スレッドに返信しました"</string>
<string name="stream_compose_reply">"返信"</string>
<string name="stream_compose_resend_message">"再送信"</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,13 @@
<string name="stream_compose_reactions_you">"나"</string>
<string name="stream_compose_recent_files">"최근 파일"</string>
<string name="stream_compose_remaining_media_attachments_count">"+%1$d"</string>
<string name="stream_compose_remove_attachment">"첨부파일 삭제"</string>
<string name="stream_compose_remove_attachment_photo">"사진 삭제"</string>
<string name="stream_compose_remove_attachment_photo_named">"사진 %1$s 삭제"</string>
<string name="stream_compose_remove_attachment_video">"동영상 삭제"</string>
<string name="stream_compose_remove_attachment_video_named">"동영상 %1$s 삭제"</string>
<string name="stream_compose_remove_attachment_file">"파일 삭제"</string>
<string name="stream_compose_remove_attachment_file_named">"파일 %1$s 삭제"</string>
<string name="stream_compose_remove_attachment_voice_message">"음성 메시지 삭제"</string>
<string name="stream_compose_replied_to_thread">"스레드에 답장했습니다"</string>
<string name="stream_compose_reply">"답장"</string>
<string name="stream_compose_resend_message">"재전송"</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,13 @@
<item quantity="other">%d unread</item>
</plurals>
<string name="stream_compose_remaining_media_attachments_count">+%1$d</string>
<string name="stream_compose_remove_attachment">Remove attachment</string>
<string name="stream_compose_remove_attachment_photo">Remove photo</string>
<string name="stream_compose_remove_attachment_photo_named">Remove photo %1$s</string>
<string name="stream_compose_remove_attachment_video">Remove video</string>
<string name="stream_compose_remove_attachment_video_named">Remove video %1$s</string>
<string name="stream_compose_remove_attachment_file">Remove file</string>
<string name="stream_compose_remove_attachment_file_named">Remove file %1$s</string>
<string name="stream_compose_remove_attachment_voice_message">Remove voice message</string>
<string name="stream_compose_giphy_label">GIPHY</string>
<string name="stream_compose_pinned_to_channel">Pinned</string>
<string name="stream_compose_pinned_to_channel_by">Pinned by %1$s</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,25 @@ internal class MessageComposerAttachmentsTest : PaparazziComposeTest {
MessageComposerAttachmentFileItem()
}
}

@Test
fun `image attachment item without title or name`() {
snapshotWithDarkModeRow {
MessageComposerAttachmentImageItemUnnamed()
}
}

@Test
fun `video attachment item without title or name`() {
snapshotWithDarkModeRow {
MessageComposerAttachmentVideoItemUnnamed()
}
}

@Test
fun `file attachment item without title or name`() {
snapshotWithDarkModeRow {
MessageComposerAttachmentFileItemUnnamed()
}
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading