Skip to content

Commit

Permalink
[Jetcaster] Use one HomeScreen call inside SupportingPaneScaffold (#1510
Browse files Browse the repository at this point in the history
)

Fixes #1508 by only calling `HomeScreen` in a single source code
location, in the main pane of `SupportingPaneScaffold`.
  • Loading branch information
alexvanyo authored Nov 14, 2024
2 parents cb453e4 + 69ef8ce commit 6074a82
Showing 1 changed file with 16 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -321,17 +321,18 @@ private fun HomeScreenReady(
)

Surface {
val podcastUri = navigator.currentDestination?.content
if (podcastUri.isNullOrEmpty()) {
HomeScreen(
homeState = homeState,
modifier = Modifier.fillMaxSize()
)
} else {
SupportingPaneScaffold(
value = navigator.scaffoldValue,
directive = navigator.scaffoldDirective,
supportingPane = {
SupportingPaneScaffold(
value = navigator.scaffoldValue,
directive = navigator.scaffoldDirective,
mainPane = {
HomeScreen(
homeState = homeState,
modifier = Modifier.fillMaxSize()
)
},
supportingPane = {
val podcastUri = navigator.currentDestination?.content
if (!podcastUri.isNullOrEmpty()) {
val podcastDetailsViewModel =
hiltViewModel<PodcastDetailsViewModel, PodcastDetailsViewModel.Factory>(
key = podcastUri
Expand All @@ -348,16 +349,10 @@ private fun HomeScreenReady(
},
showBackButton = navigator.isMainPaneHidden(),
)
},
mainPane = {
HomeScreen(
homeState = homeState,
modifier = Modifier.fillMaxSize()
)
},
modifier = Modifier.fillMaxSize()
)
}
}
},
modifier = Modifier.fillMaxSize()
)
}
}

Expand Down

0 comments on commit 6074a82

Please sign in to comment.