Fix bunch of issues around login/logout and introduces messages feature
This commit is contained in:
parent
b5e4ef9637
commit
d04d847521
19 changed files with 314 additions and 89 deletions
|
|
@ -4,17 +4,25 @@ import androidx.compose.runtime.Composable
|
|||
import com.ramcosta.composedestinations.annotation.Destination
|
||||
import com.ramcosta.composedestinations.annotation.RootNavGraph
|
||||
import com.ramcosta.composedestinations.navigation.DestinationsNavigator
|
||||
import com.ramcosta.composedestinations.navigation.popUpTo
|
||||
import io.element.android.x.destinations.LoginScreenNavigationDestination
|
||||
import io.element.android.x.destinations.MessagesScreenNavigationDestination
|
||||
import io.element.android.x.destinations.RoomListScreenNavigationDestination
|
||||
import io.element.android.x.features.login.LoginScreen
|
||||
import io.element.android.x.features.messages.MessagesScreen
|
||||
import io.element.android.x.features.roomlist.RoomListScreen
|
||||
import io.element.android.x.matrix.core.RoomId
|
||||
|
||||
@Destination
|
||||
@Composable
|
||||
fun LoginScreenNavigation(navigator: DestinationsNavigator) {
|
||||
LoginScreen(
|
||||
onLoginWithSuccess = {
|
||||
navigator.clearBackStack(RoomListScreenNavigationDestination)
|
||||
navigator.navigate(RoomListScreenNavigationDestination){
|
||||
popUpTo(LoginScreenNavigationDestination){
|
||||
inclusive = true
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
|
@ -23,9 +31,24 @@ fun LoginScreenNavigation(navigator: DestinationsNavigator) {
|
|||
@Destination
|
||||
@Composable
|
||||
fun RoomListScreenNavigation(navigator: DestinationsNavigator) {
|
||||
RoomListScreen(onSuccessLogout = {
|
||||
navigator.clearBackStack(LoginScreenNavigationDestination)
|
||||
})
|
||||
RoomListScreen(
|
||||
onRoomClicked = { roomId: RoomId ->
|
||||
navigator.navigate(MessagesScreenNavigationDestination(roomId = roomId.value))
|
||||
},
|
||||
onSuccessLogout = {
|
||||
navigator.navigate(LoginScreenNavigationDestination){
|
||||
popUpTo(RoomListScreenNavigationDestination){
|
||||
inclusive = true
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@Destination
|
||||
@Composable
|
||||
fun MessagesScreenNavigation(roomId: String) {
|
||||
MessagesScreen(roomId)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue