fix: handle user profile navigation correctly

This commit is contained in:
Harsh Shandilya 2024-04-18 01:34:28 +05:30
parent 2b9680d3d8
commit d0bf2a4fb2
7 changed files with 80 additions and 14 deletions

View file

@ -261,6 +261,11 @@ fun LobstersPostsScreen(
htmlConverter = htmlConverter,
getSeenComments = viewModel::getSeenComments,
markSeenComments = viewModel::markSeenComments,
openUserProfile = {
navController.navigate(
Destinations.User.route.replace(Destinations.User.PLACEHOLDER, it)
)
},
)
}
composable(
@ -272,7 +277,15 @@ fun LobstersPostsScreen(
"Navigating to ${Destinations.User.route} without necessary 'username' argument"
}
setWebUri("https://lobste.rs/u/$username")
UserProfile(username = username, getProfile = viewModel::getUserProfile)
UserProfile(
username = username,
getProfile = viewModel::getUserProfile,
openUserProfile = {
navController.navigate(
Destinations.User.route.replace(Destinations.User.PLACEHOLDER, it)
)
},
)
}
composable(route = Destinations.Settings.route) {
SettingsScreen(

View file

@ -67,6 +67,11 @@ fun SearchScreen(
htmlConverter = htmlConverter,
getSeenComments = viewModel::getSeenComments,
markSeenComments = viewModel::markSeenComments,
openUserProfile = { username: String ->
navController.navigate(
Destinations.User.route.replace(Destinations.User.PLACEHOLDER, username)
)
},
)
}
}