Package-level declarations

Types

Link copied to clipboard

Represents the state of the message menu dialog for specific message.

Link copied to clipboard

Represents the state of the ChannelTopBar.

Link copied to clipboard
class ChannelViewModel(repository: ChannelScreenResourceRepository, savedStateHandle: SavedStateHandle) : ViewModel, ChannelViewModelContract

ViewModel class for ChannelScreen.

Link copied to clipboard
Link copied to clipboard
class ChannelViewModelParams @JvmOverloads constructor(val channelUrl: String, val messageListParams: MessageListParams = MessageListParams().apply { this.reverse = true }) : SendbirdViewModelParams

Channel view model params.

Link copied to clipboard

Represents the contract to handle the message input dialog click actions.

Link copied to clipboard
class DefaultMessageMenuDialogContract(context: Context, message: UikitBaseMessage, viewModelContract: ChannelViewModelContract, messageInputState: MessageInputState, clipboardManager: ClipboardManager, viewScope: CoroutineScope, snackbarHostState: SnackbarHostState) : MessageMenuDialogContract

The default implementation of MessageMenuDialogContract.

Link copied to clipboard
sealed class MessageInputMode

Represents the mode of the message input.

Link copied to clipboard

Represents the state of the message input.

Functions

Link copied to clipboard
fun AdminMessageItem(message: UikitAdminMessage, modifier: Modifier = Modifier, textStyle: TextStyle = MaterialTheme.typography.labelMedium, textColor: Color = MaterialTheme.colorScheme.onBackground.copy(alpha = SendbirdOpacity.MediumOpacity))

A Composable to display the UikitAdminMessage item.

Link copied to clipboard
fun ChannelMessageInput(modifier: Modifier = Modifier, state: MessageInputState, viewModelContract: ChannelViewModelContract)

Represents the channel message input component.

Link copied to clipboard
fun ChannelScreen(navController: NavController?, channelUrl: String, modifier: Modifier = Modifier, onTopBarNavigationIconClick: () -> Unit = { navController?.popBackStack() }, onTopBarActionClick: () -> Unit = { navController?.navigateToChannelSettings(channelUrl) }, onMessageItemClick: (Context, UikitBaseMessage, ImageViewerState) -> Unit = { context, message, state -> when (message) { is UikitFileMessage -> { if (message.isImage) { state.showImage(message) } else if (message.isFile or message.isVideo) { val type = message.type.lowercase() val uri = Uri.parse(message.url) val intent = uri.getViewerIntent(type) context.startActivity(intent) } else { Logger.d("unknown file type: ${message.type}") } } else -> {} } }, onMessageItemLongClick: (UikitBaseMessage, ChannelDialogState) -> Unit = { message, state -> state.showMessageMenuDialog(message) }, onChannelRemoved: (String) -> Unit = { navController?.popBackStack() }, messageInputState: MessageInputState = rememberMessageInputState(), dialogState: ChannelDialogState = rememberChannelDialogState(), imageViewerState: ImageViewerState = rememberImageViewerState(), snackbarHostState: SnackbarHostState = remember { SnackbarHostState() }, viewModelContract: ChannelViewModelContract = viewModel<ChannelViewModel>( factory = ChannelViewModel.factory( ChannelViewModelParams( channelUrl = channelUrl ) ) ), topBar: @Composable (state: ChannelTopBarState) -> Unit = { ChannelTopBar( channelCoverModels = it.coverModels, channelTitle = it.title, channelDescription = it.channelDescription, onNavigationIconClick = it.onNavigationIconClick, onActionClick = it.onActionClick ) }, loading: @Composable () -> Unit = {}, failure: @Composable (e: Throwable) -> Unit = { e -> FailurePlaceholder( onRetryClick = { viewModelContract.prepare() } ) }, empty: @Composable () -> Unit = { ScreenPlaceholder( icon = painterResource(id = R.drawable.icon_message), text = stringResource(id = R.string.sb_text_channel_message_empty) ) }, messageMenuDialog: @Composable (UikitBaseMessage, MessageMenuDialogContract) -> Unit = { message, contract -> MessageMenuDialog( message = message, messageMenuDialogContract = contract, onItemClick = { it.onClick() }, onDismissRequest = { dialogState.dismissMessageMenuDialog() } ) }, messageInputBottomSheet: @Composable (MessageInputBottomSheetContract) -> Unit = { contract -> MessageInputBottomSheet( messageInputBottomSheetContract = contract, onItemClick = { // TODO(nathan) : show toast when something went wrong(it was in previous version) it.onClick() }, onDismissRequest = { messageInputState.clear() } ) }, messageItem: @Composable (prevMessage: UikitBaseMessage?, message: UikitBaseMessage, nextMessage: UikitBaseMessage?, onMessageClick: (UikitBaseMessage) -> Unit, onMessageLongClick: (UikitBaseMessage) -> Unit) -> Unit = { prevMessage, message, nextMessage, onMessageClick, onMessageLongClick -> MessageItemFactory( prevMessage, message, nextMessage, onMessageClick = onMessageClick, onMessageLongClick = onMessageLongClick ) }, messageInput: @Composable (messageInputState: MessageInputState) -> Unit = { state -> ChannelMessageInput( state = state, viewModelContract = viewModelContract ) })

Represents the screen for showing a messages in a UikitGroupChannel.

Link copied to clipboard
fun ChannelTopBar(modifier: Modifier = Modifier, channelCoverModels: List<ImageModel> = listOf(), channelTitle: String = "", channelDescription: String = "", onNavigationIconClick: () -> Unit = {}, onActionClick: () -> Unit = {}, title: @Composable () -> Unit = { ChannelTopBarTitle( coverModels = channelCoverModels, title = channelTitle, description = channelDescription, modifier = Modifier.padding(horizontal = 8.dp) ) }, navigationIcon: @Composable () -> Unit = { BackButton(onClick = onNavigationIconClick) }, action: @Composable () -> Unit = { SendbirdIconButton( icon = painterResource(id = R.drawable.icon_info), contentDescription = stringResource(id = R.string.sb_view_header_right_button_description), modifier = Modifier.size(32.dp), onClick = onActionClick ) })

The top bar for the ChannelScreen.

Link copied to clipboard
fun MessageInput(inputValue: String, onInputValueChange: (String) -> Unit, modifier: Modifier = Modifier, messageInputMode: MessageInputMode = MessageInputMode.Default, isActionButtonShown: Boolean = true, enabled: Boolean = true, onEditModeSaveClick: (messageId: Long) -> Unit = {}, onEditModeCancelClick: () -> Unit = {}, onMenuClick: () -> Unit = {}, onActionClick: () -> Unit = {})

Represents the message input component.

Link copied to clipboard
fun MessageInputBottomSheet(messageInputBottomSheetContract: MessageInputBottomSheetContract, modifier: Modifier = Modifier, menus: @Composable (MessageInputBottomSheetContract) -> List<DialogMenuDetail> = { contract -> SendbirdDialogDefaults.messageInputMenuItems(contract) }, onItemClick: (DialogMenuDetail) -> Unit = { it.onClick() }, onDismissRequest: () -> Unit = {})

Represents the message input bottom sheet.

Link copied to clipboard
fun MessageItemFactory(prevMessage: UikitBaseMessage?, message: UikitBaseMessage, nextMessage: UikitBaseMessage?, modifier: Modifier = Modifier, contentAlignment: Alignment = when (message) { is UikitTimelineMessage, is UikitAdminMessage -> { Alignment.Center } else -> { if (message.isMine) { Alignment.CenterEnd } else { Alignment.CenterStart } } }, messageGroupingPosition: MessageGroupingPosition = message.messageGroupingPosition(prevMessage, nextMessage), onMessageClick: (UikitBaseMessage) -> Unit = {}, onMessageLongClick: (UikitBaseMessage) -> Unit = {}, myTextMessageItem: @Composable (message: UikitUserMessage) -> Unit = { MyTextMessageItem( message = it, onMessageClick = onMessageClick, onMessageLongClick = onMessageLongClick, messageGroupingPosition = messageGroupingPosition ) }, myFileMessageItem: @Composable (message: UikitFileMessage) -> Unit = { MyFileMessageItem( message = it, onMessageClick = onMessageClick, onMessageLongClick = onMessageLongClick, messageGroupingPosition = messageGroupingPosition ) }, myMediaMessageItem: @Composable (message: UikitFileMessage) -> Unit = { MyMediaMessageItem( message = it, onMessageClick = onMessageClick, onMessageLongClick = onMessageLongClick, messageGroupingPosition = messageGroupingPosition ) }, myUnknownMessageItem: @Composable (message: UikitBaseMessage) -> Unit = { MyUnknownMessageItem( message = it, onMessageClick = onMessageClick, onMessageLongClick = onMessageLongClick, messageGroupingPosition = messageGroupingPosition ) }, otherTextMessageItem: @Composable (message: UikitUserMessage) -> Unit = { OtherTextMessageItem( message = it, onMessageClick = onMessageClick, onMessageLongClick = onMessageLongClick, messageGroupingPosition = messageGroupingPosition ) }, otherFileMessageItem: @Composable (message: UikitFileMessage) -> Unit = { OtherFileMessageItem( message = it, onMessageClick = onMessageClick, onMessageLongClick = onMessageLongClick, messageGroupingPosition = messageGroupingPosition ) }, otherMediaMessageItem: @Composable (message: UikitFileMessage) -> Unit = { OtherMediaMessageItem( message = it, onMessageClick = onMessageClick, onMessageLongClick = onMessageLongClick, messageGroupingPosition = messageGroupingPosition ) }, otherUnknownMessageItem: @Composable (message: UikitBaseMessage) -> Unit = { OtherUnknownMessageItem( message = it, onMessageClick = onMessageClick, onMessageLongClick = onMessageLongClick, messageGroupingPosition = messageGroupingPosition ) }, adminMessageItem: @Composable (message: UikitAdminMessage) -> Unit = { AdminMessageItem(message = it) }, timelineMessageItem: @Composable (message: UikitTimelineMessage) -> Unit = { TimelineMessageItem(message = it) })

A factory Composable to create a message item based on the message type.

Link copied to clipboard
fun MessageMenuDialog(message: UikitBaseMessage, messageMenuDialogContract: MessageMenuDialogContract, modifier: Modifier = Modifier, menus: @Composable (UikitBaseMessage, MessageMenuDialogContract) -> List<DialogMenuDetail> = { baseMessage, contract -> SendbirdDialogDefaults.messageMenuItems(message = baseMessage, contract = contract) }, onItemClick: (DialogMenuDetail) -> Unit = { it.onClick() }, onDismissRequest: () -> Unit = {})

Represents the message menu dialog for the given message.

Link copied to clipboard
fun MyFileMessageItem(message: UikitFileMessage, modifier: Modifier = Modifier, onMessageClick: (UikitFileMessage) -> Unit = {}, onMessageLongClick: (UikitFileMessage) -> Unit = {}, fileBackgroundColor: Color = MaterialTheme.colorScheme.primary, messageGroupingPosition: MessageGroupingPosition = MessageGroupingPosition.Single, fileIcon: @Composable () -> Unit = { Icon( painter = message.fileIcon(), contentDescription = null, modifier = Modifier .size(28.dp) .clip(MaterialTheme.shapes.small), tint = Color.Unspecified ) }, fileName: @Composable () -> Unit = { Text( text = message.fileName(), modifier = Modifier, style = MaterialTheme.typography.bodySmall, color = MaterialTheme.colorScheme.background.copy(alpha = SendbirdOpacity.HighOpacity) ) })

A Composable to display the current user's UikitFileMessage item other than images or videos using the MyMessageItem.

Link copied to clipboard
fun MyMediaMessageItem(message: UikitFileMessage, modifier: Modifier = Modifier, onMessageClick: (UikitFileMessage) -> Unit = {}, onMessageLongClick: (UikitFileMessage) -> Unit = {}, mediaBackgroundColor: Color = if (SendbirdUikitCompose.isDarkTheme) { MaterialTheme.colorScheme.surfaceContainerHighest } else { MaterialTheme.colorScheme.surfaceBright }, messageGroupingPosition: MessageGroupingPosition = MessageGroupingPosition.Single)

A Composable to display the current user's UikitFileMessage item, which are image or videos, using the MyMessageItem.

Link copied to clipboard
fun MyMessageItem(message: UikitBaseMessage, modifier: Modifier = Modifier, messageGroupingPosition: MessageGroupingPosition = MessageGroupingPosition.Single, sendingStatus: @Composable () -> Unit = { SendingStatus( unreadMemberCount = message.unreadMemberCount, undeliveredMemberCount = message.undeliveredMemberCount, sendingStatus = message.sendingStatus, modifier = Modifier.size(16.dp) ) }, sentAt: @Composable () -> Unit = { Text( text = message.sentAt(), color = MaterialTheme.colorScheme.onBackground.copy(SendbirdOpacity.LowOpacity), style = MaterialTheme.typography.labelSmall ) }, content: @Composable (UikitBaseMessage) -> Unit)

A Composable to display the current user's message item. This is a base Composable with common Composables, such as UikitBaseMessage.sendingStatus and UikitBaseMessage.sentAt with content slot open to be used in customizing for each type of messages.

Link copied to clipboard
fun MyTextMessageItem(message: UikitUserMessage, modifier: Modifier = Modifier, onMessageClick: (UikitUserMessage) -> Unit = {}, onMessageLongClick: (UikitUserMessage) -> Unit = {}, textBackgroundColor: Color = MaterialTheme.colorScheme.primary, textStyle: TextStyle = MaterialTheme.typography.bodySmall, textColor: Color = MaterialTheme.colorScheme.background.copy(alpha = SendbirdOpacity.HighOpacity), messageGroupingPosition: MessageGroupingPosition = MessageGroupingPosition.Single)

A Composable to display the current user's UikitUserMessage item using the MyMessageItem.

Link copied to clipboard
fun MyUnknownMessageItem(message: UikitBaseMessage, modifier: Modifier = Modifier, onMessageClick: (UikitBaseMessage) -> Unit = {}, onMessageLongClick: (UikitBaseMessage) -> Unit = {}, textBackgroundColor: Color = MaterialTheme.colorScheme.primary, messageGroupingPosition: MessageGroupingPosition = MessageGroupingPosition.Single)

A Composable to display the current user's unknown type of message using the MyMessageItem.

Link copied to clipboard
fun OtherFileMessageItem(message: UikitFileMessage, modifier: Modifier = Modifier, onMessageClick: (UikitFileMessage) -> Unit = {}, onMessageLongClick: (UikitFileMessage) -> Unit = {}, fileBackgroundColor: Color = if (SendbirdUikitCompose.isDarkTheme) { MaterialTheme.colorScheme.surfaceContainerHighest } else { MaterialTheme.colorScheme.surfaceBright }, messageGroupingPosition: MessageGroupingPosition = MessageGroupingPosition.Single, fileIcon: @Composable () -> Unit = { Icon( painter = message.fileIcon(), contentDescription = null, modifier = Modifier .size(28.dp) .clip(MaterialTheme.shapes.small), tint = Color.Unspecified ) }, fileName: @Composable () -> Unit = { Text( text = message.fileName(), modifier = Modifier, style = MaterialTheme.typography.bodySmall, color = MaterialTheme.colorScheme.onBackground ) })

A Composable to display the other user's UikitFileMessage item other than images or videos using the OtherMessageItem.

Link copied to clipboard
fun OtherMediaMessageItem(message: UikitFileMessage, modifier: Modifier = Modifier, onMessageClick: (UikitFileMessage) -> Unit = {}, onMessageLongClick: (UikitFileMessage) -> Unit = {}, mediaBackgroundColor: Color = if (SendbirdUikitCompose.isDarkTheme) { MaterialTheme.colorScheme.surfaceContainerHighest } else { MaterialTheme.colorScheme.surfaceBright }, messageGroupingPosition: MessageGroupingPosition = MessageGroupingPosition.Single)

A Composable to display the other user's UikitFileMessage item, which are image or videos, using the OtherMessageItem.

Link copied to clipboard
fun OtherMessageItem(message: UikitBaseMessage, modifier: Modifier = Modifier, messageGroupingPosition: MessageGroupingPosition = MessageGroupingPosition.Single, profile: @Composable () -> Unit = { AsyncImage( model = ImageModel( model = message.profileUrl(), placeholder = IconPainter( image = ImageBitmap.imageResource(id = R.drawable.icon_user), tint = MaterialTheme.colorScheme.background.copy(SendbirdOpacity.HighOpacity), padding = 12.dp, backgroundColor = MaterialTheme.colorScheme.surfaceContainerHigh ), error = IconPainter( image = ImageBitmap.imageResource(id = R.drawable.icon_user), tint = MaterialTheme.colorScheme.background.copy(SendbirdOpacity.HighOpacity), padding = 12.dp, backgroundColor = MaterialTheme.colorScheme.surfaceContainerHigh ) ), modifier = Modifier .size(26.dp) .clip(CircleShape), contentDescription = stringResource(id = R.string.sb_sender_profile_description), ) }, nickname: @Composable () -> Unit = { Box( modifier = Modifier.padding(horizontal = 12.dp) ) { Text( text = message.nickname(), maxLines = 1, overflow = TextOverflow.Ellipsis, style = MaterialTheme.typography.labelSmall, color = MaterialTheme.colorScheme.onBackground.copy(alpha = SendbirdOpacity.MediumOpacity) ) } }, sentAt: @Composable () -> Unit = { Text( text = message.sentAt(), color = MaterialTheme.colorScheme.onBackground.copy(SendbirdOpacity.LowOpacity), style = MaterialTheme.typography.labelMedium ) }, content: @Composable (UikitBaseMessage) -> Unit)

A Composable to display the other user's message item. This is a base Composable with common Composables, such as other user's profile image using AsyncImage and UikitBaseMessage.sentAt with content slot open to be used in customizing for each type of messages.

Link copied to clipboard
fun OtherTextMessageItem(message: UikitUserMessage, modifier: Modifier = Modifier, onMessageClick: (UikitUserMessage) -> Unit = {}, onMessageLongClick: (UikitUserMessage) -> Unit = {}, textBackgroundColor: Color = if (SendbirdUikitCompose.isDarkTheme) { MaterialTheme.colorScheme.surfaceContainerHighest } else { MaterialTheme.colorScheme.surfaceBright }, textStyle: TextStyle = MaterialTheme.typography.bodySmall, textColor: Color = MaterialTheme.colorScheme.onBackground, messageGroupingPosition: MessageGroupingPosition = MessageGroupingPosition.Single)

A Composable to display the other user's UikitUserMessage item using the OtherMessageItem.

Link copied to clipboard
fun OtherUnknownMessageItem(message: UikitBaseMessage, modifier: Modifier = Modifier, onMessageClick: (UikitBaseMessage) -> Unit = {}, onMessageLongClick: (UikitBaseMessage) -> Unit = {}, textBackgroundColor: Color = MaterialTheme.colorScheme.inverseOnSurface, messageGroupingPosition: MessageGroupingPosition = MessageGroupingPosition.Single)

A Composable to display the other user's unknown type of message using the OtherMessageItem.

Link copied to clipboard

Creates a ChannelDialogState that can be remembered across compositions.

Link copied to clipboard
fun rememberChannelTopBarState(coverModels: List<ImageModel>, title: String, onNavigationClick: () -> Unit, onActionClick: () -> Unit, contentDescription: String): ChannelTopBarState

Creates a ChannelTopBarState that can be remembered across compositions.

Link copied to clipboard

Creates a MessageInputState that can be remembered across compositions.

Link copied to clipboard
fun SendingStatus(unreadMemberCount: Int, undeliveredMemberCount: Int, sendingStatus: SendingStatus, modifier: Modifier = Modifier, pending: @Composable () -> Unit = { CircularProgressIndicator( strokeWidth = 2.dp, modifier = modifier.semantics { contentDescription = SemanticContentDescription.PENDING } ) }, failed: @Composable () -> Unit = { Icon( painterResource(id = R.drawable.icon_error), contentDescription = null, tint = MaterialTheme.colorScheme.error, modifier = modifier.semantics { contentDescription = SemanticContentDescription.FAILED } ) }, succeeded: @Composable () -> Unit = { Icon( painterResource(id = R.drawable.icon_done_all), contentDescription = null, tint = MaterialTheme.colorScheme.secondary, modifier = modifier.semantics { contentDescription = SemanticContentDescription.SUCCEEDED } ) }, delivered: @Composable () -> Unit = { Icon( painterResource(id = R.drawable.icon_done), contentDescription = null, tint = MaterialTheme.colorScheme.onSurface, modifier = modifier.semantics { contentDescription = SemanticContentDescription.DELIVERED } ) }, read: @Composable () -> Unit = { Icon( painterResource(id = R.drawable.icon_done_all), contentDescription = null, tint = MaterialTheme.colorScheme.onSurface, modifier = modifier.semantics { contentDescription = SemanticContentDescription.READ } ) })

A Composable to display the unread/undelivered member counts with the sending status of the message.

Link copied to clipboard
fun TimelineMessageItem(message: UikitTimelineMessage, modifier: Modifier = Modifier, textBackgroundColor: Color = if (SendbirdUikitCompose.isDarkTheme) { MaterialTheme.colorScheme.surfaceTint.copy(alpha = SendbirdOpacity.LowOpacity) } else { MaterialTheme.colorScheme.surfaceTint.copy(alpha = SendbirdOpacity.MediumOpacity) }, textColor: Color = if (SendbirdUikitCompose.isDarkTheme) { MaterialTheme.colorScheme.onBackground.copy(alpha = SendbirdOpacity.MediumOpacity) } else { MaterialTheme.colorScheme.inverseOnSurface.copy(alpha = SendbirdOpacity.HighOpacity) }, textStyle: TextStyle = MaterialTheme.typography.labelSmall)

A Composable to display the UikitTimelineMessage item.