mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-04 10:32:34 +00:00
Add Forward action to MediaDetailsBottomSheet. Closes #5454
Improve API of Callback when forwarding Event.
This commit is contained in:
committed by
Benoit Marty
parent
7f22777ad9
commit
95c735a90e
+2
-1
@@ -13,6 +13,7 @@ import com.bumble.appyx.core.node.Node
|
||||
import com.bumble.appyx.core.plugin.Plugin
|
||||
import io.element.android.libraries.architecture.FeatureEntryPoint
|
||||
import io.element.android.libraries.architecture.NodeInputs
|
||||
import io.element.android.libraries.matrix.api.core.EventId
|
||||
import io.element.android.libraries.matrix.api.core.RoomId
|
||||
import io.element.android.libraries.matrix.api.core.UserId
|
||||
import io.element.android.libraries.matrix.api.permalink.PermalinkData
|
||||
@@ -36,7 +37,7 @@ interface RoomDetailsEntryPoint : FeatureEntryPoint {
|
||||
fun onOpenGlobalNotificationSettings()
|
||||
fun onOpenRoom(roomId: RoomId, serverNames: List<String>)
|
||||
fun onPermalinkClick(data: PermalinkData, pushToBackstack: Boolean)
|
||||
fun onForwardedToSingleRoom(roomId: RoomId)
|
||||
fun forwardEvent(eventId: EventId)
|
||||
}
|
||||
|
||||
interface NodeBuilder {
|
||||
|
||||
+14
-2
@@ -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)
|
||||
|
||||
+1
-1
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user