-
Notifications
You must be signed in to change notification settings - Fork 206
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Proposal] ♻️ Added the ability to go to the floor map from the session details. #1127
base: main
Are you sure you want to change the base?
Changes from 2 commits
2b4b707
b16230c
04de943
6809f6b
c1a9ba7
1458f04
3b414f7
3271c32
7ade5eb
ad6726d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -111,6 +111,9 @@ private fun KaigiNavHost( | |
onTimetableItemClick = navController::navigateToTimetableItemDetailScreen, | ||
onNavigateToBookmarkScreenRequested = navController::navigateToBookmarkScreen, | ||
onLinkClick = externalNavController::navigate, | ||
onRoomClick = { | ||
navController.popBackStack(navController.graph.startDestinationId, false) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well, it's difficult to think but what if we create There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Once I was able to return to the start destination with the following code. fun NavController.navigateToMainFloorMapScreen() {
getBackStackEntry(timetableItemDetailScreenRoute).destination.parent?.startDestinationId?.let {
navigate(it)
// TODO navigateMainFloorMap
}
} However, I have not figured out how to move to FloorMapScreen from here without having to make any major changes. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure about this. But I think we can pass the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @takahirom |
||
}, | ||
onCalendarRegistrationClick = externalNavController::navigateToCalendarRegistration, | ||
onShareClick = externalNavController::onShareClick, | ||
) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package io.github.droidkaigi.confsched2023.model | ||
|
||
import kotlinx.coroutines.flow.Flow | ||
|
||
interface NavigationRequester { | ||
fun getNavigationRouteFlow(): Flow<String> | ||
fun navigateTo(route: String) | ||
fun navigated() | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,13 +49,15 @@ fun NavGraphBuilder.sessionScreens( | |
onTimetableItemClick: (TimetableItem) -> Unit, | ||
onNavigateToBookmarkScreenRequested: () -> Unit, | ||
onLinkClick: (url: String) -> Unit, | ||
onRoomClick: () -> Unit, | ||
onCalendarRegistrationClick: (TimetableItem) -> Unit, | ||
onShareClick: (TimetableItem) -> Unit, | ||
) { | ||
composable(timetableItemDetailScreenRoute) { | ||
TimetableItemDetailScreen( | ||
onNavigationIconClick = onNavigationIconClick, | ||
onLinkClick = onLinkClick, | ||
onRoomClick = onRoomClick, | ||
onCalendarRegistrationClick = onCalendarRegistrationClick, | ||
onNavigateToBookmarkScreenRequested = onNavigateToBookmarkScreenRequested, | ||
onShareClick = onShareClick, | ||
|
@@ -84,6 +86,7 @@ fun NavController.navigateToTimetableItemDetailScreen( | |
fun TimetableItemDetailScreen( | ||
onNavigationIconClick: () -> Unit, | ||
onLinkClick: (url: String) -> Unit, | ||
onRoomClick: () -> Unit, | ||
onCalendarRegistrationClick: (TimetableItem) -> Unit, | ||
onNavigateToBookmarkScreenRequested: () -> Unit, | ||
onShareClick: (TimetableItem) -> Unit, | ||
|
@@ -109,6 +112,10 @@ fun TimetableItemDetailScreen( | |
onNavigationIconClick = onNavigationIconClick, | ||
onBookmarkClick = viewModel::onBookmarkClick, | ||
onLinkClick = onLinkClick, | ||
onRoomClick = { | ||
viewModel.navigateTo("floorMap") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would like to change this part if possible since it is directly specified. |
||
onRoomClick() | ||
}, | ||
onCalendarRegistrationClick = onCalendarRegistrationClick, | ||
onShareClick = onShareClick, | ||
onSelectedLanguage = viewModel::onSelectDescriptionLanguage, | ||
|
@@ -145,6 +152,7 @@ private fun TimetableItemDetailScreen( | |
onLinkClick: (url: String) -> Unit, | ||
onCalendarRegistrationClick: (TimetableItem) -> Unit, | ||
onShareClick: (TimetableItem) -> Unit, | ||
onRoomClick: () -> Unit, | ||
onSelectedLanguage: (Lang) -> Unit, | ||
snackbarHostState: SnackbarHostState, | ||
) { | ||
|
@@ -194,6 +202,7 @@ private fun TimetableItemDetailScreen( | |
uiState = it.timetableItemDetailSectionUiState, | ||
selectedLanguage = it.currentLang, | ||
onLinkClick = onLinkClick, | ||
onRoomClick = onRoomClick, | ||
contentPadding = innerPadding, | ||
) | ||
} | ||
|
@@ -214,7 +223,9 @@ fun TimetableItemDetailScreenPreview() { | |
TimetableItemDetailScreen( | ||
uiState = Loaded( | ||
timetableItem = fakeSession, | ||
timetableItemDetailSectionUiState = TimetableItemDetailSectionUiState(fakeSession), | ||
timetableItemDetailSectionUiState = TimetableItemDetailSectionUiState( | ||
fakeSession, | ||
), | ||
isBookmarked = isBookMarked, | ||
isLangSelectable = true, | ||
viewBookmarkListRequestState = ViewBookmarkListRequestState.NotRequested, | ||
|
@@ -225,6 +236,7 @@ fun TimetableItemDetailScreenPreview() { | |
isBookMarked = !isBookMarked | ||
}, | ||
onLinkClick = {}, | ||
onRoomClick = {}, | ||
onCalendarRegistrationClick = {}, | ||
onShareClick = {}, | ||
onSelectedLanguage = {}, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We did this to operate between different NavHosts.
I don't think this is the best way to do it, so if you have a better idea, I'm open to it.
I doubt if the name NavigationRequester is appropriate either.