Skip to content

Commit

Permalink
hide favourites from menu while not implemented
Browse files Browse the repository at this point in the history
  • Loading branch information
avan1235 committed May 1, 2024
1 parent e7729a1 commit c57814a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions composeApp/src/commonMain/kotlin/in/procyk/shin/ShinApp.kt
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ fun ShinApp(component: ShinAppComponent) {
modifier = Modifier.fillMaxSize(),
animation = stackAnimation(slide(orientation = Orientation.Vertical))
) { child ->
NavigationDrawer(component) {
NavigationDrawer(component, permission.isAvailable) {
when (val instance = child.instance) {
is Child.Main -> MainScreen(instance.component, permission.isAvailable)
is Child.ScanQRCode -> ScanQRCodeScreen(instance.component, permission)
Expand All @@ -61,6 +61,7 @@ fun ShinApp(component: ShinAppComponent) {
@Composable
private inline fun NavigationDrawer(
component: ShinAppComponent,
isCameraAvailable: Boolean,
crossinline content: @Composable BoxScope.() -> Unit,
) {
val keyboardController = LocalSoftwareKeyboardController.current
Expand All @@ -87,7 +88,10 @@ private inline fun NavigationDrawer(
}
Spacer(modifier = Modifier.height(24.dp))

MenuItem.entries.forEach { item ->
listOfNotNull(
MenuItem.Main,
MenuItem.ScanQRCode.takeIf { isCameraAvailable },
).forEach { item ->
NavigationDrawerItem(
icon = {
Icon(
Expand Down

0 comments on commit c57814a

Please sign in to comment.