Room list contextual menu (#427)
- Adds `ModalBottomSheet` to our design components (it wraps the homonimous Material3 one). - Adds a bottom sheet to the Room list using the aforementioned design component. - Adds navigation from the room list to a room detail (context menu "Settings" action). - Consolidates the "leave room flow" into a new `leaveroom` module used by both the room list and the room details. - Adds progress indicator to the leave room flow - Uses new `leaveroom` module in `roomdetails` module too. Parent issue: - https://github.com/vector-im/element-x-android/issues/261
This commit is contained in:
parent
897540ed04
commit
0dee0784ba
60 changed files with 1462 additions and 250 deletions
|
|
@ -135,7 +135,10 @@ class LoggedInFlowNode @AssistedInject constructor(
|
|||
object RoomList : NavTarget
|
||||
|
||||
@Parcelize
|
||||
data class Room(val roomId: RoomId) : NavTarget
|
||||
data class Room(
|
||||
val roomId: RoomId,
|
||||
val initialElement: RoomFlowNode.NavTarget = RoomFlowNode.NavTarget.Messages
|
||||
) : NavTarget
|
||||
|
||||
@Parcelize
|
||||
object Settings : NavTarget
|
||||
|
|
@ -176,6 +179,10 @@ class LoggedInFlowNode @AssistedInject constructor(
|
|||
override fun onInvitesClicked() {
|
||||
backstack.push(NavTarget.InviteList)
|
||||
}
|
||||
|
||||
override fun onRoomSettingsClicked(roomId: RoomId) {
|
||||
backstack.push(NavTarget.Room(roomId, initialElement = RoomFlowNode.NavTarget.RoomDetails))
|
||||
}
|
||||
}
|
||||
roomListEntryPoint
|
||||
.nodeBuilder(this, buildContext)
|
||||
|
|
@ -193,7 +200,7 @@ class LoggedInFlowNode @AssistedInject constructor(
|
|||
}
|
||||
} else {
|
||||
val nodeLifecycleCallbacks = plugins<NodeLifecycleCallback>()
|
||||
val inputs = RoomFlowNode.Inputs(room)
|
||||
val inputs = RoomFlowNode.Inputs(room, initialElement = navTarget.initialElement)
|
||||
createNode<RoomFlowNode>(buildContext, plugins = listOf(inputs) + nodeLifecycleCallbacks)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ class RoomFlowNode @AssistedInject constructor(
|
|||
roomMembershipObserver: RoomMembershipObserver,
|
||||
) : BackstackNode<RoomFlowNode.NavTarget>(
|
||||
backstack = BackStack(
|
||||
initialElement = NavTarget.Messages,
|
||||
initialElement = plugins.filterIsInstance(Inputs::class.java).first().initialElement,
|
||||
savedStateMap = buildContext.savedStateMap,
|
||||
),
|
||||
buildContext = buildContext,
|
||||
|
|
@ -73,6 +73,7 @@ class RoomFlowNode @AssistedInject constructor(
|
|||
|
||||
data class Inputs(
|
||||
val room: MatrixRoom,
|
||||
val initialElement: NavTarget = NavTarget.Messages,
|
||||
) : NodeInputs
|
||||
|
||||
private val inputs: Inputs = inputs()
|
||||
|
|
@ -98,6 +99,7 @@ class RoomFlowNode @AssistedInject constructor(
|
|||
navigateUp()
|
||||
}
|
||||
.launchIn(lifecycleScope)
|
||||
inputs<Inputs>()
|
||||
}
|
||||
|
||||
private fun fetchRoomMembers() = lifecycleScope.launch {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue