Skip to content

Commit b87ad13

Browse files
committed
Remove unmute group from channel actions sheet
1 parent 20c9d85 commit b87ad13

File tree

1 file changed

+4
-41
lines changed
  • stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/components/channels

1 file changed

+4
-41
lines changed

stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/components/channels/ChannelOptions.kt

Lines changed: 4 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ import io.getstream.chat.android.ui.common.state.channels.actions.MuteUser
5050
import io.getstream.chat.android.ui.common.state.channels.actions.PinChannel
5151
import io.getstream.chat.android.ui.common.state.channels.actions.UnarchiveChannel
5252
import io.getstream.chat.android.ui.common.state.channels.actions.UnblockUser
53-
import io.getstream.chat.android.ui.common.state.channels.actions.UnmuteChannel
5453
import io.getstream.chat.android.ui.common.state.channels.actions.UnmuteUser
5554
import io.getstream.chat.android.ui.common.state.channels.actions.UnpinChannel
5655
import io.getstream.chat.android.ui.common.state.channels.actions.ViewInfo
@@ -96,8 +95,8 @@ public fun ChannelOptions(
9695
*
9796
* Actions vary by channel type:
9897
* - **DM:** View Info, Mute/Unmute User, Block/Unblock User, Archive Chat, Delete Chat
99-
* - **Group (owner):** View Info, Mute/Unmute Group, Archive Group, Delete Group
100-
* - **Group (member):** View Info, Mute/Unmute Group, Archive Group, Leave Group
98+
* - **Group (owner):** View Info, Archive Group, Delete Group
99+
* - **Group (member):** View Info, Archive Group, Leave Group
101100
*
102101
* @param selectedChannel The currently selected channel.
103102
* @param isMuted If the channel is muted or not.
@@ -136,7 +135,6 @@ public fun buildDefaultChannelActions(
136135
} else {
137136
buildGroupChannelActions(
138137
selectedChannel = selectedChannel,
139-
isMuted = isMuted,
140138
ownCapabilities = ownCapabilities,
141139
optionVisibility = optionVisibility,
142140
channelName = channelName,
@@ -292,14 +290,13 @@ private fun buildDmDeleteAction(
292290

293291
/**
294292
* Builds channel actions for group channels.
295-
* - **Owner (has DELETE_CHANNEL):** View Info, Mute/Unmute Group, Archive Group, Delete Group
296-
* - **Member (no DELETE_CHANNEL):** View Info, Mute/Unmute Group, Archive Group, Leave Group
293+
* - **Owner (has DELETE_CHANNEL):** View Info, Archive Group, Delete Group
294+
* - **Member (no DELETE_CHANNEL):** View Info, Archive Group, Leave Group
297295
*/
298296
@Suppress("LongMethod", "LongParameterList")
299297
@Composable
300298
private fun buildGroupChannelActions(
301299
selectedChannel: Channel,
302-
isMuted: Boolean,
303300
ownCapabilities: Set<String>,
304301
optionVisibility: ChannelOptionItemVisibility,
305302
channelName: String,
@@ -308,7 +305,6 @@ private fun buildGroupChannelActions(
308305
): List<ChannelAction> {
309306
val canLeaveChannel = ownCapabilities.contains(ChannelCapabilities.LEAVE_CHANNEL)
310307
val canDeleteChannel = ownCapabilities.contains(ChannelCapabilities.DELETE_CHANNEL)
311-
val canMuteChannel = ownCapabilities.contains(ChannelCapabilities.MUTE_CHANNEL)
312308

313309
return listOfNotNull(
314310
if (optionVisibility.isViewInfoVisible) {
@@ -320,12 +316,6 @@ private fun buildGroupChannelActions(
320316
} else {
321317
null
322318
},
323-
buildGroupMuteAction(
324-
canMuteChannel = optionVisibility.isMuteChannelVisible && canMuteChannel,
325-
isMuted = isMuted,
326-
selectedChannel = selectedChannel,
327-
viewModel = viewModel,
328-
),
329319
buildGroupPinAction(
330320
canPinChannel = optionVisibility.isPinChannelVisible,
331321
selectedChannel = selectedChannel,
@@ -479,33 +469,6 @@ private fun buildGroupArchiveAction(
479469
null -> null
480470
}
481471

482-
/**
483-
* Builds the mute action for group channels, using "Mute Group" / "Unmute Group" labels.
484-
*/
485-
@Composable
486-
private fun buildGroupMuteAction(
487-
canMuteChannel: Boolean,
488-
isMuted: Boolean,
489-
selectedChannel: Channel,
490-
viewModel: ChannelListViewModel,
491-
): ChannelAction? = if (canMuteChannel) {
492-
when (isMuted) {
493-
true -> UnmuteChannel(
494-
channel = selectedChannel,
495-
label = stringResource(id = R.string.stream_compose_selected_channel_menu_unmute_group),
496-
onAction = { viewModel.unmuteChannel(selectedChannel) },
497-
)
498-
499-
false -> MuteChannel(
500-
channel = selectedChannel,
501-
label = stringResource(id = R.string.stream_compose_selected_channel_menu_mute_group),
502-
onAction = { viewModel.muteChannel(selectedChannel) },
503-
)
504-
}
505-
} else {
506-
null
507-
}
508-
509472
/**
510473
* Preview of [ChannelOptions].
511474
*

0 commit comments

Comments
 (0)