Rename fun in Callback for clarity.
This commit is contained in:
committed by
Benoit Marty
parent
45b5783b23
commit
09a18ad7ca
@@ -21,7 +21,7 @@ interface StartChatEntryPoint : FeatureEntryPoint {
|
||||
}
|
||||
|
||||
interface Callback : Plugin {
|
||||
fun onOpenRoom(roomIdOrAlias: RoomIdOrAlias, serverNames: List<String>)
|
||||
fun onOpenRoomDirectory()
|
||||
fun onRoomCreated(roomIdOrAlias: RoomIdOrAlias, serverNames: List<String>)
|
||||
fun navigateToRoomDirectory()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ import io.element.android.libraries.architecture.overlay.operation.show
|
||||
import io.element.android.libraries.matrix.api.core.RoomIdOrAlias
|
||||
|
||||
interface StartChatNavigator : Plugin {
|
||||
fun onOpenRoom(roomIdOrAlias: RoomIdOrAlias, serverNames: List<String>)
|
||||
fun onRoomCreated(roomIdOrAlias: RoomIdOrAlias, serverNames: List<String>)
|
||||
fun onCreateNewRoom()
|
||||
fun onShowJoinRoomByAddress()
|
||||
fun onDismissJoinRoomByAddress()
|
||||
@@ -30,7 +30,8 @@ class DefaultStartChatNavigator(
|
||||
private val openRoom: (RoomIdOrAlias, List<String>) -> Unit,
|
||||
private val openRoomDirectory: () -> Unit,
|
||||
) : StartChatNavigator {
|
||||
override fun onOpenRoom(roomIdOrAlias: RoomIdOrAlias, serverNames: List<String>) = openRoom(roomIdOrAlias, serverNames)
|
||||
override fun onRoomCreated(roomIdOrAlias: RoomIdOrAlias, serverNames: List<String>) =
|
||||
openRoom(roomIdOrAlias, serverNames)
|
||||
|
||||
override fun onOpenRoomDirectory() = openRoomDirectory()
|
||||
|
||||
|
||||
@@ -64,10 +64,10 @@ class StartChatFlowNode(
|
||||
backstack = backstack,
|
||||
overlay = overlay,
|
||||
openRoom = { roomIdOrAlias, viaServers ->
|
||||
plugins<StartChatEntryPoint.Callback>().forEach { it.onOpenRoom(roomIdOrAlias, viaServers) }
|
||||
plugins<StartChatEntryPoint.Callback>().forEach { it.onRoomCreated(roomIdOrAlias, viaServers) }
|
||||
},
|
||||
openRoomDirectory = {
|
||||
plugins<StartChatEntryPoint.Callback>().forEach { it.onOpenRoomDirectory() }
|
||||
plugins<StartChatEntryPoint.Callback>().forEach { it.navigateToRoomDirectory() }
|
||||
}
|
||||
)
|
||||
|
||||
@@ -79,7 +79,7 @@ class StartChatFlowNode(
|
||||
NavTarget.NewRoom -> {
|
||||
val callback = object : CreateRoomEntryPoint.Callback {
|
||||
override fun onRoomCreated(roomId: RoomId) {
|
||||
navigator.onOpenRoom(roomId.toRoomIdOrAlias(), emptyList())
|
||||
navigator.onRoomCreated(roomId.toRoomIdOrAlias(), emptyList())
|
||||
}
|
||||
}
|
||||
createRoomEntryPoint.nodeBuilder(parentNode = this, buildContext = buildContext)
|
||||
|
||||
@@ -94,7 +94,7 @@ class JoinRoomByAddressPresenter(
|
||||
|
||||
private fun onRoomFound(state: RoomAddressState.RoomFound) {
|
||||
navigator.onDismissJoinRoomByAddress()
|
||||
navigator.onOpenRoom(
|
||||
navigator.onRoomCreated(
|
||||
roomIdOrAlias = state.resolved.roomId.toRoomIdOrAlias(),
|
||||
serverNames = state.resolved.servers
|
||||
)
|
||||
|
||||
@@ -53,7 +53,7 @@ class StartChatNode(
|
||||
onCloseClick = this::navigateUp,
|
||||
onNewRoomClick = navigator::onCreateNewRoom,
|
||||
onOpenDM = {
|
||||
navigator.onOpenRoom(roomIdOrAlias = it.toRoomIdOrAlias(), serverNames = emptyList())
|
||||
navigator.onRoomCreated(roomIdOrAlias = it.toRoomIdOrAlias(), serverNames = emptyList())
|
||||
},
|
||||
onJoinByAddressClick = navigator::onShowJoinRoomByAddress,
|
||||
onInviteFriendsClick = { invitePeople(activity) },
|
||||
|
||||
@@ -40,8 +40,8 @@ class DefaultStartChatEntryPointTest {
|
||||
)
|
||||
}
|
||||
val callback = object : StartChatEntryPoint.Callback {
|
||||
override fun onOpenRoom(roomIdOrAlias: RoomIdOrAlias, serverNames: List<String>) = lambdaError()
|
||||
override fun onOpenRoomDirectory() = lambdaError()
|
||||
override fun onRoomCreated(roomIdOrAlias: RoomIdOrAlias, serverNames: List<String>) = lambdaError()
|
||||
override fun navigateToRoomDirectory() = lambdaError()
|
||||
}
|
||||
val result = entryPoint.nodeBuilder(parentNode, BuildContext.root(null))
|
||||
.callback(callback)
|
||||
|
||||
@@ -17,7 +17,7 @@ class FakeStartChatNavigator(
|
||||
private val dismissJoinRoomByAddressLambda: () -> Unit = {},
|
||||
private val openRoomDirectoryLambda: () -> Unit = {},
|
||||
) : StartChatNavigator {
|
||||
override fun onOpenRoom(roomIdOrAlias: RoomIdOrAlias, serverNames: List<String>) {
|
||||
override fun onRoomCreated(roomIdOrAlias: RoomIdOrAlias, serverNames: List<String>) {
|
||||
openRoomLambda(roomIdOrAlias, serverNames)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user