-
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
Open
Corvus400
wants to merge
10
commits into
DroidKaigi:main
Choose a base branch
from
Corvus400:feature/move_to_floor_map_from_content_detail
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
2b4b707
:recycle: Added the ability to go to the floor map from the session d…
Corvus400 b16230c
:wrench: ./gradlew detekt --auto-correct
Corvus400 04de943
Merge branch 'main' into feature/move_to_floor_map_from_content_detail
Corvus400 6809f6b
:wrench: Fixed so that the test would pass.
Corvus400 c1a9ba7
Merge remote-tracking branch 'origin/feature/move_to_floor_map_from_c…
Corvus400 1458f04
:wrench: The definition of Module was incorrect and has been corrected.
Corvus400 3b414f7
Merge branch 'main' into feature/move_to_floor_map_from_content_detail
Corvus400 3271c32
Merge branch 'main' into feature/move_to_floor_map_from_content_detail
Corvus400 7ade5eb
Merge branch 'main' into feature/move_to_floor_map_from_content_detail
Corvus400 ad6726d
CI RERUN
Corvus400 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
...androidMain/kotlin/io/github/droidkaigi/confsched2023/data/navigation/NavigationModule.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package io.github.droidkaigi.confsched2023.data.navigation | ||
|
||
import dagger.Module | ||
import dagger.Provides | ||
import dagger.hilt.InstallIn | ||
import dagger.hilt.components.SingletonComponent | ||
import io.github.droidkaigi.confsched2023.model.NavigationRequester | ||
import kotlinx.coroutines.flow.Flow | ||
import kotlinx.coroutines.flow.MutableStateFlow | ||
import javax.inject.Singleton | ||
|
||
@InstallIn(SingletonComponent::class) | ||
@Module | ||
class NavigationModule { | ||
@Provides | ||
@Singleton | ||
fun provideNavigationRequester(): NavigationRequester = DefaultNavigationRequester() | ||
} | ||
|
||
class DefaultNavigationRequester : NavigationRequester { | ||
private val _navigateRequestStateFlow = MutableStateFlow("") | ||
override fun getNavigationRouteFlow(): Flow<String> = _navigateRequestStateFlow | ||
|
||
override fun navigateTo(route: String) { | ||
_navigateRequestStateFlow.value = route | ||
} | ||
|
||
override fun navigated() { | ||
_navigateRequestStateFlow.value = "" | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
...del/src/commonMain/kotlin/io/github/droidkaigi/confsched2023/model/NavigationRequester.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 = {}, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Well, it's difficult to think but what if we create
navController::navigateToMainFloorMapScreen
?I think we can see parent navController to access getBackStackEntry 👀
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.
Once I was able to return to the start destination with the following code.
However, I have not figured out how to move to FloorMapScreen from here without having to make any major changes.
Do you already have any ideas? 🙇
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.
I'm not sure about this. But I think we can pass the
route
parameter to NavHost and we may be able to pass /main/floorMap.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.
@takahirom
I have tried the suggested method, but unfortunately the app crashes. 🙇
We still think that as long as NavHost is split into two, it is unfortunately difficult to achieve this functionality other than this current implementation. 🙇