Lambda parameters in a composable function should be in present tense, not past tense.
https://mrmans0n.github.io/compose-rules/rules/#naming-parameters-properly
This commit is contained in:
parent
0ba5537082
commit
37d9a9f5a9
250 changed files with 1698 additions and 1698 deletions
|
|
@ -139,31 +139,31 @@ class MessagesFlowNode @AssistedInject constructor(
|
|||
return when (navTarget) {
|
||||
is NavTarget.Messages -> {
|
||||
val callback = object : MessagesNode.Callback {
|
||||
override fun onRoomDetailsClicked() {
|
||||
callback?.onRoomDetailsClicked()
|
||||
override fun onRoomDetailsClick() {
|
||||
callback?.onRoomDetailsClick()
|
||||
}
|
||||
|
||||
override fun onEventClicked(event: TimelineItem.Event): Boolean {
|
||||
return processEventClicked(event)
|
||||
override fun onEventClick(event: TimelineItem.Event): Boolean {
|
||||
return processEventClick(event)
|
||||
}
|
||||
|
||||
override fun onPreviewAttachments(attachments: ImmutableList<Attachment>) {
|
||||
backstack.push(NavTarget.AttachmentPreview(attachments.first()))
|
||||
}
|
||||
|
||||
override fun onUserDataClicked(userId: UserId) {
|
||||
callback?.onUserDataClicked(userId)
|
||||
override fun onUserDataClick(userId: UserId) {
|
||||
callback?.onUserDataClick(userId)
|
||||
}
|
||||
|
||||
override fun onPermalinkClicked(data: PermalinkData) {
|
||||
callback?.onPermalinkClicked(data)
|
||||
override fun onPermalinkClick(data: PermalinkData) {
|
||||
callback?.onPermalinkClick(data)
|
||||
}
|
||||
|
||||
override fun onShowEventDebugInfoClicked(eventId: EventId?, debugInfo: TimelineItemDebugInfo) {
|
||||
override fun onShowEventDebugInfoClick(eventId: EventId?, debugInfo: TimelineItemDebugInfo) {
|
||||
backstack.push(NavTarget.EventDebugInfo(eventId, debugInfo))
|
||||
}
|
||||
|
||||
override fun onForwardEventClicked(eventId: EventId) {
|
||||
override fun onForwardEventClick(eventId: EventId) {
|
||||
backstack.push(NavTarget.ForwardEvent(eventId))
|
||||
}
|
||||
|
||||
|
|
@ -171,19 +171,19 @@ class MessagesFlowNode @AssistedInject constructor(
|
|||
backstack.push(NavTarget.ReportMessage(eventId, senderId))
|
||||
}
|
||||
|
||||
override fun onSendLocationClicked() {
|
||||
override fun onSendLocationClick() {
|
||||
backstack.push(NavTarget.SendLocation)
|
||||
}
|
||||
|
||||
override fun onCreatePollClicked() {
|
||||
override fun onCreatePollClick() {
|
||||
backstack.push(NavTarget.CreatePoll)
|
||||
}
|
||||
|
||||
override fun onEditPollClicked(eventId: EventId) {
|
||||
override fun onEditPollClick(eventId: EventId) {
|
||||
backstack.push(NavTarget.EditPoll(eventId))
|
||||
}
|
||||
|
||||
override fun onJoinCallClicked(roomId: RoomId) {
|
||||
override fun onJoinCallClick(roomId: RoomId) {
|
||||
val inputs = CallType.RoomCall(
|
||||
sessionId = matrixClient.sessionId,
|
||||
roomId = roomId,
|
||||
|
|
@ -250,7 +250,7 @@ class MessagesFlowNode @AssistedInject constructor(
|
|||
}
|
||||
}
|
||||
|
||||
private fun processEventClicked(event: TimelineItem.Event): Boolean {
|
||||
private fun processEventClick(event: TimelineItem.Event): Boolean {
|
||||
return when (event.content) {
|
||||
is TimelineItemImageContent -> {
|
||||
val navTarget = NavTarget.MediaViewer(
|
||||
|
|
|
|||
|
|
@ -21,8 +21,8 @@ import io.element.android.libraries.matrix.api.core.UserId
|
|||
import io.element.android.libraries.matrix.api.timeline.item.TimelineItemDebugInfo
|
||||
|
||||
interface MessagesNavigator {
|
||||
fun onShowEventDebugInfoClicked(eventId: EventId?, debugInfo: TimelineItemDebugInfo)
|
||||
fun onForwardEventClicked(eventId: EventId)
|
||||
fun onReportContentClicked(eventId: EventId, senderId: UserId)
|
||||
fun onEditPollClicked(eventId: EventId)
|
||||
fun onShowEventDebugInfoClick(eventId: EventId?, debugInfo: TimelineItemDebugInfo)
|
||||
fun onForwardEventClick(eventId: EventId)
|
||||
fun onReportContentClick(eventId: EventId, senderId: UserId)
|
||||
fun onEditPollClick(eventId: EventId)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -82,18 +82,18 @@ class MessagesNode @AssistedInject constructor(
|
|||
private val inputs = inputs<Inputs>()
|
||||
|
||||
interface Callback : Plugin {
|
||||
fun onRoomDetailsClicked()
|
||||
fun onEventClicked(event: TimelineItem.Event): Boolean
|
||||
fun onRoomDetailsClick()
|
||||
fun onEventClick(event: TimelineItem.Event): Boolean
|
||||
fun onPreviewAttachments(attachments: ImmutableList<Attachment>)
|
||||
fun onUserDataClicked(userId: UserId)
|
||||
fun onPermalinkClicked(data: PermalinkData)
|
||||
fun onShowEventDebugInfoClicked(eventId: EventId?, debugInfo: TimelineItemDebugInfo)
|
||||
fun onForwardEventClicked(eventId: EventId)
|
||||
fun onUserDataClick(userId: UserId)
|
||||
fun onPermalinkClick(data: PermalinkData)
|
||||
fun onShowEventDebugInfoClick(eventId: EventId?, debugInfo: TimelineItemDebugInfo)
|
||||
fun onForwardEventClick(eventId: EventId)
|
||||
fun onReportMessage(eventId: EventId, senderId: UserId)
|
||||
fun onSendLocationClicked()
|
||||
fun onCreatePollClicked()
|
||||
fun onEditPollClicked(eventId: EventId)
|
||||
fun onJoinCallClicked(roomId: RoomId)
|
||||
fun onSendLocationClick()
|
||||
fun onCreatePollClick()
|
||||
fun onEditPollClick(eventId: EventId)
|
||||
fun onJoinCallClick(roomId: RoomId)
|
||||
}
|
||||
|
||||
override fun onBuilt() {
|
||||
|
|
@ -109,23 +109,23 @@ class MessagesNode @AssistedInject constructor(
|
|||
)
|
||||
}
|
||||
|
||||
private fun onRoomDetailsClicked() {
|
||||
callback?.onRoomDetailsClicked()
|
||||
private fun onRoomDetailsClick() {
|
||||
callback?.onRoomDetailsClick()
|
||||
}
|
||||
|
||||
private fun onEventClicked(event: TimelineItem.Event): Boolean {
|
||||
return callback?.onEventClicked(event).orFalse()
|
||||
private fun onEventClick(event: TimelineItem.Event): Boolean {
|
||||
return callback?.onEventClick(event).orFalse()
|
||||
}
|
||||
|
||||
private fun onPreviewAttachments(attachments: ImmutableList<Attachment>) {
|
||||
callback?.onPreviewAttachments(attachments)
|
||||
}
|
||||
|
||||
private fun onUserDataClicked(userId: UserId) {
|
||||
callback?.onUserDataClicked(userId)
|
||||
private fun onUserDataClick(userId: UserId) {
|
||||
callback?.onUserDataClick(userId)
|
||||
}
|
||||
|
||||
private fun onLinkClicked(
|
||||
private fun onLinkClick(
|
||||
context: Context,
|
||||
url: String,
|
||||
eventSink: (TimelineEvents) -> Unit,
|
||||
|
|
@ -134,10 +134,10 @@ class MessagesNode @AssistedInject constructor(
|
|||
is PermalinkData.UserLink -> {
|
||||
// Open the room member profile, it will fallback to
|
||||
// the user profile if the user is not in the room
|
||||
callback?.onUserDataClicked(permalink.userId)
|
||||
callback?.onUserDataClick(permalink.userId)
|
||||
}
|
||||
is PermalinkData.RoomLink -> {
|
||||
handleRoomLinkClicked(permalink, eventSink)
|
||||
handleRoomLinkClick(permalink, eventSink)
|
||||
}
|
||||
is PermalinkData.FallbackLink,
|
||||
is PermalinkData.RoomEmailInviteLink -> {
|
||||
|
|
@ -146,7 +146,7 @@ class MessagesNode @AssistedInject constructor(
|
|||
}
|
||||
}
|
||||
|
||||
private fun handleRoomLinkClicked(roomLink: PermalinkData.RoomLink, eventSink: (TimelineEvents) -> Unit) {
|
||||
private fun handleRoomLinkClick(roomLink: PermalinkData.RoomLink, eventSink: (TimelineEvents) -> Unit) {
|
||||
if (room.matches(roomLink.roomIdOrAlias)) {
|
||||
val eventId = roomLink.eventId
|
||||
if (eventId != null) {
|
||||
|
|
@ -156,36 +156,36 @@ class MessagesNode @AssistedInject constructor(
|
|||
context.toast("Already viewing this room!")
|
||||
}
|
||||
} else {
|
||||
callback?.onPermalinkClicked(roomLink)
|
||||
callback?.onPermalinkClick(roomLink)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onShowEventDebugInfoClicked(eventId: EventId?, debugInfo: TimelineItemDebugInfo) {
|
||||
callback?.onShowEventDebugInfoClicked(eventId, debugInfo)
|
||||
override fun onShowEventDebugInfoClick(eventId: EventId?, debugInfo: TimelineItemDebugInfo) {
|
||||
callback?.onShowEventDebugInfoClick(eventId, debugInfo)
|
||||
}
|
||||
|
||||
override fun onForwardEventClicked(eventId: EventId) {
|
||||
callback?.onForwardEventClicked(eventId)
|
||||
override fun onForwardEventClick(eventId: EventId) {
|
||||
callback?.onForwardEventClick(eventId)
|
||||
}
|
||||
|
||||
override fun onReportContentClicked(eventId: EventId, senderId: UserId) {
|
||||
override fun onReportContentClick(eventId: EventId, senderId: UserId) {
|
||||
callback?.onReportMessage(eventId, senderId)
|
||||
}
|
||||
|
||||
override fun onEditPollClicked(eventId: EventId) {
|
||||
callback?.onEditPollClicked(eventId)
|
||||
override fun onEditPollClick(eventId: EventId) {
|
||||
callback?.onEditPollClick(eventId)
|
||||
}
|
||||
|
||||
private fun onSendLocationClicked() {
|
||||
callback?.onSendLocationClicked()
|
||||
private fun onSendLocationClick() {
|
||||
callback?.onSendLocationClick()
|
||||
}
|
||||
|
||||
private fun onCreatePollClicked() {
|
||||
callback?.onCreatePollClicked()
|
||||
private fun onCreatePollClick() {
|
||||
callback?.onCreatePollClick()
|
||||
}
|
||||
|
||||
private fun onJoinCallClicked() {
|
||||
callback?.onJoinCallClicked(room.roomId)
|
||||
private fun onJoinCallClick() {
|
||||
callback?.onJoinCallClick(room.roomId)
|
||||
}
|
||||
|
||||
@Composable
|
||||
|
|
@ -197,15 +197,15 @@ class MessagesNode @AssistedInject constructor(
|
|||
val state = presenter.present()
|
||||
MessagesView(
|
||||
state = state,
|
||||
onBackPressed = this::navigateUp,
|
||||
onRoomDetailsClicked = this::onRoomDetailsClicked,
|
||||
onEventClicked = this::onEventClicked,
|
||||
onBackClick = this::navigateUp,
|
||||
onRoomDetailsClick = this::onRoomDetailsClick,
|
||||
onEventClick = this::onEventClick,
|
||||
onPreviewAttachments = this::onPreviewAttachments,
|
||||
onUserDataClicked = this::onUserDataClicked,
|
||||
onLinkClicked = { onLinkClicked(context, it, state.timelineState.eventSink) },
|
||||
onSendLocationClicked = this::onSendLocationClicked,
|
||||
onCreatePollClicked = this::onCreatePollClicked,
|
||||
onJoinCallClicked = this::onJoinCallClicked,
|
||||
onUserDataClick = this::onUserDataClick,
|
||||
onLinkClick = { onLinkClick(context, it, state.timelineState.eventSink) },
|
||||
onSendLocationClick = this::onSendLocationClick,
|
||||
onCreatePollClick = this::onCreatePollClick,
|
||||
onJoinCallClick = this::onJoinCallClick,
|
||||
modifier = modifier,
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -324,7 +324,7 @@ class MessagesPresenter @AssistedInject constructor(
|
|||
when (targetEvent.content) {
|
||||
is TimelineItemPollContent -> {
|
||||
if (targetEvent.eventId == null) return
|
||||
navigator.onEditPollClicked(targetEvent.eventId)
|
||||
navigator.onEditPollClick(targetEvent.eventId)
|
||||
}
|
||||
else -> {
|
||||
val composerMode = MessageComposerMode.Edit(
|
||||
|
|
@ -407,17 +407,17 @@ class MessagesPresenter @AssistedInject constructor(
|
|||
}
|
||||
|
||||
private fun handleShowDebugInfoAction(event: TimelineItem.Event) {
|
||||
navigator.onShowEventDebugInfoClicked(event.eventId, event.debugInfo)
|
||||
navigator.onShowEventDebugInfoClick(event.eventId, event.debugInfo)
|
||||
}
|
||||
|
||||
private fun handleForwardAction(event: TimelineItem.Event) {
|
||||
if (event.eventId == null) return
|
||||
navigator.onForwardEventClicked(event.eventId)
|
||||
navigator.onForwardEventClick(event.eventId)
|
||||
}
|
||||
|
||||
private fun handleReportAction(event: TimelineItem.Event) {
|
||||
if (event.eventId == null) return
|
||||
navigator.onReportContentClicked(event.eventId, event.senderId)
|
||||
navigator.onReportContentClick(event.eventId, event.senderId)
|
||||
}
|
||||
|
||||
private fun handleEndPollAction(
|
||||
|
|
|
|||
|
|
@ -115,15 +115,15 @@ import androidx.compose.material3.Button as Material3Button
|
|||
@Composable
|
||||
fun MessagesView(
|
||||
state: MessagesState,
|
||||
onBackPressed: () -> Unit,
|
||||
onRoomDetailsClicked: () -> Unit,
|
||||
onEventClicked: (event: TimelineItem.Event) -> Boolean,
|
||||
onUserDataClicked: (UserId) -> Unit,
|
||||
onLinkClicked: (String) -> Unit,
|
||||
onBackClick: () -> Unit,
|
||||
onRoomDetailsClick: () -> Unit,
|
||||
onEventClick: (event: TimelineItem.Event) -> Boolean,
|
||||
onUserDataClick: (UserId) -> Unit,
|
||||
onLinkClick: (String) -> Unit,
|
||||
onPreviewAttachments: (ImmutableList<Attachment>) -> Unit,
|
||||
onSendLocationClicked: () -> Unit,
|
||||
onCreatePollClicked: () -> Unit,
|
||||
onJoinCallClicked: () -> Unit,
|
||||
onSendLocationClick: () -> Unit,
|
||||
onCreatePollClick: () -> Unit,
|
||||
onJoinCallClick: () -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
forceJumpToBottomVisibility: Boolean = false
|
||||
) {
|
||||
|
|
@ -144,15 +144,15 @@ fun MessagesView(
|
|||
// This is needed because the composer is inside an AndroidView that can't be affected by the FocusManager in Compose
|
||||
val localView = LocalView.current
|
||||
|
||||
fun onMessageClicked(event: TimelineItem.Event) {
|
||||
Timber.v("OnMessageClicked= ${event.id}")
|
||||
val hideKeyboard = onEventClicked(event)
|
||||
fun onMessageClick(event: TimelineItem.Event) {
|
||||
Timber.v("onMessageClick= ${event.id}")
|
||||
val hideKeyboard = onEventClick(event)
|
||||
if (hideKeyboard) {
|
||||
localView.hideKeyboard()
|
||||
}
|
||||
}
|
||||
|
||||
fun onMessageLongClicked(event: TimelineItem.Event) {
|
||||
fun onMessageLongClick(event: TimelineItem.Event) {
|
||||
Timber.v("OnMessageLongClicked= ${event.id}")
|
||||
localView.hideKeyboard()
|
||||
state.actionListState.eventSink(
|
||||
|
|
@ -170,17 +170,17 @@ fun MessagesView(
|
|||
state.eventSink(MessagesEvents.HandleAction(action, event))
|
||||
}
|
||||
|
||||
fun onEmojiReactionClicked(emoji: String, event: TimelineItem.Event) {
|
||||
fun onEmojiReactionClick(emoji: String, event: TimelineItem.Event) {
|
||||
if (event.eventId == null) return
|
||||
state.eventSink(MessagesEvents.ToggleReaction(emoji, event.eventId))
|
||||
}
|
||||
|
||||
fun onEmojiReactionLongClicked(emoji: String, event: TimelineItem.Event) {
|
||||
fun onEmojiReactionLongClick(emoji: String, event: TimelineItem.Event) {
|
||||
if (event.eventId == null) return
|
||||
state.reactionSummaryState.eventSink(ReactionSummaryEvents.ShowReactionSummary(event.eventId, event.reactionsState.reactions, emoji))
|
||||
}
|
||||
|
||||
fun onMoreReactionsClicked(event: TimelineItem.Event) {
|
||||
fun onMoreReactionsClick(event: TimelineItem.Event) {
|
||||
state.customReactionState.eventSink(CustomReactionEvents.ShowCustomReactionSheet(event))
|
||||
}
|
||||
|
||||
|
|
@ -194,14 +194,14 @@ fun MessagesView(
|
|||
roomName = state.roomName.dataOrNull(),
|
||||
roomAvatar = state.roomAvatar.dataOrNull(),
|
||||
callState = state.callState,
|
||||
onBackPressed = {
|
||||
onBackClick = {
|
||||
// Since the textfield is now based on an Android view, this is no longer done automatically.
|
||||
// We need to hide the keyboard when navigating out of this screen.
|
||||
localView.hideKeyboard()
|
||||
onBackPressed()
|
||||
onBackClick()
|
||||
},
|
||||
onRoomDetailsClicked = onRoomDetailsClicked,
|
||||
onJoinCallClicked = onJoinCallClicked,
|
||||
onRoomDetailsClick = onRoomDetailsClick,
|
||||
onJoinCallClick = onJoinCallClick,
|
||||
)
|
||||
}
|
||||
},
|
||||
|
|
@ -211,23 +211,23 @@ fun MessagesView(
|
|||
modifier = Modifier
|
||||
.padding(padding)
|
||||
.consumeWindowInsets(padding),
|
||||
onMessageClicked = ::onMessageClicked,
|
||||
onMessageLongClicked = ::onMessageLongClicked,
|
||||
onUserDataClicked = onUserDataClicked,
|
||||
onLinkClicked = onLinkClicked,
|
||||
onTimestampClicked = { event ->
|
||||
onMessageClick = ::onMessageClick,
|
||||
onMessageLongClick = ::onMessageLongClick,
|
||||
onUserDataClick = onUserDataClick,
|
||||
onLinkClick = onLinkClick,
|
||||
onTimestampClick = { event ->
|
||||
if (event.localSendState is LocalEventSendState.SendingFailed) {
|
||||
state.retrySendMenuState.eventSink(RetrySendMenuEvents.EventSelected(event))
|
||||
}
|
||||
},
|
||||
onReactionClicked = ::onEmojiReactionClicked,
|
||||
onReactionLongClicked = ::onEmojiReactionLongClicked,
|
||||
onMoreReactionsClicked = ::onMoreReactionsClicked,
|
||||
onReactionClick = ::onEmojiReactionClick,
|
||||
onReactionLongClick = ::onEmojiReactionLongClick,
|
||||
onMoreReactionsClick = ::onMoreReactionsClick,
|
||||
onReadReceiptClick = { event ->
|
||||
state.readReceiptBottomSheetState.eventSink(ReadReceiptBottomSheetEvents.EventSelected(event))
|
||||
},
|
||||
onSendLocationClicked = onSendLocationClicked,
|
||||
onCreatePollClicked = onCreatePollClicked,
|
||||
onSendLocationClick = onSendLocationClick,
|
||||
onCreatePollClick = onCreatePollClick,
|
||||
onSwipeToReply = { targetEvent ->
|
||||
state.eventSink(MessagesEvents.HandleAction(TimelineItemAction.Reply, targetEvent))
|
||||
},
|
||||
|
|
@ -244,17 +244,17 @@ fun MessagesView(
|
|||
|
||||
ActionListView(
|
||||
state = state.actionListState,
|
||||
onActionSelected = ::onActionSelected,
|
||||
onCustomReactionClicked = { event ->
|
||||
onSelectAction = ::onActionSelected,
|
||||
onCustomReactionClick = { event ->
|
||||
if (event.eventId == null) return@ActionListView
|
||||
state.customReactionState.eventSink(CustomReactionEvents.ShowCustomReactionSheet(event))
|
||||
},
|
||||
onEmojiReactionClicked = ::onEmojiReactionClicked,
|
||||
onEmojiReactionClick = ::onEmojiReactionClick,
|
||||
)
|
||||
|
||||
CustomReactionBottomSheet(
|
||||
state = state.customReactionState,
|
||||
onEmojiSelected = { eventId, emoji ->
|
||||
onSelectEmoji = { eventId, emoji ->
|
||||
state.eventSink(MessagesEvents.ToggleReaction(emoji.unicode, eventId))
|
||||
}
|
||||
)
|
||||
|
|
@ -263,7 +263,7 @@ fun MessagesView(
|
|||
RetrySendMessageMenu(state = state.retrySendMenuState)
|
||||
ReadReceiptBottomSheet(
|
||||
state = state.readReceiptBottomSheetState,
|
||||
onUserDataClicked = onUserDataClicked,
|
||||
onUserDataClick = onUserDataClick,
|
||||
)
|
||||
ReinviteDialog(state = state)
|
||||
}
|
||||
|
|
@ -276,7 +276,7 @@ private fun ReinviteDialog(state: MessagesState) {
|
|||
content = stringResource(id = R.string.screen_room_invite_again_alert_message),
|
||||
cancelText = stringResource(id = CommonStrings.action_cancel),
|
||||
submitText = stringResource(id = CommonStrings.action_invite),
|
||||
onSubmitClicked = { state.eventSink(MessagesEvents.InviteDialogDismissed(InviteDialogAction.Invite)) },
|
||||
onSubmitClick = { state.eventSink(MessagesEvents.InviteDialogDismissed(InviteDialogAction.Invite)) },
|
||||
onDismiss = { state.eventSink(MessagesEvents.InviteDialogDismissed(InviteDialogAction.Cancel)) }
|
||||
)
|
||||
}
|
||||
|
|
@ -313,17 +313,17 @@ private fun AttachmentStateView(
|
|||
@Composable
|
||||
private fun MessagesViewContent(
|
||||
state: MessagesState,
|
||||
onMessageClicked: (TimelineItem.Event) -> Unit,
|
||||
onUserDataClicked: (UserId) -> Unit,
|
||||
onLinkClicked: (String) -> Unit,
|
||||
onReactionClicked: (key: String, TimelineItem.Event) -> Unit,
|
||||
onReactionLongClicked: (key: String, TimelineItem.Event) -> Unit,
|
||||
onMoreReactionsClicked: (TimelineItem.Event) -> Unit,
|
||||
onMessageClick: (TimelineItem.Event) -> Unit,
|
||||
onUserDataClick: (UserId) -> Unit,
|
||||
onLinkClick: (String) -> Unit,
|
||||
onReactionClick: (key: String, TimelineItem.Event) -> Unit,
|
||||
onReactionLongClick: (key: String, TimelineItem.Event) -> Unit,
|
||||
onMoreReactionsClick: (TimelineItem.Event) -> Unit,
|
||||
onReadReceiptClick: (TimelineItem.Event) -> Unit,
|
||||
onMessageLongClicked: (TimelineItem.Event) -> Unit,
|
||||
onTimestampClicked: (TimelineItem.Event) -> Unit,
|
||||
onSendLocationClicked: () -> Unit,
|
||||
onCreatePollClicked: () -> Unit,
|
||||
onMessageLongClick: (TimelineItem.Event) -> Unit,
|
||||
onTimestampClick: (TimelineItem.Event) -> Unit,
|
||||
onSendLocationClick: () -> Unit,
|
||||
onCreatePollClick: () -> Unit,
|
||||
forceJumpToBottomVisibility: Boolean,
|
||||
modifier: Modifier = Modifier,
|
||||
onSwipeToReply: (TimelineItem.Event) -> Unit,
|
||||
|
|
@ -336,8 +336,8 @@ private fun MessagesViewContent(
|
|||
) {
|
||||
AttachmentsBottomSheet(
|
||||
state = state.composerState,
|
||||
onSendLocationClicked = onSendLocationClicked,
|
||||
onCreatePollClicked = onCreatePollClicked,
|
||||
onSendLocationClick = onSendLocationClick,
|
||||
onCreatePollClick = onCreatePollClick,
|
||||
enableTextFormatting = state.enableTextFormatting,
|
||||
)
|
||||
|
||||
|
|
@ -384,15 +384,15 @@ private fun MessagesViewContent(
|
|||
TimelineView(
|
||||
state = state.timelineState,
|
||||
typingNotificationState = state.typingNotificationState,
|
||||
onUserDataClicked = onUserDataClicked,
|
||||
onLinkClicked = onLinkClicked,
|
||||
onMessageClicked = onMessageClicked,
|
||||
onMessageLongClicked = onMessageLongClicked,
|
||||
onTimestampClicked = onTimestampClicked,
|
||||
onUserDataClick = onUserDataClick,
|
||||
onLinkClick = onLinkClick,
|
||||
onMessageClick = onMessageClick,
|
||||
onMessageLongClick = onMessageLongClick,
|
||||
onTimestampClick = onTimestampClick,
|
||||
onSwipeToReply = onSwipeToReply,
|
||||
onReactionClicked = onReactionClicked,
|
||||
onReactionLongClicked = onReactionLongClicked,
|
||||
onMoreReactionsClicked = onMoreReactionsClicked,
|
||||
onReactionClick = onReactionClick,
|
||||
onReactionLongClick = onReactionLongClick,
|
||||
onMoreReactionsClick = onMoreReactionsClick,
|
||||
onReadReceiptClick = onReadReceiptClick,
|
||||
modifier = Modifier.padding(paddingValues),
|
||||
forceJumpToBottomVisibility = forceJumpToBottomVisibility,
|
||||
|
|
@ -431,7 +431,7 @@ private fun MessagesViewComposerBottomSheetContents(
|
|||
roomName = state.roomName.dataOrNull(),
|
||||
roomAvatarData = state.roomAvatar.dataOrNull(),
|
||||
memberSuggestions = state.composerState.memberSuggestions,
|
||||
onSuggestionSelected = {
|
||||
onSelectSuggestion = {
|
||||
state.composerState.eventSink(MessageComposerEvents.InsertMention(it))
|
||||
}
|
||||
)
|
||||
|
|
@ -454,16 +454,16 @@ private fun MessagesViewTopBar(
|
|||
roomName: String?,
|
||||
roomAvatar: AvatarData?,
|
||||
callState: RoomCallState,
|
||||
onRoomDetailsClicked: () -> Unit,
|
||||
onJoinCallClicked: () -> Unit,
|
||||
onBackPressed: () -> Unit,
|
||||
onRoomDetailsClick: () -> Unit,
|
||||
onJoinCallClick: () -> Unit,
|
||||
onBackClick: () -> Unit,
|
||||
) {
|
||||
TopAppBar(
|
||||
navigationIcon = {
|
||||
BackButton(onClick = onBackPressed)
|
||||
BackButton(onClick = onBackClick)
|
||||
},
|
||||
title = {
|
||||
val titleModifier = Modifier.clickable { onRoomDetailsClicked() }
|
||||
val titleModifier = Modifier.clickable { onRoomDetailsClick() }
|
||||
if (roomName != null && roomAvatar != null) {
|
||||
RoomAvatarAndNameRow(
|
||||
roomName = roomName,
|
||||
|
|
@ -479,9 +479,9 @@ private fun MessagesViewTopBar(
|
|||
},
|
||||
actions = {
|
||||
if (callState == RoomCallState.ONGOING) {
|
||||
JoinCallMenuItem(onJoinCallClicked = onJoinCallClicked)
|
||||
JoinCallMenuItem(onJoinCallClick = onJoinCallClick)
|
||||
} else {
|
||||
IconButton(onClick = onJoinCallClicked, enabled = callState != RoomCallState.DISABLED) {
|
||||
IconButton(onClick = onJoinCallClick, enabled = callState != RoomCallState.DISABLED) {
|
||||
Icon(
|
||||
imageVector = CompoundIcons.VideoCallSolid(),
|
||||
contentDescription = stringResource(CommonStrings.a11y_start_call),
|
||||
|
|
@ -496,10 +496,10 @@ private fun MessagesViewTopBar(
|
|||
|
||||
@Composable
|
||||
private fun JoinCallMenuItem(
|
||||
onJoinCallClicked: () -> Unit,
|
||||
onJoinCallClick: () -> Unit,
|
||||
) {
|
||||
Material3Button(
|
||||
onClick = onJoinCallClicked,
|
||||
onClick = onJoinCallClick,
|
||||
colors = ButtonDefaults.buttonColors(
|
||||
contentColor = ElementTheme.colors.bgCanvasDefault,
|
||||
containerColor = ElementTheme.colors.iconAccentTertiary
|
||||
|
|
@ -567,15 +567,15 @@ private fun CantSendMessageBanner() {
|
|||
internal fun MessagesViewPreview(@PreviewParameter(MessagesStateProvider::class) state: MessagesState) = ElementPreview {
|
||||
MessagesView(
|
||||
state = state,
|
||||
onBackPressed = {},
|
||||
onRoomDetailsClicked = {},
|
||||
onEventClicked = { false },
|
||||
onBackClick = {},
|
||||
onRoomDetailsClick = {},
|
||||
onEventClick = { false },
|
||||
onPreviewAttachments = {},
|
||||
onUserDataClicked = {},
|
||||
onLinkClicked = {},
|
||||
onSendLocationClicked = {},
|
||||
onCreatePollClicked = {},
|
||||
onJoinCallClicked = {},
|
||||
onUserDataClick = {},
|
||||
onLinkClick = {},
|
||||
onSendLocationClick = {},
|
||||
onCreatePollClick = {},
|
||||
onJoinCallClick = {},
|
||||
forceJumpToBottomVisibility = true,
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -94,38 +94,38 @@ import kotlinx.collections.immutable.ImmutableList
|
|||
@Composable
|
||||
fun ActionListView(
|
||||
state: ActionListState,
|
||||
onActionSelected: (action: TimelineItemAction, TimelineItem.Event) -> Unit,
|
||||
onEmojiReactionClicked: (String, TimelineItem.Event) -> Unit,
|
||||
onCustomReactionClicked: (TimelineItem.Event) -> Unit,
|
||||
onSelectAction: (action: TimelineItemAction, TimelineItem.Event) -> Unit,
|
||||
onEmojiReactionClick: (String, TimelineItem.Event) -> Unit,
|
||||
onCustomReactionClick: (TimelineItem.Event) -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
val sheetState = rememberModalBottomSheetState()
|
||||
val coroutineScope = rememberCoroutineScope()
|
||||
val targetItem = (state.target as? ActionListState.Target.Success)?.event
|
||||
|
||||
fun onItemActionClicked(
|
||||
fun onItemActionClick(
|
||||
itemAction: TimelineItemAction
|
||||
) {
|
||||
if (targetItem == null) return
|
||||
sheetState.hide(coroutineScope) {
|
||||
state.eventSink(ActionListEvents.Clear)
|
||||
onActionSelected(itemAction, targetItem)
|
||||
onSelectAction(itemAction, targetItem)
|
||||
}
|
||||
}
|
||||
|
||||
fun onEmojiReactionClicked(emoji: String) {
|
||||
fun onEmojiReactionClick(emoji: String) {
|
||||
if (targetItem == null) return
|
||||
sheetState.hide(coroutineScope) {
|
||||
state.eventSink(ActionListEvents.Clear)
|
||||
onEmojiReactionClicked(emoji, targetItem)
|
||||
onEmojiReactionClick(emoji, targetItem)
|
||||
}
|
||||
}
|
||||
|
||||
fun onCustomReactionClicked() {
|
||||
fun onCustomReactionClick() {
|
||||
if (targetItem == null) return
|
||||
sheetState.hide(coroutineScope) {
|
||||
state.eventSink(ActionListEvents.Clear)
|
||||
onCustomReactionClicked(targetItem)
|
||||
onCustomReactionClick(targetItem)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -141,9 +141,9 @@ fun ActionListView(
|
|||
) {
|
||||
SheetContent(
|
||||
state = state,
|
||||
onActionClicked = ::onItemActionClicked,
|
||||
onEmojiReactionClicked = ::onEmojiReactionClicked,
|
||||
onCustomReactionClicked = ::onCustomReactionClicked,
|
||||
onActionClick = ::onItemActionClick,
|
||||
onEmojiReactionClick = ::onEmojiReactionClick,
|
||||
onCustomReactionClick = ::onCustomReactionClick,
|
||||
modifier = Modifier
|
||||
.navigationBarsPadding()
|
||||
.imePadding()
|
||||
|
|
@ -155,9 +155,9 @@ fun ActionListView(
|
|||
@Composable
|
||||
private fun SheetContent(
|
||||
state: ActionListState,
|
||||
onActionClicked: (TimelineItemAction) -> Unit,
|
||||
onEmojiReactionClicked: (String) -> Unit,
|
||||
onCustomReactionClicked: () -> Unit,
|
||||
onActionClick: (TimelineItemAction) -> Unit,
|
||||
onEmojiReactionClick: (String) -> Unit,
|
||||
onCustomReactionClick: () -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
when (val target = state.target) {
|
||||
|
|
@ -188,8 +188,8 @@ private fun SheetContent(
|
|||
item {
|
||||
EmojiReactionsRow(
|
||||
highlightedEmojis = target.event.reactionsState.highlightedKeys,
|
||||
onEmojiReactionClicked = onEmojiReactionClicked,
|
||||
onCustomReactionClicked = onCustomReactionClicked,
|
||||
onEmojiReactionClick = onEmojiReactionClick,
|
||||
onCustomReactionClick = onCustomReactionClick,
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
)
|
||||
HorizontalDivider()
|
||||
|
|
@ -200,7 +200,7 @@ private fun SheetContent(
|
|||
) { action ->
|
||||
ListItem(
|
||||
modifier = Modifier.clickable {
|
||||
onActionClicked(action)
|
||||
onActionClick(action)
|
||||
},
|
||||
headlineContent = {
|
||||
Text(text = stringResource(id = action.titleRes))
|
||||
|
|
@ -292,8 +292,8 @@ private val emojiRippleRadius = 24.dp
|
|||
@Composable
|
||||
private fun EmojiReactionsRow(
|
||||
highlightedEmojis: ImmutableList<String>,
|
||||
onEmojiReactionClicked: (String) -> Unit,
|
||||
onCustomReactionClicked: () -> Unit,
|
||||
onEmojiReactionClick: (String) -> Unit,
|
||||
onCustomReactionClick: () -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
Row(
|
||||
|
|
@ -310,7 +310,7 @@ private fun EmojiReactionsRow(
|
|||
)
|
||||
for (emoji in defaultEmojis) {
|
||||
val isHighlighted = highlightedEmojis.contains(emoji)
|
||||
EmojiButton(emoji, isHighlighted, onEmojiReactionClicked)
|
||||
EmojiButton(emoji, isHighlighted, onEmojiReactionClick)
|
||||
}
|
||||
Box(
|
||||
modifier = Modifier
|
||||
|
|
@ -325,7 +325,7 @@ private fun EmojiReactionsRow(
|
|||
.size(24.dp)
|
||||
.clickable(
|
||||
enabled = true,
|
||||
onClick = onCustomReactionClicked,
|
||||
onClick = onCustomReactionClick,
|
||||
indication = rememberRipple(bounded = false, radius = emojiRippleRadius),
|
||||
interactionSource = remember { MutableInteractionSource() }
|
||||
)
|
||||
|
|
@ -338,7 +338,7 @@ private fun EmojiReactionsRow(
|
|||
private fun EmojiButton(
|
||||
emoji: String,
|
||||
isHighlighted: Boolean,
|
||||
onClicked: (String) -> Unit,
|
||||
onClick: (String) -> Unit,
|
||||
) {
|
||||
val backgroundColor = if (isHighlighted) {
|
||||
ElementTheme.colors.bgActionPrimaryRest
|
||||
|
|
@ -365,7 +365,7 @@ private fun EmojiButton(
|
|||
modifier = Modifier
|
||||
.clickable(
|
||||
enabled = true,
|
||||
onClick = { onClicked(emoji) },
|
||||
onClick = { onClick(emoji) },
|
||||
indication = rememberRipple(bounded = false, radius = emojiRippleRadius),
|
||||
interactionSource = remember { MutableInteractionSource() }
|
||||
)
|
||||
|
|
@ -380,8 +380,8 @@ internal fun SheetContentPreview(
|
|||
) = ElementPreview {
|
||||
SheetContent(
|
||||
state = state,
|
||||
onActionClicked = {},
|
||||
onEmojiReactionClicked = {},
|
||||
onCustomReactionClicked = {},
|
||||
onActionClick = {},
|
||||
onEmojiReactionClick = {},
|
||||
onCustomReactionClick = {},
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -73,22 +73,22 @@ fun AttachmentsPreviewView(
|
|||
Scaffold(modifier) {
|
||||
AttachmentPreviewContent(
|
||||
attachment = state.attachment,
|
||||
onSendClicked = ::postSendAttachment,
|
||||
onSendClick = ::postSendAttachment,
|
||||
onDismiss = onDismiss
|
||||
)
|
||||
}
|
||||
AttachmentSendStateView(
|
||||
sendActionState = state.sendActionState,
|
||||
onDismissClicked = ::postClearSendState,
|
||||
onRetryClicked = ::postSendAttachment
|
||||
onDismissClick = ::postClearSendState,
|
||||
onRetryClick = ::postSendAttachment
|
||||
)
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun AttachmentSendStateView(
|
||||
sendActionState: SendActionState,
|
||||
onDismissClicked: () -> Unit,
|
||||
onRetryClicked: () -> Unit
|
||||
onDismissClick: () -> Unit,
|
||||
onRetryClick: () -> Unit
|
||||
) {
|
||||
when (sendActionState) {
|
||||
is SendActionState.Sending -> {
|
||||
|
|
@ -99,14 +99,14 @@ private fun AttachmentSendStateView(
|
|||
},
|
||||
text = stringResource(id = CommonStrings.common_sending),
|
||||
isCancellable = true,
|
||||
onDismissRequest = onDismissClicked,
|
||||
onDismissRequest = onDismissClick,
|
||||
)
|
||||
}
|
||||
is SendActionState.Failure -> {
|
||||
RetryDialog(
|
||||
content = stringResource(sendAttachmentError(sendActionState.error)),
|
||||
onDismiss = onDismissClicked,
|
||||
onRetry = onRetryClicked
|
||||
onDismiss = onDismissClick,
|
||||
onRetry = onRetryClick
|
||||
)
|
||||
}
|
||||
else -> Unit
|
||||
|
|
@ -116,7 +116,7 @@ private fun AttachmentSendStateView(
|
|||
@Composable
|
||||
private fun AttachmentPreviewContent(
|
||||
attachment: Attachment,
|
||||
onSendClicked: () -> Unit,
|
||||
onSendClick: () -> Unit,
|
||||
onDismiss: () -> Unit,
|
||||
) {
|
||||
Box(
|
||||
|
|
@ -146,8 +146,8 @@ private fun AttachmentPreviewContent(
|
|||
}
|
||||
}
|
||||
AttachmentsPreviewBottomActions(
|
||||
onCancelClicked = onDismiss,
|
||||
onSendClicked = onSendClicked,
|
||||
onCancelClick = onDismiss,
|
||||
onSendClick = onSendClick,
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.background(Color.Black.copy(alpha = 0.7f))
|
||||
|
|
@ -159,13 +159,13 @@ private fun AttachmentPreviewContent(
|
|||
|
||||
@Composable
|
||||
private fun AttachmentsPreviewBottomActions(
|
||||
onCancelClicked: () -> Unit,
|
||||
onSendClicked: () -> Unit,
|
||||
onCancelClick: () -> Unit,
|
||||
onSendClick: () -> Unit,
|
||||
modifier: Modifier = Modifier
|
||||
) {
|
||||
ButtonRowMolecule(modifier = modifier) {
|
||||
TextButton(stringResource(id = CommonStrings.action_cancel), onClick = onCancelClicked)
|
||||
TextButton(stringResource(id = CommonStrings.action_send), onClick = onSendClicked)
|
||||
TextButton(stringResource(id = CommonStrings.action_cancel), onClick = onCancelClick)
|
||||
TextButton(stringResource(id = CommonStrings.action_send), onClick = onSendClick)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -94,12 +94,12 @@ class ForwardMessagesNode @AssistedInject constructor(
|
|||
val state = presenter.present()
|
||||
ForwardMessagesView(
|
||||
state = state,
|
||||
onForwardingSucceeded = ::onSucceeded,
|
||||
onForwardSuccess = ::onForwardSuccess,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private fun onSucceeded(roomIds: ImmutableList<RoomId>) {
|
||||
private fun onForwardSuccess(roomIds: ImmutableList<RoomId>) {
|
||||
navigateUp()
|
||||
if (roomIds.size == 1) {
|
||||
val targetRoomId = roomIds.first()
|
||||
|
|
|
|||
|
|
@ -30,11 +30,11 @@ import kotlinx.collections.immutable.ImmutableList
|
|||
@Composable
|
||||
fun ForwardMessagesView(
|
||||
state: ForwardMessagesState,
|
||||
onForwardingSucceeded: (ImmutableList<RoomId>) -> Unit,
|
||||
onForwardSuccess: (ImmutableList<RoomId>) -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
if (state.forwardingSucceeded != null) {
|
||||
onForwardingSucceeded(state.forwardingSucceeded)
|
||||
onForwardSuccess(state.forwardingSucceeded)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
@ -64,6 +64,6 @@ private fun ForwardingErrorDialog(onDismiss: () -> Unit, modifier: Modifier = Mo
|
|||
internal fun ForwardMessagesViewPreview(@PreviewParameter(ForwardMessagesStateProvider::class) state: ForwardMessagesState) = ElementPreview {
|
||||
ForwardMessagesView(
|
||||
state = state,
|
||||
onForwardingSucceeded = {}
|
||||
onForwardSuccess = {}
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ fun MentionSuggestionsPickerView(
|
|||
roomName: String?,
|
||||
roomAvatarData: AvatarData?,
|
||||
memberSuggestions: ImmutableList<ResolvedMentionSuggestion>,
|
||||
onSuggestionSelected: (ResolvedMentionSuggestion) -> Unit,
|
||||
onSelectSuggestion: (ResolvedMentionSuggestion) -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
LazyColumn(
|
||||
|
|
@ -74,7 +74,7 @@ fun MentionSuggestionsPickerView(
|
|||
roomId = roomId.value,
|
||||
roomName = roomName,
|
||||
roomAvatar = roomAvatarData,
|
||||
onSuggestionSelected = onSuggestionSelected,
|
||||
onSelectSuggestion = onSelectSuggestion,
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
)
|
||||
HorizontalDivider(modifier = Modifier.fillMaxWidth())
|
||||
|
|
@ -89,10 +89,10 @@ private fun RoomMemberSuggestionItemView(
|
|||
roomId: String,
|
||||
roomName: String?,
|
||||
roomAvatar: AvatarData?,
|
||||
onSuggestionSelected: (ResolvedMentionSuggestion) -> Unit,
|
||||
onSelectSuggestion: (ResolvedMentionSuggestion) -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
Row(modifier = modifier.clickable { onSuggestionSelected(memberSuggestion) }, horizontalArrangement = Arrangement.spacedBy(16.dp)) {
|
||||
Row(modifier = modifier.clickable { onSelectSuggestion(memberSuggestion) }, horizontalArrangement = Arrangement.spacedBy(16.dp)) {
|
||||
val avatarSize = AvatarSize.TimelineRoom
|
||||
val avatarData = when (memberSuggestion) {
|
||||
is ResolvedMentionSuggestion.AtRoom -> roomAvatar?.copy(size = avatarSize) ?: AvatarData(roomId, roomName, null, avatarSize)
|
||||
|
|
@ -164,7 +164,7 @@ internal fun MentionSuggestionsPickerViewPreview() {
|
|||
ResolvedMentionSuggestion.Member(roomMember),
|
||||
ResolvedMentionSuggestion.Member(roomMember.copy(userId = UserId("@bob:server.org"), displayName = "Bob")),
|
||||
),
|
||||
onSuggestionSelected = {}
|
||||
onSelectSuggestion = {}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,8 +48,8 @@ import io.element.android.libraries.designsystem.theme.components.Text
|
|||
@Composable
|
||||
internal fun AttachmentsBottomSheet(
|
||||
state: MessageComposerState,
|
||||
onSendLocationClicked: () -> Unit,
|
||||
onCreatePollClicked: () -> Unit,
|
||||
onSendLocationClick: () -> Unit,
|
||||
onCreatePollClick: () -> Unit,
|
||||
enableTextFormatting: Boolean,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
|
|
@ -87,8 +87,8 @@ internal fun AttachmentsBottomSheet(
|
|||
AttachmentSourcePickerMenu(
|
||||
state = state,
|
||||
enableTextFormatting = enableTextFormatting,
|
||||
onSendLocationClicked = onSendLocationClicked,
|
||||
onCreatePollClicked = onCreatePollClicked,
|
||||
onSendLocationClick = onSendLocationClick,
|
||||
onCreatePollClick = onCreatePollClick,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
@ -97,8 +97,8 @@ internal fun AttachmentsBottomSheet(
|
|||
@Composable
|
||||
private fun AttachmentSourcePickerMenu(
|
||||
state: MessageComposerState,
|
||||
onSendLocationClicked: () -> Unit,
|
||||
onCreatePollClicked: () -> Unit,
|
||||
onSendLocationClick: () -> Unit,
|
||||
onCreatePollClick: () -> Unit,
|
||||
enableTextFormatting: Boolean,
|
||||
) {
|
||||
Column(
|
||||
|
|
@ -134,7 +134,7 @@ private fun AttachmentSourcePickerMenu(
|
|||
ListItem(
|
||||
modifier = Modifier.clickable {
|
||||
state.eventSink(MessageComposerEvents.PickAttachmentSource.Location)
|
||||
onSendLocationClicked()
|
||||
onSendLocationClick()
|
||||
},
|
||||
leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.LocationPin())),
|
||||
headlineContent = { Text(stringResource(R.string.screen_room_attachment_source_location)) },
|
||||
|
|
@ -145,7 +145,7 @@ private fun AttachmentSourcePickerMenu(
|
|||
ListItem(
|
||||
modifier = Modifier.clickable {
|
||||
state.eventSink(MessageComposerEvents.PickAttachmentSource.Poll)
|
||||
onCreatePollClicked()
|
||||
onCreatePollClick()
|
||||
},
|
||||
leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Polls())),
|
||||
headlineContent = { Text(stringResource(R.string.screen_room_attachment_source_poll)) },
|
||||
|
|
@ -170,8 +170,8 @@ internal fun AttachmentSourcePickerMenuPreview() = ElementPreview {
|
|||
state = aMessageComposerState(
|
||||
canShareLocation = true,
|
||||
),
|
||||
onSendLocationClicked = {},
|
||||
onCreatePollClicked = {},
|
||||
onSendLocationClick = {},
|
||||
onCreatePollClick = {},
|
||||
enableTextFormatting = true,
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -121,11 +121,11 @@ internal fun MessageComposerView(
|
|||
onVoicePlayerEvent = onVoicePlayerEvent,
|
||||
onSendVoiceMessage = onSendVoiceMessage,
|
||||
onDeleteVoiceMessage = onDeleteVoiceMessage,
|
||||
onSuggestionReceived = ::onSuggestionReceived,
|
||||
onReceiveSuggestion = ::onSuggestionReceived,
|
||||
onError = ::onError,
|
||||
onTyping = ::onTyping,
|
||||
currentUserId = state.currentUserId,
|
||||
onRichContentSelected = ::sendUri,
|
||||
onSelectRichContent = ::sendUri,
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ class ReportMessageNode @AssistedInject constructor(
|
|||
val state = presenter.present()
|
||||
ReportMessageView(
|
||||
state = state,
|
||||
onBackClicked = ::navigateUp,
|
||||
onBackClick = ::navigateUp,
|
||||
modifier = modifier
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ import io.element.android.libraries.ui.strings.CommonStrings
|
|||
@Composable
|
||||
fun ReportMessageView(
|
||||
state: ReportMessageState,
|
||||
onBackClicked: () -> Unit,
|
||||
onBackClick: () -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
val focusManager = LocalFocusManager.current
|
||||
|
|
@ -66,7 +66,7 @@ fun ReportMessageView(
|
|||
AsyncActionView(
|
||||
async = state.result,
|
||||
progressDialog = {},
|
||||
onSuccess = { onBackClicked() },
|
||||
onSuccess = { onBackClick() },
|
||||
errorMessage = { stringResource(CommonStrings.error_unknown) },
|
||||
onErrorDismiss = { state.eventSink(ReportMessageEvents.ClearError) }
|
||||
)
|
||||
|
|
@ -81,7 +81,7 @@ fun ReportMessageView(
|
|||
)
|
||||
},
|
||||
navigationIcon = {
|
||||
BackButton(onClick = onBackClicked)
|
||||
BackButton(onClick = onBackClick)
|
||||
}
|
||||
)
|
||||
},
|
||||
|
|
@ -160,7 +160,7 @@ fun ReportMessageView(
|
|||
@Composable
|
||||
internal fun ReportMessageViewPreview(@PreviewParameter(ReportMessageStateProvider::class) state: ReportMessageState) = ElementPreview {
|
||||
ReportMessageView(
|
||||
onBackClicked = {},
|
||||
onBackClick = {},
|
||||
state = state,
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@ class TimelinePresenter @AssistedInject constructor(
|
|||
)
|
||||
}
|
||||
is TimelineEvents.PollEditClicked -> {
|
||||
navigator.onEditPollClicked(event.pollStartId)
|
||||
navigator.onEditPollClick(event.pollStartId)
|
||||
}
|
||||
is TimelineEvents.FocusOnEvent -> localScope.launch {
|
||||
focusedEventId.value = event.eventId
|
||||
|
|
|
|||
|
|
@ -79,15 +79,15 @@ import kotlin.math.abs
|
|||
fun TimelineView(
|
||||
state: TimelineState,
|
||||
typingNotificationState: TypingNotificationState,
|
||||
onUserDataClicked: (UserId) -> Unit,
|
||||
onLinkClicked: (String) -> Unit,
|
||||
onMessageClicked: (TimelineItem.Event) -> Unit,
|
||||
onMessageLongClicked: (TimelineItem.Event) -> Unit,
|
||||
onTimestampClicked: (TimelineItem.Event) -> Unit,
|
||||
onUserDataClick: (UserId) -> Unit,
|
||||
onLinkClick: (String) -> Unit,
|
||||
onMessageClick: (TimelineItem.Event) -> Unit,
|
||||
onMessageLongClick: (TimelineItem.Event) -> Unit,
|
||||
onTimestampClick: (TimelineItem.Event) -> Unit,
|
||||
onSwipeToReply: (TimelineItem.Event) -> Unit,
|
||||
onReactionClicked: (emoji: String, TimelineItem.Event) -> Unit,
|
||||
onReactionLongClicked: (emoji: String, TimelineItem.Event) -> Unit,
|
||||
onMoreReactionsClicked: (TimelineItem.Event) -> Unit,
|
||||
onReactionClick: (emoji: String, TimelineItem.Event) -> Unit,
|
||||
onReactionLongClick: (emoji: String, TimelineItem.Event) -> Unit,
|
||||
onMoreReactionsClick: (TimelineItem.Event) -> Unit,
|
||||
onReadReceiptClick: (TimelineItem.Event) -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
forceJumpToBottomVisibility: Boolean = false
|
||||
|
|
@ -96,7 +96,7 @@ fun TimelineView(
|
|||
state.eventSink(TimelineEvents.ClearFocusRequestState)
|
||||
}
|
||||
|
||||
fun onScrollFinishedAt(firstVisibleIndex: Int) {
|
||||
fun onScrollFinishAt(firstVisibleIndex: Int) {
|
||||
state.eventSink(TimelineEvents.OnScrollFinished(firstVisibleIndex))
|
||||
}
|
||||
|
||||
|
|
@ -108,7 +108,7 @@ fun TimelineView(
|
|||
accessibilityManager.isTouchExplorationEnabled.not()
|
||||
}
|
||||
|
||||
fun inReplyToClicked(eventId: EventId) {
|
||||
fun inReplyToClick(eventId: EventId) {
|
||||
state.eventSink(TimelineEvents.FocusOnEvent(eventId))
|
||||
}
|
||||
|
||||
|
|
@ -138,16 +138,16 @@ fun TimelineView(
|
|||
isLastOutgoingMessage = (timelineItem as? TimelineItem.Event)?.isMine == true &&
|
||||
state.timelineItems.first().identifier() == timelineItem.identifier(),
|
||||
focusedEventId = state.focusedEventId,
|
||||
onClick = onMessageClicked,
|
||||
onLongClick = onMessageLongClicked,
|
||||
onUserDataClick = onUserDataClicked,
|
||||
onLinkClicked = onLinkClicked,
|
||||
inReplyToClick = ::inReplyToClicked,
|
||||
onReactionClick = onReactionClicked,
|
||||
onReactionLongClick = onReactionLongClicked,
|
||||
onMoreReactionsClick = onMoreReactionsClicked,
|
||||
onClick = onMessageClick,
|
||||
onLongClick = onMessageLongClick,
|
||||
onUserDataClick = onUserDataClick,
|
||||
onLinkClick = onLinkClick,
|
||||
inReplyToClick = ::inReplyToClick,
|
||||
onReactionClick = onReactionClick,
|
||||
onReactionLongClick = onReactionLongClick,
|
||||
onMoreReactionsClick = onMoreReactionsClick,
|
||||
onReadReceiptClick = onReadReceiptClick,
|
||||
onTimestampClicked = onTimestampClicked,
|
||||
onTimestampClick = onTimestampClick,
|
||||
eventSink = state.eventSink,
|
||||
onSwipeToReply = onSwipeToReply,
|
||||
)
|
||||
|
|
@ -166,7 +166,7 @@ fun TimelineView(
|
|||
newEventState = state.newEventState,
|
||||
isLive = state.isLive,
|
||||
focusRequestState = state.focusRequestState,
|
||||
onScrollFinishedAt = ::onScrollFinishedAt,
|
||||
onScrollFinishAt = ::onScrollFinishAt,
|
||||
onClearFocusRequestState = ::clearFocusRequestState,
|
||||
onJumpToLive = { state.eventSink(TimelineEvents.JumpToLive) },
|
||||
)
|
||||
|
|
@ -183,7 +183,7 @@ private fun BoxScope.TimelineScrollHelper(
|
|||
forceJumpToBottomVisibility: Boolean,
|
||||
focusRequestState: FocusRequestState,
|
||||
onClearFocusRequestState: () -> Unit,
|
||||
onScrollFinishedAt: (Int) -> Unit,
|
||||
onScrollFinishAt: (Int) -> Unit,
|
||||
onJumpToLive: () -> Unit,
|
||||
) {
|
||||
val coroutineScope = rememberCoroutineScope()
|
||||
|
|
@ -231,11 +231,11 @@ private fun BoxScope.TimelineScrollHelper(
|
|||
}
|
||||
}
|
||||
|
||||
val latestOnScrollFinishedAt by rememberUpdatedState(onScrollFinishedAt)
|
||||
val latestOnScrollFinishAt by rememberUpdatedState(onScrollFinishAt)
|
||||
LaunchedEffect(isScrollFinished, hasAnyEvent) {
|
||||
if (isScrollFinished && hasAnyEvent) {
|
||||
// Notify the parent composable about the first visible item index when scrolling finishes
|
||||
latestOnScrollFinishedAt(lazyListState.firstVisibleItemIndex)
|
||||
latestOnScrollFinishAt(lazyListState.firstVisibleItemIndex)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -295,15 +295,15 @@ internal fun TimelineViewPreview(
|
|||
focusedEventIndex = 0,
|
||||
),
|
||||
typingNotificationState = aTypingNotificationState(),
|
||||
onUserDataClicked = {},
|
||||
onLinkClicked = {},
|
||||
onMessageClicked = {},
|
||||
onMessageLongClicked = {},
|
||||
onTimestampClicked = {},
|
||||
onUserDataClick = {},
|
||||
onLinkClick = {},
|
||||
onMessageClick = {},
|
||||
onMessageLongClick = {},
|
||||
onTimestampClick = {},
|
||||
onSwipeToReply = {},
|
||||
onReactionClicked = { _, _ -> },
|
||||
onReactionLongClicked = { _, _ -> },
|
||||
onMoreReactionsClicked = {},
|
||||
onReactionClick = { _, _ -> },
|
||||
onReactionLongClick = { _, _ -> },
|
||||
onMoreReactionsClick = {},
|
||||
onReadReceiptClick = {},
|
||||
forceJumpToBottomVisibility = true,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -38,13 +38,13 @@ internal fun ATimelineItemEventRow(
|
|||
onClick = {},
|
||||
onLongClick = {},
|
||||
onUserDataClick = {},
|
||||
onLinkClicked = {},
|
||||
onLinkClick = {},
|
||||
inReplyToClick = {},
|
||||
onReactionClick = { _, _ -> },
|
||||
onReactionLongClick = { _, _ -> },
|
||||
onMoreReactionsClick = {},
|
||||
onReadReceiptClick = {},
|
||||
onSwipeToReply = {},
|
||||
onTimestampClicked = {},
|
||||
onTimestampClick = {},
|
||||
eventSink = {},
|
||||
)
|
||||
|
|
|
|||
|
|
@ -127,10 +127,10 @@ fun TimelineItemEventRow(
|
|||
isHighlighted: Boolean,
|
||||
onClick: () -> Unit,
|
||||
onLongClick: () -> Unit,
|
||||
onLinkClicked: (String) -> Unit,
|
||||
onLinkClick: (String) -> Unit,
|
||||
onUserDataClick: (UserId) -> Unit,
|
||||
inReplyToClick: (EventId) -> Unit,
|
||||
onTimestampClicked: (TimelineItem.Event) -> Unit,
|
||||
onTimestampClick: (TimelineItem.Event) -> Unit,
|
||||
onReactionClick: (emoji: String, eventId: TimelineItem.Event) -> Unit,
|
||||
onReactionLongClick: (emoji: String, eventId: TimelineItem.Event) -> Unit,
|
||||
onMoreReactionsClick: (eventId: TimelineItem.Event) -> Unit,
|
||||
|
|
@ -142,11 +142,11 @@ fun TimelineItemEventRow(
|
|||
val coroutineScope = rememberCoroutineScope()
|
||||
val interactionSource = remember { MutableInteractionSource() }
|
||||
|
||||
fun onUserDataClicked() {
|
||||
fun onUserDataClick() {
|
||||
onUserDataClick(event.senderId)
|
||||
}
|
||||
|
||||
fun inReplyToClicked() {
|
||||
fun inReplyToClick() {
|
||||
val inReplyToEventId = event.inReplyTo?.eventId() ?: return
|
||||
inReplyToClick(inReplyToEventId)
|
||||
}
|
||||
|
|
@ -190,13 +190,13 @@ fun TimelineItemEventRow(
|
|||
interactionSource = interactionSource,
|
||||
onClick = onClick,
|
||||
onLongClick = onLongClick,
|
||||
onTimestampClicked = onTimestampClicked,
|
||||
inReplyToClicked = ::inReplyToClicked,
|
||||
onUserDataClicked = ::onUserDataClicked,
|
||||
onReactionClicked = { emoji -> onReactionClick(emoji, event) },
|
||||
onReactionLongClicked = { emoji -> onReactionLongClick(emoji, event) },
|
||||
onMoreReactionsClicked = { onMoreReactionsClick(event) },
|
||||
onLinkClicked = onLinkClicked,
|
||||
onTimestampClick = onTimestampClick,
|
||||
inReplyToClick = ::inReplyToClick,
|
||||
onUserDataClick = ::onUserDataClick,
|
||||
onReactionClick = { emoji -> onReactionClick(emoji, event) },
|
||||
onReactionLongClick = { emoji -> onReactionLongClick(emoji, event) },
|
||||
onMoreReactionsClick = { onMoreReactionsClick(event) },
|
||||
onLinkClick = onLinkClick,
|
||||
eventSink = eventSink,
|
||||
)
|
||||
}
|
||||
|
|
@ -209,13 +209,13 @@ fun TimelineItemEventRow(
|
|||
interactionSource = interactionSource,
|
||||
onClick = onClick,
|
||||
onLongClick = onLongClick,
|
||||
onTimestampClicked = onTimestampClicked,
|
||||
inReplyToClicked = ::inReplyToClicked,
|
||||
onUserDataClicked = ::onUserDataClicked,
|
||||
onReactionClicked = { emoji -> onReactionClick(emoji, event) },
|
||||
onReactionLongClicked = { emoji -> onReactionLongClick(emoji, event) },
|
||||
onMoreReactionsClicked = { onMoreReactionsClick(event) },
|
||||
onLinkClicked = onLinkClicked,
|
||||
onTimestampClick = onTimestampClick,
|
||||
inReplyToClick = ::inReplyToClick,
|
||||
onUserDataClick = ::onUserDataClick,
|
||||
onReactionClick = { emoji -> onReactionClick(emoji, event) },
|
||||
onReactionLongClick = { emoji -> onReactionLongClick(emoji, event) },
|
||||
onMoreReactionsClick = { onMoreReactionsClick(event) },
|
||||
onLinkClick = onLinkClick,
|
||||
eventSink = eventSink,
|
||||
)
|
||||
}
|
||||
|
|
@ -227,7 +227,7 @@ fun TimelineItemEventRow(
|
|||
receipts = event.readReceiptState.receipts,
|
||||
),
|
||||
renderReadReceipts = renderReadReceipts,
|
||||
onReadReceiptsClicked = { onReadReceiptClick(event) },
|
||||
onReadReceiptsClick = { onReadReceiptClick(event) },
|
||||
modifier = Modifier.padding(top = 4.dp),
|
||||
)
|
||||
}
|
||||
|
|
@ -265,13 +265,13 @@ private fun TimelineItemEventRowContent(
|
|||
interactionSource: MutableInteractionSource,
|
||||
onClick: () -> Unit,
|
||||
onLongClick: () -> Unit,
|
||||
onTimestampClicked: (TimelineItem.Event) -> Unit,
|
||||
inReplyToClicked: () -> Unit,
|
||||
onUserDataClicked: () -> Unit,
|
||||
onReactionClicked: (emoji: String) -> Unit,
|
||||
onReactionLongClicked: (emoji: String) -> Unit,
|
||||
onMoreReactionsClicked: (event: TimelineItem.Event) -> Unit,
|
||||
onLinkClicked: (String) -> Unit,
|
||||
onTimestampClick: (TimelineItem.Event) -> Unit,
|
||||
inReplyToClick: () -> Unit,
|
||||
onUserDataClick: () -> Unit,
|
||||
onReactionClick: (emoji: String) -> Unit,
|
||||
onReactionLongClick: (emoji: String) -> Unit,
|
||||
onMoreReactionsClick: (event: TimelineItem.Event) -> Unit,
|
||||
onLinkClick: (String) -> Unit,
|
||||
eventSink: (TimelineEvents.EventFromTimelineItem) -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
|
|
@ -306,7 +306,7 @@ private fun TimelineItemEventRowContent(
|
|||
}
|
||||
.padding(horizontal = 16.dp)
|
||||
.zIndex(1f)
|
||||
.clickable(onClick = onUserDataClicked)
|
||||
.clickable(onClick = onUserDataClick)
|
||||
// This is redundant when using talkback
|
||||
.clearAndSetSemantics {
|
||||
invisibleToUser()
|
||||
|
|
@ -336,11 +336,11 @@ private fun TimelineItemEventRowContent(
|
|||
MessageEventBubbleContent(
|
||||
event = event,
|
||||
onMessageLongClick = onLongClick,
|
||||
inReplyToClick = inReplyToClicked,
|
||||
onTimestampClicked = {
|
||||
onTimestampClicked(event)
|
||||
inReplyToClick = inReplyToClick,
|
||||
onTimestampClick = {
|
||||
onTimestampClick(event)
|
||||
},
|
||||
onLinkClicked = onLinkClicked,
|
||||
onLinkClick = onLinkClick,
|
||||
eventSink = eventSink,
|
||||
)
|
||||
}
|
||||
|
|
@ -351,9 +351,9 @@ private fun TimelineItemEventRowContent(
|
|||
reactionsState = event.reactionsState,
|
||||
userCanSendReaction = timelineRoomInfo.userHasPermissionToSendReaction,
|
||||
isOutgoing = event.isMine,
|
||||
onReactionClicked = onReactionClicked,
|
||||
onReactionLongClicked = onReactionLongClicked,
|
||||
onMoreReactionsClicked = { onMoreReactionsClicked(event) },
|
||||
onReactionClick = onReactionClick,
|
||||
onReactionLongClick = onReactionLongClick,
|
||||
onMoreReactionsClick = { onMoreReactionsClick(event) },
|
||||
modifier = Modifier
|
||||
.constrainAs(reactions) {
|
||||
top.linkTo(message.bottom, margin = (-4).dp)
|
||||
|
|
@ -419,8 +419,8 @@ private fun MessageEventBubbleContent(
|
|||
event: TimelineItem.Event,
|
||||
onMessageLongClick: () -> Unit,
|
||||
inReplyToClick: () -> Unit,
|
||||
onTimestampClicked: () -> Unit,
|
||||
onLinkClicked: (String) -> Unit,
|
||||
onTimestampClick: () -> Unit,
|
||||
onLinkClick: (String) -> Unit,
|
||||
eventSink: (TimelineEvents.EventFromTimelineItem) -> Unit,
|
||||
@SuppressLint("ModifierParameter")
|
||||
// need to rename this modifier to prevent linter false positives
|
||||
|
|
@ -460,7 +460,7 @@ private fun MessageEventBubbleContent(
|
|||
timestampPosition: TimestampPosition,
|
||||
modifier: Modifier = Modifier,
|
||||
canShrinkContent: Boolean = false,
|
||||
content: @Composable (onContentLayoutChanged: (ContentAvoidingLayoutData) -> Unit) -> Unit,
|
||||
content: @Composable (onContentLayoutChange: (ContentAvoidingLayoutData) -> Unit) -> Unit,
|
||||
) {
|
||||
when (timestampPosition) {
|
||||
TimestampPosition.Overlay ->
|
||||
|
|
@ -468,7 +468,7 @@ private fun MessageEventBubbleContent(
|
|||
content {}
|
||||
TimelineEventTimestampView(
|
||||
event = event,
|
||||
onClick = onTimestampClicked,
|
||||
onClick = onTimestampClick,
|
||||
onLongClick = ::onTimestampLongClick,
|
||||
modifier = Modifier
|
||||
// Outer padding
|
||||
|
|
@ -486,11 +486,11 @@ private fun MessageEventBubbleContent(
|
|||
spacing = (-4).dp,
|
||||
overlayOffset = DpOffset(0.dp, -1.dp),
|
||||
shrinkContent = canShrinkContent,
|
||||
content = { content(this::onContentLayoutChanged) },
|
||||
content = { content(this::onContentLayoutChange) },
|
||||
overlay = {
|
||||
TimelineEventTimestampView(
|
||||
event = event,
|
||||
onClick = onTimestampClicked,
|
||||
onClick = onTimestampClick,
|
||||
onLongClick = ::onTimestampLongClick,
|
||||
modifier = Modifier
|
||||
.padding(horizontal = 8.dp, vertical = 4.dp)
|
||||
|
|
@ -502,7 +502,7 @@ private fun MessageEventBubbleContent(
|
|||
content {}
|
||||
TimelineEventTimestampView(
|
||||
event = event,
|
||||
onClick = onTimestampClicked,
|
||||
onClick = onTimestampClick,
|
||||
onLongClick = ::onTimestampLongClick,
|
||||
modifier = Modifier
|
||||
.align(Alignment.End)
|
||||
|
|
@ -553,12 +553,12 @@ private fun MessageEventBubbleContent(
|
|||
timestampPosition = timestampPosition,
|
||||
canShrinkContent = canShrinkContent,
|
||||
modifier = timestampLayoutModifier,
|
||||
) { onContentLayoutChanged ->
|
||||
) { onContentLayoutChange ->
|
||||
TimelineItemEventContentView(
|
||||
content = event.content,
|
||||
onLinkClicked = onLinkClicked,
|
||||
onLinkClick = onLinkClick,
|
||||
eventSink = eventSink,
|
||||
onContentLayoutChanged = onContentLayoutChanged,
|
||||
onContentLayoutChange = onContentLayoutChange,
|
||||
modifier = contentModifier
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,8 +48,8 @@ fun TimelineItemGroupedEventsRow(
|
|||
onLongClick: (TimelineItem.Event) -> Unit,
|
||||
inReplyToClick: (EventId) -> Unit,
|
||||
onUserDataClick: (UserId) -> Unit,
|
||||
onLinkClicked: (String) -> Unit,
|
||||
onTimestampClicked: (TimelineItem.Event) -> Unit,
|
||||
onLinkClick: (String) -> Unit,
|
||||
onTimestampClick: (TimelineItem.Event) -> Unit,
|
||||
onReactionClick: (key: String, TimelineItem.Event) -> Unit,
|
||||
onReactionLongClick: (key: String, TimelineItem.Event) -> Unit,
|
||||
onMoreReactionsClick: (TimelineItem.Event) -> Unit,
|
||||
|
|
@ -75,8 +75,8 @@ fun TimelineItemGroupedEventsRow(
|
|||
onLongClick = onLongClick,
|
||||
inReplyToClick = inReplyToClick,
|
||||
onUserDataClick = onUserDataClick,
|
||||
onLinkClicked = onLinkClicked,
|
||||
onTimestampClicked = onTimestampClicked,
|
||||
onLinkClick = onLinkClick,
|
||||
onTimestampClick = onTimestampClick,
|
||||
onReactionClick = onReactionClick,
|
||||
onReactionLongClick = onReactionLongClick,
|
||||
onMoreReactionsClick = onMoreReactionsClick,
|
||||
|
|
@ -99,8 +99,8 @@ private fun TimelineItemGroupedEventsRowContent(
|
|||
onLongClick: (TimelineItem.Event) -> Unit,
|
||||
inReplyToClick: (EventId) -> Unit,
|
||||
onUserDataClick: (UserId) -> Unit,
|
||||
onLinkClicked: (String) -> Unit,
|
||||
onTimestampClicked: (TimelineItem.Event) -> Unit,
|
||||
onLinkClick: (String) -> Unit,
|
||||
onTimestampClick: (TimelineItem.Event) -> Unit,
|
||||
onReactionClick: (key: String, TimelineItem.Event) -> Unit,
|
||||
onReactionLongClick: (key: String, TimelineItem.Event) -> Unit,
|
||||
onMoreReactionsClick: (TimelineItem.Event) -> Unit,
|
||||
|
|
@ -132,8 +132,8 @@ private fun TimelineItemGroupedEventsRowContent(
|
|||
onLongClick = onLongClick,
|
||||
inReplyToClick = inReplyToClick,
|
||||
onUserDataClick = onUserDataClick,
|
||||
onLinkClicked = onLinkClicked,
|
||||
onTimestampClicked = onTimestampClicked,
|
||||
onLinkClick = onLinkClick,
|
||||
onTimestampClick = onTimestampClick,
|
||||
onReactionClick = onReactionClick,
|
||||
onReactionLongClick = onReactionLongClick,
|
||||
onMoreReactionsClick = onMoreReactionsClick,
|
||||
|
|
@ -151,7 +151,7 @@ private fun TimelineItemGroupedEventsRowContent(
|
|||
receipts = timelineItem.aggregatedReadReceipts,
|
||||
),
|
||||
renderReadReceipts = true,
|
||||
onReadReceiptsClicked = onExpandGroupClick
|
||||
onReadReceiptsClick = onExpandGroupClick
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
@ -173,8 +173,8 @@ internal fun TimelineItemGroupedEventsRowContentExpandedPreview() = ElementPrevi
|
|||
onLongClick = {},
|
||||
inReplyToClick = {},
|
||||
onUserDataClick = {},
|
||||
onLinkClicked = {},
|
||||
onTimestampClicked = {},
|
||||
onLinkClick = {},
|
||||
onTimestampClick = {},
|
||||
onReactionClick = { _, _ -> },
|
||||
onReactionLongClick = { _, _ -> },
|
||||
onMoreReactionsClick = {},
|
||||
|
|
@ -198,8 +198,8 @@ internal fun TimelineItemGroupedEventsRowContentCollapsePreview() = ElementPrevi
|
|||
onLongClick = {},
|
||||
inReplyToClick = {},
|
||||
onUserDataClick = {},
|
||||
onLinkClicked = {},
|
||||
onTimestampClicked = {},
|
||||
onLinkClick = {},
|
||||
onTimestampClick = {},
|
||||
onReactionClick = { _, _ -> },
|
||||
onReactionLongClick = { _, _ -> },
|
||||
onMoreReactionsClick = {},
|
||||
|
|
|
|||
|
|
@ -42,9 +42,9 @@ fun TimelineItemReactionsView(
|
|||
reactionsState: TimelineItemReactions,
|
||||
isOutgoing: Boolean,
|
||||
userCanSendReaction: Boolean,
|
||||
onReactionClicked: (emoji: String) -> Unit,
|
||||
onReactionLongClicked: (emoji: String) -> Unit,
|
||||
onMoreReactionsClicked: () -> Unit,
|
||||
onReactionClick: (emoji: String) -> Unit,
|
||||
onReactionLongClick: (emoji: String) -> Unit,
|
||||
onMoreReactionsClick: () -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
var expanded: Boolean by rememberSaveable { mutableStateOf(false) }
|
||||
|
|
@ -54,9 +54,9 @@ fun TimelineItemReactionsView(
|
|||
userCanSendReaction = userCanSendReaction,
|
||||
expanded = expanded,
|
||||
isOutgoing = isOutgoing,
|
||||
onReactionClick = onReactionClicked,
|
||||
onReactionLongClick = onReactionLongClicked,
|
||||
onMoreReactionsClick = onMoreReactionsClicked,
|
||||
onReactionClick = onReactionClick,
|
||||
onReactionLongClick = onReactionLongClick,
|
||||
onMoreReactionsClick = onMoreReactionsClick,
|
||||
onToggleExpandClick = { expanded = !expanded },
|
||||
)
|
||||
}
|
||||
|
|
@ -179,8 +179,8 @@ private fun ContentToPreview(
|
|||
),
|
||||
userCanSendReaction = true,
|
||||
isOutgoing = isOutgoing,
|
||||
onReactionClicked = {},
|
||||
onReactionLongClicked = {},
|
||||
onMoreReactionsClicked = {},
|
||||
onReactionClick = {},
|
||||
onReactionLongClick = {},
|
||||
onMoreReactionsClick = {},
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ internal fun TimelineItemRow(
|
|||
isLastOutgoingMessage: Boolean,
|
||||
focusedEventId: EventId?,
|
||||
onUserDataClick: (UserId) -> Unit,
|
||||
onLinkClicked: (String) -> Unit,
|
||||
onLinkClick: (String) -> Unit,
|
||||
onClick: (TimelineItem.Event) -> Unit,
|
||||
onLongClick: (TimelineItem.Event) -> Unit,
|
||||
inReplyToClick: (EventId) -> Unit,
|
||||
|
|
@ -53,7 +53,7 @@ internal fun TimelineItemRow(
|
|||
onReactionLongClick: (key: String, TimelineItem.Event) -> Unit,
|
||||
onMoreReactionsClick: (TimelineItem.Event) -> Unit,
|
||||
onReadReceiptClick: (TimelineItem.Event) -> Unit,
|
||||
onTimestampClicked: (TimelineItem.Event) -> Unit,
|
||||
onTimestampClick: (TimelineItem.Event) -> Unit,
|
||||
onSwipeToReply: (TimelineItem.Event) -> Unit,
|
||||
eventSink: (TimelineEvents.EventFromTimelineItem) -> Unit,
|
||||
modifier: Modifier = Modifier
|
||||
|
|
@ -99,13 +99,13 @@ internal fun TimelineItemRow(
|
|||
onClick = { onClick(timelineItem) },
|
||||
onLongClick = { onLongClick(timelineItem) },
|
||||
onUserDataClick = onUserDataClick,
|
||||
onLinkClicked = onLinkClicked,
|
||||
onLinkClick = onLinkClick,
|
||||
inReplyToClick = inReplyToClick,
|
||||
onReactionClick = onReactionClick,
|
||||
onReactionLongClick = onReactionLongClick,
|
||||
onMoreReactionsClick = onMoreReactionsClick,
|
||||
onReadReceiptClick = onReadReceiptClick,
|
||||
onTimestampClicked = onTimestampClicked,
|
||||
onTimestampClick = onTimestampClick,
|
||||
onSwipeToReply = { onSwipeToReply(timelineItem) },
|
||||
eventSink = eventSink,
|
||||
)
|
||||
|
|
@ -122,8 +122,8 @@ internal fun TimelineItemRow(
|
|||
onLongClick = onLongClick,
|
||||
inReplyToClick = inReplyToClick,
|
||||
onUserDataClick = onUserDataClick,
|
||||
onLinkClicked = onLinkClicked,
|
||||
onTimestampClicked = onTimestampClicked,
|
||||
onLinkClick = onLinkClick,
|
||||
onTimestampClick = onTimestampClick,
|
||||
onReactionClick = onReactionClick,
|
||||
onReactionLongClick = onReactionLongClick,
|
||||
onMoreReactionsClick = onMoreReactionsClick,
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ fun TimelineItemStateEventRow(
|
|||
) {
|
||||
TimelineItemEventContentView(
|
||||
content = event.content,
|
||||
onLinkClicked = {},
|
||||
onLinkClick = {},
|
||||
eventSink = eventSink,
|
||||
modifier = Modifier.defaultTimelineContentPadding()
|
||||
)
|
||||
|
|
@ -92,7 +92,7 @@ fun TimelineItemStateEventRow(
|
|||
receipts = event.readReceiptState.receipts,
|
||||
),
|
||||
renderReadReceipts = renderReadReceipts,
|
||||
onReadReceiptsClicked = { onReadReceiptsClick(event) },
|
||||
onReadReceiptsClick = { onReadReceiptsClick(event) },
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ import io.element.android.libraries.matrix.api.core.EventId
|
|||
@Composable
|
||||
fun CustomReactionBottomSheet(
|
||||
state: CustomReactionState,
|
||||
onEmojiSelected: (EventId, Emoji) -> Unit,
|
||||
onSelectEmoji: (EventId, Emoji) -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
val sheetState = rememberModalBottomSheetState()
|
||||
|
|
@ -46,7 +46,7 @@ fun CustomReactionBottomSheet(
|
|||
if (target?.event?.eventId == null) return
|
||||
sheetState.hide(coroutineScope) {
|
||||
state.eventSink(CustomReactionEvents.DismissCustomReactionSheet)
|
||||
onEmojiSelected(target.event.eventId, emoji)
|
||||
onSelectEmoji(target.event.eventId, emoji)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -57,7 +57,7 @@ fun CustomReactionBottomSheet(
|
|||
modifier = modifier
|
||||
) {
|
||||
EmojiPicker(
|
||||
onEmojiSelected = ::onEmojiSelectedDismiss,
|
||||
onSelectEmoji = ::onEmojiSelectedDismiss,
|
||||
emojibaseStore = target.emojibaseStore,
|
||||
selectedEmojis = state.selectedEmoji,
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ import io.element.android.libraries.ui.strings.CommonStrings
|
|||
fun EmojiItem(
|
||||
item: Emoji,
|
||||
isSelected: Boolean,
|
||||
onEmojiSelected: (Emoji) -> Unit,
|
||||
onSelectEmoji: (Emoji) -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
emojiSize: TextUnit = 20.sp,
|
||||
) {
|
||||
|
|
@ -69,7 +69,7 @@ fun EmojiItem(
|
|||
.background(backgroundColor, CircleShape)
|
||||
.clickable(
|
||||
enabled = true,
|
||||
onClick = { onEmojiSelected(item) },
|
||||
onClick = { onSelectEmoji(item) },
|
||||
indication = rememberRipple(bounded = false, radius = emojiSize.toDp() / 2 + 10.dp),
|
||||
interactionSource = remember { MutableInteractionSource() }
|
||||
)
|
||||
|
|
@ -102,7 +102,7 @@ internal fun EmojiItemPreview() = ElementPreview {
|
|||
skins = null
|
||||
),
|
||||
isSelected = isSelected,
|
||||
onEmojiSelected = {},
|
||||
onSelectEmoji = {},
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ import kotlinx.coroutines.launch
|
|||
@OptIn(ExperimentalFoundationApi::class, ExperimentalMaterial3Api::class)
|
||||
@Composable
|
||||
fun EmojiPicker(
|
||||
onEmojiSelected: (Emoji) -> Unit,
|
||||
onSelectEmoji: (Emoji) -> Unit,
|
||||
emojibaseStore: EmojibaseStore,
|
||||
selectedEmojis: ImmutableSet<String>,
|
||||
modifier: Modifier = Modifier,
|
||||
|
|
@ -99,7 +99,7 @@ fun EmojiPicker(
|
|||
modifier = Modifier.aspectRatio(1f),
|
||||
item = item,
|
||||
isSelected = selectedEmojis.contains(item.unicode),
|
||||
onEmojiSelected = onEmojiSelected,
|
||||
onSelectEmoji = onSelectEmoji,
|
||||
emojiSize = 32.dp.toSp(),
|
||||
)
|
||||
}
|
||||
|
|
@ -112,7 +112,7 @@ fun EmojiPicker(
|
|||
@Composable
|
||||
internal fun EmojiPickerPreview() = ElementPreview {
|
||||
EmojiPicker(
|
||||
onEmojiSelected = {},
|
||||
onSelectEmoji = {},
|
||||
emojibaseStore = EmojibaseDatasource().load(LocalContext.current),
|
||||
selectedEmojis = persistentSetOf("😀", "😄", "😃"),
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ import io.element.android.libraries.designsystem.theme.components.Text
|
|||
@Composable
|
||||
fun TimelineItemAudioView(
|
||||
content: TimelineItemAudioContent,
|
||||
onContentLayoutChanged: (ContentAvoidingLayoutData) -> Unit,
|
||||
onContentLayoutChange: (ContentAvoidingLayoutData) -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
val iconSize = 32.dp
|
||||
|
|
@ -85,7 +85,7 @@ fun TimelineItemAudioView(
|
|||
maxLines = 1,
|
||||
overflow = TextOverflow.Ellipsis,
|
||||
onTextLayout = ContentAvoidingLayout.measureLastTextLine(
|
||||
onContentLayoutChanged = onContentLayoutChanged,
|
||||
onContentLayoutChange = onContentLayoutChange,
|
||||
extraWidth = iconSize + spacing
|
||||
)
|
||||
)
|
||||
|
|
@ -99,6 +99,6 @@ internal fun TimelineItemAudioViewPreview(@PreviewParameter(TimelineItemAudioCon
|
|||
ElementPreview {
|
||||
TimelineItemAudioView(
|
||||
content,
|
||||
onContentLayoutChanged = {},
|
||||
onContentLayoutChange = {},
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ import io.element.android.libraries.ui.strings.CommonStrings
|
|||
@Composable
|
||||
fun TimelineItemEncryptedView(
|
||||
content: TimelineItemEncryptedContent,
|
||||
onContentLayoutChanged: (ContentAvoidingLayoutData) -> Unit,
|
||||
onContentLayoutChange: (ContentAvoidingLayoutData) -> Unit,
|
||||
modifier: Modifier = Modifier
|
||||
) {
|
||||
val isMembershipUtd = (content.data as? UnableToDecryptContent.Data.MegolmV1AesSha2)?.utdCause == UtdCause.Membership
|
||||
|
|
@ -46,7 +46,7 @@ fun TimelineItemEncryptedView(
|
|||
text = stringResource(id = textId),
|
||||
iconDescription = stringResource(id = CommonStrings.dialog_title_warning),
|
||||
iconResourceId = iconId,
|
||||
onContentLayoutChanged = onContentLayoutChanged,
|
||||
onContentLayoutChange = onContentLayoutChange,
|
||||
modifier = modifier
|
||||
)
|
||||
}
|
||||
|
|
@ -58,6 +58,6 @@ internal fun TimelineItemEncryptedViewPreview(
|
|||
) = ElementPreview {
|
||||
TimelineItemEncryptedView(
|
||||
content = content,
|
||||
onContentLayoutChanged = {},
|
||||
onContentLayoutChange = {},
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,32 +43,32 @@ import io.element.android.libraries.architecture.Presenter
|
|||
@Composable
|
||||
fun TimelineItemEventContentView(
|
||||
content: TimelineItemEventContent,
|
||||
onLinkClicked: (url: String) -> Unit,
|
||||
onLinkClick: (url: String) -> Unit,
|
||||
eventSink: (TimelineEvents.EventFromTimelineItem) -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
onContentLayoutChanged: (ContentAvoidingLayoutData) -> Unit = {},
|
||||
onContentLayoutChange: (ContentAvoidingLayoutData) -> Unit = {},
|
||||
) {
|
||||
val presenterFactories = LocalTimelineItemPresenterFactories.current
|
||||
when (content) {
|
||||
is TimelineItemEncryptedContent -> TimelineItemEncryptedView(
|
||||
content = content,
|
||||
onContentLayoutChanged = onContentLayoutChanged,
|
||||
onContentLayoutChange = onContentLayoutChange,
|
||||
modifier = modifier
|
||||
)
|
||||
is TimelineItemRedactedContent -> TimelineItemRedactedView(
|
||||
content = content,
|
||||
onContentLayoutChanged = onContentLayoutChanged,
|
||||
onContentLayoutChange = onContentLayoutChange,
|
||||
modifier = modifier
|
||||
)
|
||||
is TimelineItemTextBasedContent -> TimelineItemTextView(
|
||||
content = content,
|
||||
modifier = modifier,
|
||||
onLinkClicked = onLinkClicked,
|
||||
onContentLayoutChanged = onContentLayoutChanged
|
||||
onLinkClick = onLinkClick,
|
||||
onContentLayoutChange = onContentLayoutChange
|
||||
)
|
||||
is TimelineItemUnknownContent -> TimelineItemUnknownView(
|
||||
content = content,
|
||||
onContentLayoutChanged = onContentLayoutChanged,
|
||||
onContentLayoutChange = onContentLayoutChange,
|
||||
modifier = modifier
|
||||
)
|
||||
is TimelineItemLocationContent -> TimelineItemLocationView(
|
||||
|
|
@ -77,7 +77,7 @@ fun TimelineItemEventContentView(
|
|||
)
|
||||
is TimelineItemImageContent -> TimelineItemImageView(
|
||||
content = content,
|
||||
onContentLayoutChanged = onContentLayoutChanged,
|
||||
onContentLayoutChange = onContentLayoutChange,
|
||||
modifier = modifier,
|
||||
)
|
||||
is TimelineItemStickerContent -> TimelineItemStickerView(
|
||||
|
|
@ -86,17 +86,17 @@ fun TimelineItemEventContentView(
|
|||
)
|
||||
is TimelineItemVideoContent -> TimelineItemVideoView(
|
||||
content = content,
|
||||
onContentLayoutChanged = onContentLayoutChanged,
|
||||
onContentLayoutChange = onContentLayoutChange,
|
||||
modifier = modifier
|
||||
)
|
||||
is TimelineItemFileContent -> TimelineItemFileView(
|
||||
content = content,
|
||||
onContentLayoutChanged = onContentLayoutChanged,
|
||||
onContentLayoutChange = onContentLayoutChange,
|
||||
modifier = modifier
|
||||
)
|
||||
is TimelineItemAudioContent -> TimelineItemAudioView(
|
||||
content = content,
|
||||
onContentLayoutChanged = onContentLayoutChanged,
|
||||
onContentLayoutChange = onContentLayoutChange,
|
||||
modifier = modifier
|
||||
)
|
||||
is TimelineItemLegacyCallInviteContent -> TimelineItemLegacyCallInviteView(modifier = modifier)
|
||||
|
|
@ -114,7 +114,7 @@ fun TimelineItemEventContentView(
|
|||
TimelineItemVoiceView(
|
||||
state = presenter.present(),
|
||||
content = content,
|
||||
onContentLayoutChanged = onContentLayoutChanged,
|
||||
onContentLayoutChange = onContentLayoutChange,
|
||||
modifier = modifier
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ import io.element.android.libraries.designsystem.theme.components.Text
|
|||
@Composable
|
||||
fun TimelineItemFileView(
|
||||
content: TimelineItemFileContent,
|
||||
onContentLayoutChanged: (ContentAvoidingLayoutData) -> Unit,
|
||||
onContentLayoutChange: (ContentAvoidingLayoutData) -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
val iconSize = 32.dp
|
||||
|
|
@ -86,7 +86,7 @@ fun TimelineItemFileView(
|
|||
maxLines = 1,
|
||||
overflow = TextOverflow.Ellipsis,
|
||||
onTextLayout = ContentAvoidingLayout.measureLastTextLine(
|
||||
onContentLayoutChanged = onContentLayoutChanged,
|
||||
onContentLayoutChange = onContentLayoutChange,
|
||||
extraWidth = iconSize + spacing
|
||||
)
|
||||
)
|
||||
|
|
@ -99,6 +99,6 @@ fun TimelineItemFileView(
|
|||
internal fun TimelineItemFileViewPreview(@PreviewParameter(TimelineItemFileContentProvider::class) content: TimelineItemFileContent) = ElementPreview {
|
||||
TimelineItemFileView(
|
||||
content,
|
||||
onContentLayoutChanged = {},
|
||||
onContentLayoutChange = {},
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ import io.element.android.wysiwyg.compose.EditorStyledText
|
|||
@Composable
|
||||
fun TimelineItemImageView(
|
||||
content: TimelineItemImageContent,
|
||||
onContentLayoutChanged: (ContentAvoidingLayoutData) -> Unit,
|
||||
onContentLayoutChange: (ContentAvoidingLayoutData) -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
val description = stringResource(CommonStrings.common_image)
|
||||
|
|
@ -115,7 +115,7 @@ fun TimelineItemImageView(
|
|||
text = caption,
|
||||
style = ElementRichTextEditorStyle.textStyle(),
|
||||
releaseOnDetach = false,
|
||||
onTextLayout = ContentAvoidingLayout.measureLegacyLastTextLine(onContentLayoutChanged = onContentLayoutChanged),
|
||||
onTextLayout = ContentAvoidingLayout.measureLegacyLastTextLine(onContentLayoutChange = onContentLayoutChange),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,12 +41,12 @@ fun TimelineItemInformativeView(
|
|||
text: String,
|
||||
iconDescription: String,
|
||||
@DrawableRes iconResourceId: Int,
|
||||
onContentLayoutChanged: (ContentAvoidingLayoutData) -> Unit,
|
||||
onContentLayoutChange: (ContentAvoidingLayoutData) -> Unit,
|
||||
modifier: Modifier = Modifier
|
||||
) {
|
||||
Row(
|
||||
modifier = modifier.onSizeChanged { size ->
|
||||
onContentLayoutChanged(
|
||||
onContentLayoutChange(
|
||||
ContentAvoidingLayoutData(
|
||||
contentWidth = size.width,
|
||||
contentHeight = size.height,
|
||||
|
|
@ -78,6 +78,6 @@ internal fun TimelineItemInformativeViewPreview() = ElementPreview {
|
|||
text = "Info",
|
||||
iconDescription = "",
|
||||
iconResourceId = CompoundDrawables.ic_compound_delete,
|
||||
onContentLayoutChanged = {},
|
||||
onContentLayoutChange = {},
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ fun TimelineItemPollView(
|
|||
eventSink: (TimelineEvents.TimelineItemPollEvents) -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
fun onAnswerSelected(pollStartId: EventId, answerId: String) {
|
||||
fun onSelectAnswer(pollStartId: EventId, answerId: String) {
|
||||
eventSink(TimelineEvents.PollAnswerSelected(pollStartId, answerId))
|
||||
}
|
||||
|
||||
|
|
@ -54,7 +54,7 @@ fun TimelineItemPollView(
|
|||
isPollEnded = content.isEnded,
|
||||
isPollEditable = content.isEditable,
|
||||
isMine = content.isMine,
|
||||
onAnswerSelected = ::onAnswerSelected,
|
||||
onSelectAnswer = ::onSelectAnswer,
|
||||
onPollEdit = ::onPollEdit,
|
||||
onPollEnd = ::onPollEnd,
|
||||
modifier = modifier,
|
||||
|
|
|
|||
|
|
@ -29,14 +29,14 @@ import io.element.android.libraries.ui.strings.CommonStrings
|
|||
@Composable
|
||||
fun TimelineItemRedactedView(
|
||||
@Suppress("UNUSED_PARAMETER") content: TimelineItemRedactedContent,
|
||||
onContentLayoutChanged: (ContentAvoidingLayoutData) -> Unit,
|
||||
onContentLayoutChange: (ContentAvoidingLayoutData) -> Unit,
|
||||
modifier: Modifier = Modifier
|
||||
) {
|
||||
TimelineItemInformativeView(
|
||||
text = stringResource(id = CommonStrings.common_message_removed),
|
||||
iconDescription = stringResource(id = CommonStrings.common_message_removed),
|
||||
iconResourceId = CompoundDrawables.ic_compound_delete,
|
||||
onContentLayoutChanged = onContentLayoutChanged,
|
||||
onContentLayoutChange = onContentLayoutChange,
|
||||
modifier = modifier
|
||||
)
|
||||
}
|
||||
|
|
@ -46,6 +46,6 @@ fun TimelineItemRedactedView(
|
|||
internal fun TimelineItemRedactedViewPreview() = ElementPreview {
|
||||
TimelineItemRedactedView(
|
||||
TimelineItemRedactedContent,
|
||||
onContentLayoutChanged = {},
|
||||
onContentLayoutChange = {},
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,9 +39,9 @@ import io.element.android.wysiwyg.compose.EditorStyledText
|
|||
@Composable
|
||||
fun TimelineItemTextView(
|
||||
content: TimelineItemTextBasedContent,
|
||||
onLinkClicked: (String) -> Unit,
|
||||
onLinkClick: (String) -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
onContentLayoutChanged: (ContentAvoidingLayoutData) -> Unit = {},
|
||||
onContentLayoutChange: (ContentAvoidingLayoutData) -> Unit = {},
|
||||
) {
|
||||
CompositionLocalProvider(
|
||||
LocalContentColor provides ElementTheme.colors.textPrimary,
|
||||
|
|
@ -53,9 +53,9 @@ fun TimelineItemTextView(
|
|||
Box(modifier.semantics { contentDescription = body.toString() }) {
|
||||
EditorStyledText(
|
||||
text = body,
|
||||
onLinkClickedListener = onLinkClicked,
|
||||
onLinkClickedListener = onLinkClick,
|
||||
style = ElementRichTextEditorStyle.textStyle(),
|
||||
onTextLayout = ContentAvoidingLayout.measureLegacyLastTextLine(onContentLayoutChanged = onContentLayoutChanged),
|
||||
onTextLayout = ContentAvoidingLayout.measureLegacyLastTextLine(onContentLayoutChange = onContentLayoutChange),
|
||||
releaseOnDetach = false,
|
||||
)
|
||||
}
|
||||
|
|
@ -69,6 +69,6 @@ internal fun TimelineItemTextViewPreview(
|
|||
) = ElementPreview {
|
||||
TimelineItemTextView(
|
||||
content = content,
|
||||
onLinkClicked = {},
|
||||
onLinkClick = {},
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,14 +29,14 @@ import io.element.android.libraries.ui.strings.CommonStrings
|
|||
@Composable
|
||||
fun TimelineItemUnknownView(
|
||||
@Suppress("UNUSED_PARAMETER") content: TimelineItemUnknownContent,
|
||||
onContentLayoutChanged: (ContentAvoidingLayoutData) -> Unit,
|
||||
onContentLayoutChange: (ContentAvoidingLayoutData) -> Unit,
|
||||
modifier: Modifier = Modifier
|
||||
) {
|
||||
TimelineItemInformativeView(
|
||||
text = stringResource(id = CommonStrings.common_unsupported_event),
|
||||
iconDescription = stringResource(id = CommonStrings.dialog_title_warning),
|
||||
iconResourceId = CompoundDrawables.ic_compound_info_solid,
|
||||
onContentLayoutChanged = onContentLayoutChanged,
|
||||
onContentLayoutChange = onContentLayoutChange,
|
||||
modifier = modifier
|
||||
)
|
||||
}
|
||||
|
|
@ -46,6 +46,6 @@ fun TimelineItemUnknownView(
|
|||
internal fun TimelineItemUnknownViewPreview() = ElementPreview {
|
||||
TimelineItemUnknownView(
|
||||
content = TimelineItemUnknownContent,
|
||||
onContentLayoutChanged = {},
|
||||
onContentLayoutChange = {},
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ import io.element.android.wysiwyg.compose.EditorStyledText
|
|||
@Composable
|
||||
fun TimelineItemVideoView(
|
||||
content: TimelineItemVideoContent,
|
||||
onContentLayoutChanged: (ContentAvoidingLayoutData) -> Unit,
|
||||
onContentLayoutChange: (ContentAvoidingLayoutData) -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
val description = stringResource(CommonStrings.common_image)
|
||||
|
|
@ -131,7 +131,7 @@ fun TimelineItemVideoView(
|
|||
text = caption,
|
||||
style = ElementRichTextEditorStyle.textStyle(),
|
||||
releaseOnDetach = false,
|
||||
onTextLayout = ContentAvoidingLayout.measureLegacyLastTextLine(onContentLayoutChanged = onContentLayoutChanged),
|
||||
onTextLayout = ContentAvoidingLayout.measureLegacyLastTextLine(onContentLayoutChange = onContentLayoutChange),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ import kotlinx.coroutines.delay
|
|||
fun TimelineItemVoiceView(
|
||||
state: VoiceMessageState,
|
||||
content: TimelineItemVoiceContent,
|
||||
onContentLayoutChanged: (ContentAvoidingLayoutData) -> Unit,
|
||||
onContentLayoutChange: (ContentAvoidingLayoutData) -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
fun playPause() {
|
||||
|
|
@ -81,7 +81,7 @@ fun TimelineItemVoiceView(
|
|||
contentDescription = a11y
|
||||
}
|
||||
.onSizeChanged {
|
||||
onContentLayoutChanged(
|
||||
onContentLayoutChange(
|
||||
ContentAvoidingLayoutData(
|
||||
contentWidth = it.width,
|
||||
contentHeight = it.height,
|
||||
|
|
@ -258,7 +258,7 @@ internal fun TimelineItemVoiceViewPreview(
|
|||
TimelineItemVoiceView(
|
||||
state = timelineItemVoiceViewParameters.state,
|
||||
content = timelineItemVoiceViewParameters.content,
|
||||
onContentLayoutChanged = {},
|
||||
onContentLayoutChange = {},
|
||||
)
|
||||
}
|
||||
|
||||
|
|
@ -271,7 +271,7 @@ internal fun TimelineItemVoiceViewUnifiedPreview() = ElementPreview {
|
|||
TimelineItemVoiceView(
|
||||
state = it.state,
|
||||
content = it.content,
|
||||
onContentLayoutChanged = {},
|
||||
onContentLayoutChange = {},
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -136,26 +136,26 @@ interface ContentAvoidingLayoutScope {
|
|||
/**
|
||||
* It should be called when the content layout changes, so it can update the [ContentAvoidingLayoutData] and measure and layout the content properly.
|
||||
*/
|
||||
fun onContentLayoutChanged(data: ContentAvoidingLayoutData)
|
||||
fun onContentLayoutChange(data: ContentAvoidingLayoutData)
|
||||
}
|
||||
|
||||
private class ContentAvoidingLayoutScopeInstance(
|
||||
val data: MutableState<ContentAvoidingLayoutData> = mutableStateOf(ContentAvoidingLayoutData()),
|
||||
) : ContentAvoidingLayoutScope {
|
||||
override fun onContentLayoutChanged(data: ContentAvoidingLayoutData) {
|
||||
override fun onContentLayoutChange(data: ContentAvoidingLayoutData) {
|
||||
this.data.value = data
|
||||
}
|
||||
}
|
||||
|
||||
object ContentAvoidingLayout {
|
||||
/**
|
||||
* Measures the last line of a [TextLayoutResult] and calls [onContentLayoutChanged] with the [ContentAvoidingLayoutData].
|
||||
* Measures the last line of a [TextLayoutResult] and calls [onContentLayoutChange] with the [ContentAvoidingLayoutData].
|
||||
*
|
||||
* This is supposed to be used in the `onTextLayout` parameter of a Text based component.
|
||||
*/
|
||||
@Composable
|
||||
internal fun measureLastTextLine(
|
||||
onContentLayoutChanged: (ContentAvoidingLayoutData) -> Unit,
|
||||
onContentLayoutChange: (ContentAvoidingLayoutData) -> Unit,
|
||||
extraWidth: Dp = 0.dp,
|
||||
): ((TextLayoutResult) -> Unit) {
|
||||
val layoutDirection = LocalLayoutDirection.current
|
||||
|
|
@ -167,7 +167,7 @@ object ContentAvoidingLayout {
|
|||
LayoutDirection.Rtl -> textLayout.getLineLeft(textLayout.lineCount - 1).roundToInt()
|
||||
}
|
||||
val lastLineHeight = textLayout.getLineBottom(textLayout.lineCount - 1).roundToInt()
|
||||
onContentLayoutChanged(
|
||||
onContentLayoutChange(
|
||||
ContentAvoidingLayoutData(
|
||||
contentWidth = textLayout.size.width + extraWidthPx,
|
||||
contentHeight = textLayout.size.height,
|
||||
|
|
@ -179,13 +179,13 @@ object ContentAvoidingLayout {
|
|||
}
|
||||
|
||||
/**
|
||||
* Measures the last line of a [Layout] and calls [onContentLayoutChanged] with the [ContentAvoidingLayoutData].
|
||||
* Measures the last line of a [Layout] and calls [onContentLayoutChange] with the [ContentAvoidingLayoutData].
|
||||
*
|
||||
* This is supposed to be used in the `onTextLayout` parameter of an [EditorStyledText] component.
|
||||
*/
|
||||
@Composable
|
||||
internal fun measureLegacyLastTextLine(
|
||||
onContentLayoutChanged: (ContentAvoidingLayoutData) -> Unit,
|
||||
onContentLayoutChange: (ContentAvoidingLayoutData) -> Unit,
|
||||
extraWidth: Dp = 0.dp,
|
||||
): ((Layout) -> Unit) {
|
||||
val extraWidthPx = extraWidth.roundToPx()
|
||||
|
|
@ -193,7 +193,7 @@ object ContentAvoidingLayout {
|
|||
// We need to add the external extra width so it's not taken into account as 'free space'
|
||||
val lastLineWidth = textLayout.getLineWidth(textLayout.lineCount - 1).roundToInt()
|
||||
val lastLineHeight = textLayout.getLineBottom(textLayout.lineCount - 1)
|
||||
onContentLayoutChanged(
|
||||
onContentLayoutChange(
|
||||
ContentAvoidingLayoutData(
|
||||
contentWidth = textLayout.width + extraWidthPx,
|
||||
contentHeight = textLayout.height,
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ import kotlinx.collections.immutable.ImmutableList
|
|||
fun TimelineItemReadReceiptView(
|
||||
state: ReadReceiptViewState,
|
||||
renderReadReceipts: Boolean,
|
||||
onReadReceiptsClicked: () -> Unit,
|
||||
onReadReceiptsClick: () -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
if (state.receipts.isNotEmpty()) {
|
||||
|
|
@ -73,7 +73,7 @@ fun TimelineItemReadReceiptView(
|
|||
.testTag(TestTags.messageReadReceipts)
|
||||
.clip(RoundedCornerShape(4.dp))
|
||||
.clickable {
|
||||
onReadReceiptsClicked()
|
||||
onReadReceiptsClick()
|
||||
}
|
||||
.padding(2.dp)
|
||||
)
|
||||
|
|
@ -213,6 +213,6 @@ internal fun TimelineItemReadReceiptViewPreview(
|
|||
TimelineItemReadReceiptView(
|
||||
state = state,
|
||||
renderReadReceipts = true,
|
||||
onReadReceiptsClicked = {},
|
||||
onReadReceiptsClick = {},
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ import kotlinx.coroutines.launch
|
|||
@Composable
|
||||
internal fun ReadReceiptBottomSheet(
|
||||
state: ReadReceiptBottomSheetState,
|
||||
onUserDataClicked: (UserId) -> Unit,
|
||||
onUserDataClick: (UserId) -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
val isVisible = state.selectedEvent != null
|
||||
|
|
@ -69,11 +69,11 @@ internal fun ReadReceiptBottomSheet(
|
|||
) {
|
||||
ReadReceiptBottomSheetContent(
|
||||
state = state,
|
||||
onUserDataClicked = {
|
||||
onUserDataClick = {
|
||||
coroutineScope.launch {
|
||||
sheetState.hide()
|
||||
state.eventSink(ReadReceiptBottomSheetEvents.Dismiss)
|
||||
onUserDataClicked.invoke(it)
|
||||
onUserDataClick.invoke(it)
|
||||
}
|
||||
},
|
||||
)
|
||||
|
|
@ -86,7 +86,7 @@ internal fun ReadReceiptBottomSheet(
|
|||
@Composable
|
||||
private fun ReadReceiptBottomSheetContent(
|
||||
state: ReadReceiptBottomSheetState,
|
||||
onUserDataClicked: (UserId) -> Unit,
|
||||
onUserDataClick: (UserId) -> Unit,
|
||||
) {
|
||||
LazyColumn {
|
||||
item {
|
||||
|
|
@ -101,7 +101,7 @@ private fun ReadReceiptBottomSheetContent(
|
|||
) {
|
||||
val userId = UserId(it.avatarData.id)
|
||||
MatrixUserRow(
|
||||
modifier = Modifier.clickable { onUserDataClicked(userId) },
|
||||
modifier = Modifier.clickable { onUserDataClick(userId) },
|
||||
matrixUser = MatrixUser(
|
||||
userId = userId,
|
||||
displayName = it.avatarData.name,
|
||||
|
|
@ -127,7 +127,7 @@ internal fun ReadReceiptBottomSheetPreview(@PreviewParameter(ReadReceiptBottomSh
|
|||
Column {
|
||||
ReadReceiptBottomSheetContent(
|
||||
state = state,
|
||||
onUserDataClicked = {},
|
||||
onUserDataClick = {},
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ class EventDebugInfoNode @AssistedInject constructor(
|
|||
|
||||
private val inputs = inputs<Inputs>()
|
||||
|
||||
private fun onBackPressed() {
|
||||
private fun onBackClick() {
|
||||
navigateUp()
|
||||
}
|
||||
|
||||
|
|
@ -53,7 +53,7 @@ class EventDebugInfoNode @AssistedInject constructor(
|
|||
model = timelineItemDebugInfo.model,
|
||||
originalJson = timelineItemDebugInfo.originalJson,
|
||||
latestEditedJson = timelineItemDebugInfo.latestEditedJson,
|
||||
onBackPressed = ::onBackPressed
|
||||
onBackClick = ::onBackClick
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ fun EventDebugInfoView(
|
|||
model: String,
|
||||
originalJson: String?,
|
||||
latestEditedJson: String?,
|
||||
onBackPressed: () -> Unit,
|
||||
onBackClick: () -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
isTest: Boolean = false,
|
||||
) {
|
||||
|
|
@ -87,7 +87,7 @@ fun EventDebugInfoView(
|
|||
style = ElementTheme.typography.aliasScreenTitle,
|
||||
)
|
||||
},
|
||||
navigationIcon = { BackButton(onClick = onBackPressed) }
|
||||
navigationIcon = { BackButton(onClick = onBackClick) }
|
||||
)
|
||||
},
|
||||
modifier = modifier
|
||||
|
|
@ -190,6 +190,6 @@ internal fun EventDebugInfoViewPreview() = ElementPreview {
|
|||
model = "Rust(\n\tModel()\n)",
|
||||
originalJson = "{\"name\": \"original\"}",
|
||||
latestEditedJson = "{\"name\": \"edited\"}",
|
||||
onBackPressed = { }
|
||||
onBackClick = { }
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,14 +30,14 @@ internal fun MessagesViewWithTypingPreview(
|
|||
) = ElementPreview {
|
||||
MessagesView(
|
||||
state = aMessagesState().copy(typingNotificationState = typingState),
|
||||
onBackPressed = {},
|
||||
onRoomDetailsClicked = {},
|
||||
onEventClicked = { false },
|
||||
onBackClick = {},
|
||||
onRoomDetailsClick = {},
|
||||
onEventClick = { false },
|
||||
onPreviewAttachments = {},
|
||||
onUserDataClicked = {},
|
||||
onLinkClicked = {},
|
||||
onSendLocationClicked = {},
|
||||
onCreatePollClicked = {},
|
||||
onJoinCallClicked = {},
|
||||
onUserDataClick = {},
|
||||
onLinkClick = {},
|
||||
onSendLocationClick = {},
|
||||
onCreatePollClick = {},
|
||||
onJoinCallClick = {},
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ internal fun VoiceMessagePermissionRationaleDialog(
|
|||
) {
|
||||
ConfirmationDialog(
|
||||
content = stringResource(CommonStrings.error_missing_microphone_voice_rationale_android, appName),
|
||||
onSubmitClicked = onContinue,
|
||||
onSubmitClick = onContinue,
|
||||
onDismiss = onDismiss,
|
||||
submitText = stringResource(CommonStrings.action_continue),
|
||||
cancelText = stringResource(CommonStrings.action_cancel),
|
||||
|
|
|
|||
|
|
@ -33,19 +33,19 @@ class FakeMessagesNavigator : MessagesNavigator {
|
|||
var onEditPollClickedCount = 0
|
||||
private set
|
||||
|
||||
override fun onShowEventDebugInfoClicked(eventId: EventId?, debugInfo: TimelineItemDebugInfo) {
|
||||
override fun onShowEventDebugInfoClick(eventId: EventId?, debugInfo: TimelineItemDebugInfo) {
|
||||
onShowEventDebugInfoClickedCount++
|
||||
}
|
||||
|
||||
override fun onForwardEventClicked(eventId: EventId) {
|
||||
override fun onForwardEventClick(eventId: EventId) {
|
||||
onForwardEventClickedCount++
|
||||
}
|
||||
|
||||
override fun onReportContentClicked(eventId: EventId, senderId: UserId) {
|
||||
override fun onReportContentClick(eventId: EventId, senderId: UserId) {
|
||||
onReportContentClickedCount++
|
||||
}
|
||||
|
||||
override fun onEditPollClicked(eventId: EventId) {
|
||||
override fun onEditPollClick(eventId: EventId) {
|
||||
onEditPollClickedCount++
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ class MessagesViewTest {
|
|||
ensureCalledOnce { callback ->
|
||||
rule.setMessagesView(
|
||||
state = state,
|
||||
onBackPressed = callback,
|
||||
onBackClick = callback,
|
||||
)
|
||||
rule.pressBack()
|
||||
}
|
||||
|
|
@ -103,7 +103,7 @@ class MessagesViewTest {
|
|||
ensureCalledOnce { callback ->
|
||||
rule.setMessagesView(
|
||||
state = state,
|
||||
onRoomDetailsClicked = callback,
|
||||
onRoomDetailsClick = callback,
|
||||
)
|
||||
rule.onNodeWithText(state.roomName.dataOrNull().orEmpty()).performClick()
|
||||
}
|
||||
|
|
@ -118,7 +118,7 @@ class MessagesViewTest {
|
|||
ensureCalledOnce { callback ->
|
||||
rule.setMessagesView(
|
||||
state = state,
|
||||
onJoinCallClicked = callback,
|
||||
onJoinCallClick = callback,
|
||||
)
|
||||
val joinCallContentDescription = rule.activity.getString(CommonStrings.a11y_start_call)
|
||||
rule.onNodeWithContentDescription(joinCallContentDescription).performClick()
|
||||
|
|
@ -138,7 +138,7 @@ class MessagesViewTest {
|
|||
)
|
||||
rule.setMessagesView(
|
||||
state = state,
|
||||
onEventClicked = callback,
|
||||
onEventClick = callback,
|
||||
)
|
||||
// Cannot perform click on "Text", it's not detected. Use tag instead
|
||||
rule.onAllNodesWithTag(TestTags.messageBubble.value).onFirst().performClick()
|
||||
|
|
@ -287,7 +287,7 @@ class MessagesViewTest {
|
|||
ensureCalledOnce { callback ->
|
||||
rule.setMessagesView(
|
||||
state = state,
|
||||
onSendLocationClicked = callback,
|
||||
onSendLocationClick = callback,
|
||||
)
|
||||
rule.clickOn(R.string.screen_room_attachment_source_location)
|
||||
}
|
||||
|
|
@ -305,7 +305,7 @@ class MessagesViewTest {
|
|||
ensureCalledOnce { callback ->
|
||||
rule.setMessagesView(
|
||||
state = state,
|
||||
onCreatePollClicked = callback,
|
||||
onCreatePollClick = callback,
|
||||
)
|
||||
// Then click on the poll action
|
||||
rule.clickOn(R.string.screen_room_attachment_source_poll)
|
||||
|
|
@ -324,7 +324,7 @@ class MessagesViewTest {
|
|||
) { callback ->
|
||||
rule.setMessagesView(
|
||||
state = state,
|
||||
onUserDataClicked = callback,
|
||||
onUserDataClick = callback,
|
||||
)
|
||||
rule.onNodeWithTag(TestTags.timelineItemSenderInfo.value).performClick()
|
||||
}
|
||||
|
|
@ -474,30 +474,30 @@ class MessagesViewTest {
|
|||
|
||||
private fun <R : TestRule> AndroidComposeTestRule<R, ComponentActivity>.setMessagesView(
|
||||
state: MessagesState,
|
||||
onBackPressed: () -> Unit = EnsureNeverCalled(),
|
||||
onRoomDetailsClicked: () -> Unit = EnsureNeverCalled(),
|
||||
onEventClicked: (event: TimelineItem.Event) -> Boolean = EnsureNeverCalledWithParamAndResult(),
|
||||
onUserDataClicked: (UserId) -> Unit = EnsureNeverCalledWithParam(),
|
||||
onLinkClicked: (String) -> Unit = EnsureNeverCalledWithParam(),
|
||||
onBackClick: () -> Unit = EnsureNeverCalled(),
|
||||
onRoomDetailsClick: () -> Unit = EnsureNeverCalled(),
|
||||
onEventClick: (event: TimelineItem.Event) -> Boolean = EnsureNeverCalledWithParamAndResult(),
|
||||
onUserDataClick: (UserId) -> Unit = EnsureNeverCalledWithParam(),
|
||||
onLinkClick: (String) -> Unit = EnsureNeverCalledWithParam(),
|
||||
onPreviewAttachments: (ImmutableList<Attachment>) -> Unit = EnsureNeverCalledWithParam(),
|
||||
onSendLocationClicked: () -> Unit = EnsureNeverCalled(),
|
||||
onCreatePollClicked: () -> Unit = EnsureNeverCalled(),
|
||||
onJoinCallClicked: () -> Unit = EnsureNeverCalled(),
|
||||
onSendLocationClick: () -> Unit = EnsureNeverCalled(),
|
||||
onCreatePollClick: () -> Unit = EnsureNeverCalled(),
|
||||
onJoinCallClick: () -> Unit = EnsureNeverCalled(),
|
||||
) {
|
||||
setContent {
|
||||
// Cannot use the RichTextEditor, so simulate a LocalInspectionMode
|
||||
CompositionLocalProvider(LocalInspectionMode provides true) {
|
||||
MessagesView(
|
||||
state = state,
|
||||
onBackPressed = onBackPressed,
|
||||
onRoomDetailsClicked = onRoomDetailsClicked,
|
||||
onEventClicked = onEventClicked,
|
||||
onUserDataClicked = onUserDataClicked,
|
||||
onLinkClicked = onLinkClicked,
|
||||
onBackClick = onBackClick,
|
||||
onRoomDetailsClick = onRoomDetailsClick,
|
||||
onEventClick = onEventClick,
|
||||
onUserDataClick = onUserDataClick,
|
||||
onLinkClick = onLinkClick,
|
||||
onPreviewAttachments = onPreviewAttachments,
|
||||
onSendLocationClicked = onSendLocationClicked,
|
||||
onCreatePollClicked = onCreatePollClicked,
|
||||
onJoinCallClicked = onJoinCallClicked,
|
||||
onSendLocationClick = onSendLocationClick,
|
||||
onCreatePollClick = onCreatePollClick,
|
||||
onJoinCallClick = onJoinCallClick,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -101,15 +101,15 @@ class TimelineViewTest {
|
|||
private fun <R : TestRule> AndroidComposeTestRule<R, ComponentActivity>.setTimelineView(
|
||||
state: TimelineState,
|
||||
typingNotificationState: TypingNotificationState = aTypingNotificationState(),
|
||||
onUserDataClicked: (UserId) -> Unit = EnsureNeverCalledWithParam(),
|
||||
onLinkClicked: (String) -> Unit = EnsureNeverCalledWithParam(),
|
||||
onMessageClicked: (TimelineItem.Event) -> Unit = EnsureNeverCalledWithParam(),
|
||||
onMessageLongClicked: (TimelineItem.Event) -> Unit = EnsureNeverCalledWithParam(),
|
||||
onTimestampClicked: (TimelineItem.Event) -> Unit = EnsureNeverCalledWithParam(),
|
||||
onUserDataClick: (UserId) -> Unit = EnsureNeverCalledWithParam(),
|
||||
onLinkClick: (String) -> Unit = EnsureNeverCalledWithParam(),
|
||||
onMessageClick: (TimelineItem.Event) -> Unit = EnsureNeverCalledWithParam(),
|
||||
onMessageLongClick: (TimelineItem.Event) -> Unit = EnsureNeverCalledWithParam(),
|
||||
onTimestampClick: (TimelineItem.Event) -> Unit = EnsureNeverCalledWithParam(),
|
||||
onSwipeToReply: (TimelineItem.Event) -> Unit = EnsureNeverCalledWithParam(),
|
||||
onReactionClicked: (emoji: String, TimelineItem.Event) -> Unit = EnsureNeverCalledWithTwoParams(),
|
||||
onReactionLongClicked: (emoji: String, TimelineItem.Event) -> Unit = EnsureNeverCalledWithTwoParams(),
|
||||
onMoreReactionsClicked: (TimelineItem.Event) -> Unit = EnsureNeverCalledWithParam(),
|
||||
onReactionClick: (emoji: String, TimelineItem.Event) -> Unit = EnsureNeverCalledWithTwoParams(),
|
||||
onReactionLongClick: (emoji: String, TimelineItem.Event) -> Unit = EnsureNeverCalledWithTwoParams(),
|
||||
onMoreReactionsClick: (TimelineItem.Event) -> Unit = EnsureNeverCalledWithParam(),
|
||||
onReadReceiptClick: (TimelineItem.Event) -> Unit = EnsureNeverCalledWithParam(),
|
||||
forceJumpToBottomVisibility: Boolean = false,
|
||||
) {
|
||||
|
|
@ -117,15 +117,15 @@ private fun <R : TestRule> AndroidComposeTestRule<R, ComponentActivity>.setTimel
|
|||
TimelineView(
|
||||
state = state,
|
||||
typingNotificationState = typingNotificationState,
|
||||
onUserDataClicked = onUserDataClicked,
|
||||
onLinkClicked = onLinkClicked,
|
||||
onMessageClicked = onMessageClicked,
|
||||
onMessageLongClicked = onMessageLongClicked,
|
||||
onTimestampClicked = onTimestampClicked,
|
||||
onUserDataClick = onUserDataClick,
|
||||
onLinkClick = onLinkClick,
|
||||
onMessageClick = onMessageClick,
|
||||
onMessageLongClick = onMessageLongClick,
|
||||
onTimestampClick = onTimestampClick,
|
||||
onSwipeToReply = onSwipeToReply,
|
||||
onReactionClicked = onReactionClicked,
|
||||
onReactionLongClicked = onReactionLongClicked,
|
||||
onMoreReactionsClicked = onMoreReactionsClicked,
|
||||
onReactionClick = onReactionClick,
|
||||
onReactionLongClick = onReactionLongClick,
|
||||
onMoreReactionsClick = onMoreReactionsClick,
|
||||
onReadReceiptClick = onReadReceiptClick,
|
||||
forceJumpToBottomVisibility = forceJumpToBottomVisibility,
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue