Branch signout
This commit is contained in:
parent
a609433a50
commit
6230a31fdf
2 changed files with 17 additions and 4 deletions
|
|
@ -4,6 +4,7 @@ import androidx.compose.runtime.Composable
|
|||
import com.ramcosta.composedestinations.annotation.Destination
|
||||
import com.ramcosta.composedestinations.annotation.RootNavGraph
|
||||
import com.ramcosta.composedestinations.navigation.DestinationsNavigator
|
||||
import io.element.android.x.destinations.LoginScreenNavigationDestination
|
||||
import io.element.android.x.destinations.RoomListScreenNavigationDestination
|
||||
import io.element.android.x.features.login.LoginScreen
|
||||
import io.element.android.x.features.roomlist.RoomListScreen
|
||||
|
|
@ -21,8 +22,10 @@ fun LoginScreenNavigation(navigator: DestinationsNavigator) {
|
|||
@RootNavGraph(start = true)
|
||||
@Destination
|
||||
@Composable
|
||||
fun RoomListScreenNavigation() {
|
||||
RoomListScreen()
|
||||
fun RoomListScreenNavigation(navigator: DestinationsNavigator) {
|
||||
RoomListScreen(onSuccessLogout = {
|
||||
navigator.clearBackStack(LoginScreenNavigationDestination)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -23,11 +23,21 @@ import io.element.android.x.matrix.room.RoomSummary
|
|||
@Composable
|
||||
fun RoomListScreen(
|
||||
viewModel: RoomListViewModel = mavericksViewModel(),
|
||||
onLogoutClicked: () -> Unit = { },
|
||||
onSuccessLogout: () -> Unit = { },
|
||||
onRoomClicked: (RoomId) -> Unit = { }
|
||||
) {
|
||||
val state by viewModel.collectAsState()
|
||||
RoomListContent(state, onRoomClicked, onLogoutClicked)
|
||||
if (state.logoutAction is Success) {
|
||||
onSuccessLogout()
|
||||
return
|
||||
}
|
||||
RoomListContent(
|
||||
state = state,
|
||||
onRoomClicked = onRoomClicked,
|
||||
onLogoutClicked = {
|
||||
viewModel.handle(RoomListActions.Logout)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
@Composable
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue