Package-level declarations

Functions

Link copied to clipboard
fun ChannelItem(channelItem: ItemState.ChannelItemState, currentUser: User?, onChannelClick: (Channel) -> Unit, onChannelLongClick: (Channel) -> Unit, modifier: Modifier = Modifier, leadingContent: @Composable RowScope.(ItemState.ChannelItemState) -> Unit = { DefaultChannelItemLeadingContent( channelItem = it, currentUser = currentUser, ) }, centerContent: @Composable RowScope.(ItemState.ChannelItemState) -> Unit = { DefaultChannelItemCenterContent( channel = it.channel, isMuted = it.isMuted, currentUser = currentUser, ) }, trailingContent: @Composable RowScope.(ItemState.ChannelItemState) -> Unit = { DefaultChannelItemTrailingContent( channel = it.channel, currentUser = currentUser, ) })

The basic channel item, that shows the channel in a list and exposes single and long click actions.

Link copied to clipboard
fun ChannelList(modifier: Modifier = Modifier, contentPadding: PaddingValues = PaddingValues(), viewModel: ChannelListViewModel = viewModel( factory = ChannelViewModelFactory( ChatClient.instance(), QuerySortByField.descByName("last_updated"), filters = null, ), ), lazyListState: LazyListState = rememberLazyListState(), onLastItemReached: () -> Unit = remember(viewModel) { { viewModel.loadMore() } }, onChannelClick: (Channel) -> Unit = {}, onChannelLongClick: (Channel) -> Unit = remember(viewModel) { { viewModel.selectChannel(it) } }, onSearchResultClick: (Message) -> Unit = {}, loadingContent: @Composable () -> Unit = { LoadingIndicator(modifier) }, emptyContent: @Composable () -> Unit = { DefaultChannelListEmptyContent(modifier) }, emptySearchContent: @Composable (String) -> Unit = { searchQuery -> DefaultChannelSearchEmptyContent( searchQuery = searchQuery, modifier = modifier, ) }, helperContent: @Composable BoxScope.() -> Unit = {}, loadingMoreContent: @Composable () -> Unit = { DefaultChannelsLoadingMoreIndicator() }, channelContent: @Composable (ItemState.ChannelItemState) -> Unit = { itemState -> val user by viewModel.user.collectAsState() DefaultChannelItem( channelItem = itemState, currentUser = user, onChannelClick = onChannelClick, onChannelLongClick = onChannelLongClick, ) }, searchResultContent: @Composable (ItemState.SearchResultItemState) -> Unit = { itemState -> val user by viewModel.user.collectAsState() DefaultSearchResultItem( searchResultItemState = itemState, currentUser = user, onSearchResultClick = onSearchResultClick, ) }, divider: @Composable () -> Unit = { DefaultChannelItemDivider() })

Default ChannelList component, that relies on the ChannelListViewModel to load the data and show it on the UI.

fun ChannelList(channelsState: ChannelsState, currentUser: User?, modifier: Modifier = Modifier, contentPadding: PaddingValues = PaddingValues(0.dp), lazyListState: LazyListState = rememberLazyListState(), onLastItemReached: () -> Unit = {}, onChannelClick: (Channel) -> Unit = {}, onChannelLongClick: (Channel) -> Unit = {}, onSearchResultClick: (Message) -> Unit = {}, loadingContent: @Composable () -> Unit = { DefaultChannelListLoadingIndicator(modifier) }, emptyContent: @Composable () -> Unit = { DefaultChannelListEmptyContent(modifier) }, emptySearchContent: @Composable (String) -> Unit = { searchQuery -> DefaultChannelSearchEmptyContent( searchQuery = searchQuery, modifier = modifier, ) }, helperContent: @Composable BoxScope.() -> Unit = {}, loadingMoreContent: @Composable () -> Unit = { DefaultChannelsLoadingMoreIndicator() }, channelContent: @Composable (ItemState.ChannelItemState) -> Unit = { itemState -> DefaultChannelItem( channelItem = itemState, currentUser = currentUser, onChannelClick = onChannelClick, onChannelLongClick = onChannelLongClick, ) }, searchResultContent: @Composable (ItemState.SearchResultItemState) -> Unit = { itemState -> DefaultSearchResultItem( searchResultItemState = itemState, currentUser = currentUser, onSearchResultClick = onSearchResultClick, ) }, divider: @Composable () -> Unit = { DefaultChannelItemDivider() })

Root Channel list component, that represents different UI, based on the current channel state.

Link copied to clipboard
fun Channels(channelsState: ChannelsState, lazyListState: LazyListState, onLastItemReached: () -> Unit, modifier: Modifier = Modifier, contentPadding: PaddingValues = PaddingValues(), helperContent: @Composable BoxScope.() -> Unit = {}, loadingMoreContent: @Composable () -> Unit = { DefaultChannelsLoadingMoreIndicator() }, itemContent: @Composable (ItemState) -> Unit, divider: @Composable () -> Unit)

Builds a list of ChannelItem elements, based on channelsState and action handlers that it receives.

Link copied to clipboard

Represents the default item divider in channel items.

Link copied to clipboard
fun SearchResultItem(searchResultItemState: ItemState.SearchResultItemState, currentUser: User?, onSearchResultClick: (Message) -> Unit, modifier: Modifier = Modifier, leadingContent: @Composable RowScope.(ItemState.SearchResultItemState) -> Unit = { DefaultSearchResultItemLeadingContent( searchResultItemState = it, ) }, centerContent: @Composable RowScope.(ItemState.SearchResultItemState) -> Unit = { DefaultSearchResultItemCenterContent( searchResultItemState = it, currentUser = currentUser, ) }, trailingContent: @Composable RowScope.(ItemState.SearchResultItemState) -> Unit = { DefaultSearchResultItemTrailingContent( searchResultItemState = it, ) })

The basic search result item that show the message and the channel name in a list and expose click actions.