Reduce ChatScreen parameter footprint to avoid verifier crash
This commit is contained in:
@@ -311,6 +311,7 @@ fun ChatRoute(
|
|||||||
|
|
||||||
ChatScreen(
|
ChatScreen(
|
||||||
state = state,
|
state = state,
|
||||||
|
actions = ChatScreenActions(
|
||||||
onBack = onBack,
|
onBack = onBack,
|
||||||
onInputChanged = viewModel::onInputChanged,
|
onInputChanged = viewModel::onInputChanged,
|
||||||
onSendClick = viewModel::onSendClick,
|
onSendClick = viewModel::onSendClick,
|
||||||
@@ -405,6 +406,7 @@ fun ChatRoute(
|
|||||||
onKickMember = viewModel::kickMember,
|
onKickMember = viewModel::kickMember,
|
||||||
onTransferOwnership = viewModel::transferOwnership,
|
onTransferOwnership = viewModel::transferOwnership,
|
||||||
onUnbanMember = viewModel::unbanMember,
|
onUnbanMember = viewModel::unbanMember,
|
||||||
|
),
|
||||||
)
|
)
|
||||||
if (showCircleRecorder) {
|
if (showCircleRecorder) {
|
||||||
CircleVideoRecorderDialog(
|
CircleVideoRecorderDialog(
|
||||||
@@ -422,50 +424,93 @@ fun ChatRoute(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private data class ChatScreenActions(
|
||||||
|
val onBack: () -> Unit,
|
||||||
|
val onInputChanged: (String) -> Unit,
|
||||||
|
val onSendClick: () -> Unit,
|
||||||
|
val onSelectMessage: (MessageItem?) -> Unit,
|
||||||
|
val onEnterMultiSelect: (MessageItem) -> Unit,
|
||||||
|
val onToggleMessageMultiSelection: (MessageItem) -> Unit,
|
||||||
|
val onClearSelection: () -> Unit,
|
||||||
|
val onReplySelected: (MessageItem) -> Unit,
|
||||||
|
val onEditSelected: (MessageItem) -> Unit,
|
||||||
|
val onDeleteSelected: (Boolean) -> Unit,
|
||||||
|
val onForwardSelected: () -> Unit,
|
||||||
|
val onForwardDismiss: () -> Unit,
|
||||||
|
val onForwardTargetSelected: (Long) -> Unit,
|
||||||
|
val onToggleReaction: (String) -> Unit,
|
||||||
|
val onCancelComposeAction: () -> Unit,
|
||||||
|
val onLoadMore: () -> Unit,
|
||||||
|
val onPickMedia: () -> Unit,
|
||||||
|
val onCapturePhoto: () -> Unit,
|
||||||
|
val onCaptureVideo: () -> Unit,
|
||||||
|
val onCaptureCircleVideo: () -> Unit,
|
||||||
|
val onSendRemoteMedia: (String, String, ByteArray) -> Unit,
|
||||||
|
val onSendPresetMediaUrl: (String) -> Unit,
|
||||||
|
val onVoiceRecordStart: () -> Unit,
|
||||||
|
val onVoiceRecordTick: () -> Unit,
|
||||||
|
val onVoiceRecordLock: () -> Unit,
|
||||||
|
val onVoiceRecordCancel: () -> Unit,
|
||||||
|
val onVoiceRecordSend: () -> Unit,
|
||||||
|
val onInlineSearchChanged: (String) -> Unit,
|
||||||
|
val onJumpInlineSearch: (Boolean) -> Unit,
|
||||||
|
val onVisibleIncomingMessageId: (Long?) -> Unit,
|
||||||
|
val onToggleChatNotifications: () -> Unit,
|
||||||
|
val onClearHistory: () -> Unit,
|
||||||
|
val onDeleteChat: () -> Unit,
|
||||||
|
val onPromoteMember: (Long) -> Unit,
|
||||||
|
val onDemoteMember: (Long) -> Unit,
|
||||||
|
val onBanMember: (Long) -> Unit,
|
||||||
|
val onKickMember: (Long) -> Unit,
|
||||||
|
val onTransferOwnership: (Long) -> Unit,
|
||||||
|
val onUnbanMember: (Long) -> Unit,
|
||||||
|
)
|
||||||
|
|
||||||
@OptIn(ExperimentalMaterial3Api::class)
|
@OptIn(ExperimentalMaterial3Api::class)
|
||||||
@Composable
|
@Composable
|
||||||
fun ChatScreen(
|
private fun ChatScreen(
|
||||||
state: MessageUiState,
|
state: MessageUiState,
|
||||||
onBack: () -> Unit,
|
actions: ChatScreenActions,
|
||||||
onInputChanged: (String) -> Unit,
|
|
||||||
onSendClick: () -> Unit,
|
|
||||||
onSelectMessage: (MessageItem?) -> Unit,
|
|
||||||
onEnterMultiSelect: (MessageItem) -> Unit,
|
|
||||||
onToggleMessageMultiSelection: (MessageItem) -> Unit,
|
|
||||||
onClearSelection: () -> Unit,
|
|
||||||
onReplySelected: (MessageItem) -> Unit,
|
|
||||||
onEditSelected: (MessageItem) -> Unit,
|
|
||||||
onDeleteSelected: (Boolean) -> Unit,
|
|
||||||
onForwardSelected: () -> Unit,
|
|
||||||
onForwardDismiss: () -> Unit,
|
|
||||||
onForwardTargetSelected: (Long) -> Unit,
|
|
||||||
onToggleReaction: (String) -> Unit,
|
|
||||||
onCancelComposeAction: () -> Unit,
|
|
||||||
onLoadMore: () -> Unit,
|
|
||||||
onPickMedia: () -> Unit,
|
|
||||||
onCapturePhoto: () -> Unit,
|
|
||||||
onCaptureVideo: () -> Unit,
|
|
||||||
onCaptureCircleVideo: () -> Unit,
|
|
||||||
onSendRemoteMedia: (String, String, ByteArray) -> Unit,
|
|
||||||
onSendPresetMediaUrl: (String) -> Unit,
|
|
||||||
onVoiceRecordStart: () -> Unit,
|
|
||||||
onVoiceRecordTick: () -> Unit,
|
|
||||||
onVoiceRecordLock: () -> Unit,
|
|
||||||
onVoiceRecordCancel: () -> Unit,
|
|
||||||
onVoiceRecordSend: () -> Unit,
|
|
||||||
onInlineSearchChanged: (String) -> Unit,
|
|
||||||
onJumpInlineSearch: (Boolean) -> Unit,
|
|
||||||
onVisibleIncomingMessageId: (Long?) -> Unit,
|
|
||||||
onToggleChatNotifications: () -> Unit,
|
|
||||||
onClearHistory: () -> Unit,
|
|
||||||
onDeleteChat: () -> Unit,
|
|
||||||
onPromoteMember: (Long) -> Unit,
|
|
||||||
onDemoteMember: (Long) -> Unit,
|
|
||||||
onBanMember: (Long) -> Unit,
|
|
||||||
onKickMember: (Long) -> Unit,
|
|
||||||
onTransferOwnership: (Long) -> Unit,
|
|
||||||
onUnbanMember: (Long) -> Unit,
|
|
||||||
) {
|
) {
|
||||||
|
val onBack = actions.onBack
|
||||||
|
val onInputChanged = actions.onInputChanged
|
||||||
|
val onSendClick = actions.onSendClick
|
||||||
|
val onSelectMessage = actions.onSelectMessage
|
||||||
|
val onEnterMultiSelect = actions.onEnterMultiSelect
|
||||||
|
val onToggleMessageMultiSelection = actions.onToggleMessageMultiSelection
|
||||||
|
val onClearSelection = actions.onClearSelection
|
||||||
|
val onReplySelected = actions.onReplySelected
|
||||||
|
val onEditSelected = actions.onEditSelected
|
||||||
|
val onDeleteSelected = actions.onDeleteSelected
|
||||||
|
val onForwardSelected = actions.onForwardSelected
|
||||||
|
val onForwardDismiss = actions.onForwardDismiss
|
||||||
|
val onForwardTargetSelected = actions.onForwardTargetSelected
|
||||||
|
val onToggleReaction = actions.onToggleReaction
|
||||||
|
val onCancelComposeAction = actions.onCancelComposeAction
|
||||||
|
val onLoadMore = actions.onLoadMore
|
||||||
|
val onPickMedia = actions.onPickMedia
|
||||||
|
val onCapturePhoto = actions.onCapturePhoto
|
||||||
|
val onCaptureVideo = actions.onCaptureVideo
|
||||||
|
val onCaptureCircleVideo = actions.onCaptureCircleVideo
|
||||||
|
val onSendRemoteMedia = actions.onSendRemoteMedia
|
||||||
|
val onSendPresetMediaUrl = actions.onSendPresetMediaUrl
|
||||||
|
val onVoiceRecordStart = actions.onVoiceRecordStart
|
||||||
|
val onVoiceRecordTick = actions.onVoiceRecordTick
|
||||||
|
val onVoiceRecordLock = actions.onVoiceRecordLock
|
||||||
|
val onVoiceRecordCancel = actions.onVoiceRecordCancel
|
||||||
|
val onVoiceRecordSend = actions.onVoiceRecordSend
|
||||||
|
val onInlineSearchChanged = actions.onInlineSearchChanged
|
||||||
|
val onJumpInlineSearch = actions.onJumpInlineSearch
|
||||||
|
val onVisibleIncomingMessageId = actions.onVisibleIncomingMessageId
|
||||||
|
val onToggleChatNotifications = actions.onToggleChatNotifications
|
||||||
|
val onClearHistory = actions.onClearHistory
|
||||||
|
val onDeleteChat = actions.onDeleteChat
|
||||||
|
val onPromoteMember = actions.onPromoteMember
|
||||||
|
val onDemoteMember = actions.onDemoteMember
|
||||||
|
val onBanMember = actions.onBanMember
|
||||||
|
val onKickMember = actions.onKickMember
|
||||||
|
val onTransferOwnership = actions.onTransferOwnership
|
||||||
|
val onUnbanMember = actions.onUnbanMember
|
||||||
val context = LocalContext.current
|
val context = LocalContext.current
|
||||||
val view = LocalView.current
|
val view = LocalView.current
|
||||||
val listState = rememberLazyListState()
|
val listState = rememberLazyListState()
|
||||||
|
|||||||
Reference in New Issue
Block a user