diff --git a/stream-chat-android-compose-sample/src/main/AndroidManifest.xml b/stream-chat-android-compose-sample/src/main/AndroidManifest.xml index 7b986641e90..11f4624330d 100644 --- a/stream-chat-android-compose-sample/src/main/AndroidManifest.xml +++ b/stream-chat-android-compose-sample/src/main/AndroidManifest.xml @@ -114,7 +114,13 @@ /> - - + + diff --git a/stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/channel/attachments/ChannelFilesAttachmentsScreen.kt b/stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/channel/attachments/ChannelFilesAttachmentsScreen.kt index 7a5022f106e..6f9d10cf0e7 100644 --- a/stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/channel/attachments/ChannelFilesAttachmentsScreen.kt +++ b/stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/channel/attachments/ChannelFilesAttachmentsScreen.kt @@ -26,6 +26,9 @@ import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier +import androidx.compose.ui.res.stringResource +import androidx.compose.ui.semantics.paneTitle +import androidx.compose.ui.semantics.semantics import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import androidx.lifecycle.compose.collectAsStateWithLifecycle @@ -44,6 +47,7 @@ import io.getstream.chat.android.previewdata.PreviewMessageData import io.getstream.chat.android.previewdata.PreviewUserData import io.getstream.chat.android.ui.common.feature.channel.attachments.ChannelAttachmentsViewAction import io.getstream.chat.android.ui.common.state.channel.attachments.ChannelAttachmentsViewState +import io.getstream.chat.android.ui.common.R as UiCommonR /** * Displays the channel files attachments screen. @@ -97,8 +101,9 @@ private fun ChannelFilesAttachmentsContent( onLoadMoreRequested: () -> Unit = {}, ) { val listState = rememberLazyListState() + val paneTitleText = stringResource(UiCommonR.string.stream_ui_channel_attachments_files_title) Scaffold( - modifier = modifier, + modifier = modifier.semantics { paneTitle = paneTitleText }, topBar = { ChatTheme.componentFactory.ChannelFilesAttachmentsTopBar( params = ChannelFilesAttachmentsTopBarParams( diff --git a/stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/channel/attachments/ChannelMediaAttachmentsScreen.kt b/stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/channel/attachments/ChannelMediaAttachmentsScreen.kt index b820ab14364..3e4172c6f0e 100644 --- a/stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/channel/attachments/ChannelMediaAttachmentsScreen.kt +++ b/stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/channel/attachments/ChannelMediaAttachmentsScreen.kt @@ -30,6 +30,10 @@ import androidx.compose.runtime.getValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.layout.ContentScale +import androidx.compose.ui.res.stringResource +import androidx.compose.ui.semantics.contentDescription +import androidx.compose.ui.semantics.paneTitle +import androidx.compose.ui.semantics.semantics import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import androidx.lifecycle.compose.collectAsStateWithLifecycle @@ -51,6 +55,7 @@ import io.getstream.chat.android.previewdata.PreviewMessageData import io.getstream.chat.android.ui.common.feature.channel.attachments.ChannelAttachmentsViewAction import io.getstream.chat.android.ui.common.state.channel.attachments.ChannelAttachmentsViewState import io.getstream.result.Error +import io.getstream.chat.android.ui.common.R as UiCommonR /** * Displays the channel media attachments screen. @@ -109,8 +114,9 @@ private fun ChannelMediaAttachmentsContent( onSharingError: (error: Error) -> Unit = {}, ) { val gridState = rememberLazyGridState() + val paneTitleText = stringResource(UiCommonR.string.stream_ui_channel_attachments_media_title) Scaffold( - modifier = modifier, + modifier = modifier.semantics { paneTitle = paneTitleText }, topBar = { ChatTheme.componentFactory.ChannelMediaAttachmentsTopBar( params = ChannelMediaAttachmentsTopBarParams( @@ -144,9 +150,24 @@ internal fun ChannelMediaAttachmentsItem( ) { val data = item.attachment.upload ?: if (item.attachment.isImage()) item.attachment.imageUrl else item.attachment.thumbUrl + val isVideo = item.attachment.isVideo() + val senderName = item.message.user.name + val tileDescription = when { + isVideo && senderName.isNotBlank() -> + stringResource(UiCommonR.string.stream_ui_channel_attachments_media_item_video_from_user, senderName) + isVideo -> + stringResource(UiCommonR.string.stream_ui_channel_attachments_media_item_video) + senderName.isNotBlank() -> + stringResource(UiCommonR.string.stream_ui_channel_attachments_media_item_photo_from_user, senderName) + else -> + stringResource(UiCommonR.string.stream_ui_channel_attachments_media_item_photo) + } Box( - modifier = Modifier - .clickable(onClick = onClick), + modifier = modifier + .clickable(onClick = onClick) + .semantics(mergeDescendants = true) { + contentDescription = tileDescription + }, ) { StreamAsyncImage( modifier = Modifier 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 7f222042062..200afd0d9dc 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 @@ -49,6 +49,8 @@ import androidx.compose.ui.platform.LocalInspectionMode import androidx.compose.ui.platform.testTag import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource +import androidx.compose.ui.semantics.heading +import androidx.compose.ui.semantics.semantics import androidx.compose.ui.unit.dp import androidx.core.net.toUri import io.getstream.chat.android.client.ChatClient @@ -2704,6 +2706,7 @@ public interface ChatComponentFactory { title = { Text( text = stringResource(UiCommonR.string.stream_ui_channel_attachments_files_title), + modifier = Modifier.semantics { heading() }, style = ChatTheme.typography.headingSmall, maxLines = 1, ) @@ -2770,7 +2773,8 @@ public interface ChatComponentFactory { .background(ChatTheme.colors.backgroundCoreSurfaceSubtle) .topBorder(color = ChatTheme.colors.borderCoreSubtle) .bottomBorder(color = ChatTheme.colors.borderCoreSubtle) - .padding(horizontal = StreamTokens.spacingMd, vertical = StreamTokens.spacingXs), + .padding(horizontal = StreamTokens.spacingMd, vertical = StreamTokens.spacingXs) + .semantics { heading() }, text = params.label, style = ChatTheme.typography.captionEmphasis, color = ChatTheme.colors.chatTextSystem, @@ -2826,6 +2830,7 @@ public interface ChatComponentFactory { title = { Text( text = stringResource(UiCommonR.string.stream_ui_channel_attachments_media_title), + modifier = Modifier.semantics { heading() }, style = ChatTheme.typography.headingSmall, maxLines = 1, ) diff --git a/stream-chat-android-ui-common/src/main/res/values-es/strings.xml b/stream-chat-android-ui-common/src/main/res/values-es/strings.xml index c58ff3aaf96..8904dbe9160 100644 --- a/stream-chat-android-ui-common/src/main/res/values-es/strings.xml +++ b/stream-chat-android-ui-common/src/main/res/values-es/strings.xml @@ -25,6 +25,10 @@ "No hay fotos ni videos" "¡Error al cargar los archivos multimedia!" "Fotos y Videos" + "Foto" + "Vídeo" + "Foto de %1$s" + "Vídeo de %1$s" "Error al agregar miembros" "Error al suspender al miembro" "Permanentemente" diff --git a/stream-chat-android-ui-common/src/main/res/values-fr/strings.xml b/stream-chat-android-ui-common/src/main/res/values-fr/strings.xml index cf8df91b988..32accbea9a6 100644 --- a/stream-chat-android-ui-common/src/main/res/values-fr/strings.xml +++ b/stream-chat-android-ui-common/src/main/res/values-fr/strings.xml @@ -25,6 +25,10 @@ "Aucune photo ni vidéo" "Échec du chargement des fichiers multimédias !" "Photos et Vidéos" + "Photo" + "Vidéo" + "Photo de %1$s" + "Vidéo de %1$s" "Échec de l\'ajout des membres" "Échec du bannissement du membre" "Définitivement" diff --git a/stream-chat-android-ui-common/src/main/res/values-hi/strings.xml b/stream-chat-android-ui-common/src/main/res/values-hi/strings.xml index 4198b62ea17..7639c20eaa4 100644 --- a/stream-chat-android-ui-common/src/main/res/values-hi/strings.xml +++ b/stream-chat-android-ui-common/src/main/res/values-hi/strings.xml @@ -25,6 +25,10 @@ "कोई फ़ोटो या वीडियो नहीं" "मीडिया अटैचमेंट लोड करने में विफल!" "फ़ोटो & वीडियो" + "फ़ोटो" + "वीडियो" + "%1$s की फ़ोटो" + "%1$s का वीडियो" "सदस्य जोड़ने में विफल" "सदस्य को प्रतिबंधित करने में विफल" "स्थायी रूप से" diff --git a/stream-chat-android-ui-common/src/main/res/values-in/strings.xml b/stream-chat-android-ui-common/src/main/res/values-in/strings.xml index 6931a76b1e9..439c166375e 100644 --- a/stream-chat-android-ui-common/src/main/res/values-in/strings.xml +++ b/stream-chat-android-ui-common/src/main/res/values-in/strings.xml @@ -25,6 +25,10 @@ "Tidak ada foto atau video" "Gagal memuat lampiran media!" "Foto & Video" + "Foto" + "Video" + "Foto dari %1$s" + "Video dari %1$s" "Gagal menambahkan anggota" "Gagal melarang anggota" "Secara permanen" diff --git a/stream-chat-android-ui-common/src/main/res/values-it/strings.xml b/stream-chat-android-ui-common/src/main/res/values-it/strings.xml index d7362ad2966..353862e030a 100644 --- a/stream-chat-android-ui-common/src/main/res/values-it/strings.xml +++ b/stream-chat-android-ui-common/src/main/res/values-it/strings.xml @@ -25,6 +25,10 @@ "Nessuna foto o video" "Impossibile caricare gli allegati multimediali!" "Foto & Video" + "Foto" + "Video" + "Foto di %1$s" + "Video di %1$s" "Impossibile aggiungere i membri" "Impossibile bannare il membro" "Permanentemente" diff --git a/stream-chat-android-ui-common/src/main/res/values-ja/strings.xml b/stream-chat-android-ui-common/src/main/res/values-ja/strings.xml index 35bbd301d45..b638dd00746 100644 --- a/stream-chat-android-ui-common/src/main/res/values-ja/strings.xml +++ b/stream-chat-android-ui-common/src/main/res/values-ja/strings.xml @@ -25,6 +25,10 @@ "写真・動画はありません" "メディア添付の読み込みに失敗しました!" "写真 & 動画" + "写真" + "動画" + "%1$sからの写真" + "%1$sからの動画" "メンバーの追加に失敗しました" "メンバーのBANに失敗しました" "永久" diff --git a/stream-chat-android-ui-common/src/main/res/values-ko/strings.xml b/stream-chat-android-ui-common/src/main/res/values-ko/strings.xml index e61d35e70d2..83456a8acba 100644 --- a/stream-chat-android-ui-common/src/main/res/values-ko/strings.xml +++ b/stream-chat-android-ui-common/src/main/res/values-ko/strings.xml @@ -25,6 +25,10 @@ "사진 또는 동영상 없음" "미디어 첨부를 로드하지 못했습니다!" "사진 & 동영상" + "사진" + "동영상" + "%1$s님의 사진" + "%1$s님의 동영상" "멤버 추가에 실패했습니다" "멤버 차단에 실패했습니다" "영구적" diff --git a/stream-chat-android-ui-common/src/main/res/values/strings.xml b/stream-chat-android-ui-common/src/main/res/values/strings.xml index 9d65e90e9e3..555b9fca913 100644 --- a/stream-chat-android-ui-common/src/main/res/values/strings.xml +++ b/stream-chat-android-ui-common/src/main/res/values/strings.xml @@ -199,6 +199,10 @@ No photos or videos Share a photo or video to see it here Failed to load media attachments! + Photo + Video + Photo from %1$s + Video from %1$s Files No files