@@ -181,6 +181,11 @@ private fun buildDmChannelActions(
181181 selectedChannel = selectedChannel,
182182 viewModel = viewModel,
183183 ),
184+ buildDmPinAction(
185+ canPinChannel = optionVisibility.isPinChannelVisible,
186+ selectedChannel = selectedChannel,
187+ viewModel = viewModel,
188+ ),
184189 buildDmArchiveAction(
185190 canArchiveChannel = optionVisibility.isArchiveChannelVisible,
186191 selectedChannel = selectedChannel,
@@ -321,7 +326,7 @@ private fun buildGroupChannelActions(
321326 selectedChannel = selectedChannel,
322327 viewModel = viewModel,
323328 ),
324- buildPinAction (
329+ buildGroupPinAction (
325330 canPinChannel = optionVisibility.isPinChannelVisible,
326331 selectedChannel = selectedChannel,
327332 viewModel = viewModel,
@@ -379,23 +384,47 @@ private fun buildGroupChannelActions(
379384}
380385
381386/* *
382- * Builds the pin action for the channel, based on the current state.
387+ * Builds the pin action for DM channels.
388+ */
389+ @Composable
390+ private fun buildDmPinAction (
391+ canPinChannel : Boolean ,
392+ selectedChannel : Channel ,
393+ viewModel : ChannelListViewModel ,
394+ ): ChannelAction ? = when (selectedChannel.isPinned().takeIf { canPinChannel }) {
395+ false -> PinChannel (
396+ channel = selectedChannel,
397+ label = stringResource(id = R .string.stream_compose_selected_channel_menu_pin_chat),
398+ onAction = { viewModel.pinChannel(selectedChannel) },
399+ )
400+
401+ true -> UnpinChannel (
402+ channel = selectedChannel,
403+ label = stringResource(id = R .string.stream_compose_selected_channel_menu_unpin_chat),
404+ onAction = { viewModel.unpinChannel(selectedChannel) },
405+ )
406+
407+ null -> null
408+ }
409+
410+ /* *
411+ * Builds the pin action for group channels.
383412 */
384413@Composable
385- private fun buildPinAction (
414+ private fun buildGroupPinAction (
386415 canPinChannel : Boolean ,
387416 selectedChannel : Channel ,
388417 viewModel : ChannelListViewModel ,
389418): ChannelAction ? = when (selectedChannel.isPinned().takeIf { canPinChannel }) {
390419 false -> PinChannel (
391420 channel = selectedChannel,
392- label = stringResource(id = R .string.stream_compose_selected_channel_menu_pin_channel ),
421+ label = stringResource(id = R .string.stream_compose_selected_channel_menu_pin_group ),
393422 onAction = { viewModel.pinChannel(selectedChannel) },
394423 )
395424
396425 true -> UnpinChannel (
397426 channel = selectedChannel,
398- label = stringResource(id = R .string.stream_compose_selected_channel_menu_unpin_channel ),
427+ label = stringResource(id = R .string.stream_compose_selected_channel_menu_unpin_group ),
399428 onAction = { viewModel.unpinChannel(selectedChannel) },
400429 )
401430
0 commit comments