@@ -23,21 +23,21 @@ import androidx.compose.foundation.layout.fillMaxWidth
2323import androidx.compose.foundation.layout.padding
2424import androidx.compose.foundation.layout.size
2525import androidx.compose.foundation.shape.RoundedCornerShape
26+ import androidx.compose.material3.Icon
2627import androidx.compose.material3.Text
2728import androidx.compose.runtime.Composable
2829import androidx.compose.ui.Alignment
2930import androidx.compose.ui.Modifier
31+ import androidx.compose.ui.res.painterResource
3032import androidx.compose.ui.res.stringResource
3133import androidx.compose.ui.text.style.TextOverflow
3234import androidx.compose.ui.tooling.preview.Preview
3335import androidx.compose.ui.unit.dp
3436import io.getstream.chat.android.compose.R
3537import io.getstream.chat.android.compose.state.messages.attachments.AttachmentState
36- import io.getstream.chat.android.compose.ui.components.attachments.files.FileTypeIcon
3738import io.getstream.chat.android.compose.ui.theme.ChatTheme
3839import io.getstream.chat.android.compose.ui.theme.MessageStyling
3940import io.getstream.chat.android.compose.ui.theme.StreamTokens
40- import io.getstream.chat.android.compose.ui.util.MimeTypeIconProvider
4141import io.getstream.chat.android.compose.ui.util.applyIf
4242import io.getstream.chat.android.compose.ui.util.shouldBeDisplayedAsFullSizeAttachment
4343import io.getstream.chat.android.models.Attachment
@@ -68,12 +68,19 @@ public fun UnsupportedAttachmentContent(
6868 padding(MessageStyling .messageSectionPadding)
6969 .background(color, RoundedCornerShape (StreamTokens .radiusLg))
7070 }
71- .padding(StreamTokens .spacingSm),
71+ .padding(
72+ start = StreamTokens .spacingSm,
73+ top = StreamTokens .spacingMd,
74+ end = StreamTokens .spacingMd,
75+ bottom = StreamTokens .spacingMd,
76+ ),
7277 verticalAlignment = Alignment .CenterVertically ,
7378 ) {
74- FileTypeIcon (
75- data = MimeTypeIconProvider .getIcon(attachment.mimeType),
76- modifier = Modifier .size(height = 40 .dp, width = 35 .dp),
79+ Icon (
80+ painter = painterResource(R .drawable.stream_design_ic_unsupported_attachment),
81+ tint = ChatTheme .colors.textPrimary,
82+ contentDescription = null ,
83+ modifier = Modifier .size(20 .dp),
7784 )
7885
7986 Text (
@@ -82,7 +89,7 @@ public fun UnsupportedAttachmentContent(
8289 color = MessageStyling .textColor(outgoing = state.isMine),
8390 maxLines = 2 ,
8491 overflow = TextOverflow .Ellipsis ,
85- modifier = Modifier .padding(horizontal = StreamTokens .spacingSm ),
92+ modifier = Modifier .padding(horizontal = StreamTokens .spacingXs ),
8693 )
8794 }
8895 }
@@ -99,20 +106,25 @@ private val supportedAttachmentTypes = setOf(
99106 AttachmentType .AUDIO_RECORDING ,
100107)
101108
109+ @Composable
110+ internal fun UnsupportedAttachmentContent (isMine : Boolean ) {
111+ UnsupportedAttachmentContent (
112+ state = AttachmentState (
113+ message = Message (
114+ attachments = mutableListOf (
115+ Attachment (type = " unknown" ),
116+ Attachment (type = " custom_type" ),
117+ ),
118+ ),
119+ isMine = isMine,
120+ ),
121+ )
122+ }
123+
102124@Preview(showBackground = true )
103125@Composable
104126private fun OwnUnsupportedAttachmentContentPreview () {
105127 ChatTheme {
106- UnsupportedAttachmentContent (
107- state = AttachmentState (
108- message = Message (
109- attachments = mutableListOf (
110- Attachment (type = " unknown" ),
111- Attachment (type = " custom_type" ),
112- ),
113- ),
114- isMine = true ,
115- ),
116- )
128+ UnsupportedAttachmentContent (isMine = true )
117129 }
118130}
0 commit comments