Add Forward action to MediaDetailsBottomSheet. Closes #5454

Improve API of Callback when forwarding Event.
This commit is contained in:
Benoit Marty 2025-10-28 16:02:37 +01:00 committed by Benoit Marty
parent e9cfce915a
commit 21bae4aee2
35 changed files with 190 additions and 36 deletions

View file

@ -294,6 +294,10 @@ class RoomDetailsFlowNode(
override fun onViewInTimeline(eventId: EventId) {
// Cannot happen
}
override fun onForwardEvent(eventId: EventId) {
// Cannot happen
}
}
mediaViewerEntryPoint.nodeBuilder(this, buildContext)
.avatar(
@ -321,6 +325,10 @@ class RoomDetailsFlowNode(
it.onPermalinkClick(permalinkData, pushToBackstack = false)
}
}
override fun forwardEvent(eventId: EventId) {
plugins<RoomDetailsEntryPoint.Callback>().forEach { it.forwardEvent(eventId) }
}
}
mediaGalleryEntryPoint.nodeBuilder(this, buildContext)
.callback(callback)
@ -343,8 +351,12 @@ class RoomDetailsFlowNode(
plugins<RoomDetailsEntryPoint.Callback>().forEach { it.onPermalinkClick(data, pushToBackstack) }
}
override fun onForwardedToSingleRoom(roomId: RoomId) {
plugins<RoomDetailsEntryPoint.Callback>().forEach { it.onForwardedToSingleRoom(roomId) }
override fun forwardEvent(eventId: EventId) {
plugins<RoomDetailsEntryPoint.Callback>().forEach { it.forwardEvent(eventId) }
}
override fun openRoom(roomId: RoomId) {
plugins<RoomDetailsEntryPoint.Callback>().forEach { it.onOpenRoom(roomId, emptyList()) }
}
}
return messagesEntryPoint.nodeBuilder(this, buildContext)

View file

@ -97,7 +97,7 @@ class DefaultRoomDetailsEntryPointTest {
override fun onOpenGlobalNotificationSettings() = lambdaError()
override fun onOpenRoom(roomId: RoomId, serverNames: List<String>) = lambdaError()
override fun onPermalinkClick(data: PermalinkData, pushToBackstack: Boolean) = lambdaError()
override fun onForwardedToSingleRoom(roomId: RoomId) = lambdaError()
override fun forwardEvent(eventId: EventId) = lambdaError()
}
val params = RoomDetailsEntryPoint.Params(
initialElement = RoomDetailsEntryPoint.InitialTarget.RoomDetails,