diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/navigation/NavigationDestination.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/navigation/NavigationDestination.kt index 521fbfac2..ba4e5fb31 100644 --- a/app/src/main/java/com/infomaniak/swisstransfer/ui/navigation/NavigationDestination.kt +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/navigation/NavigationDestination.kt @@ -22,6 +22,7 @@ import android.os.Bundle import androidx.navigation.NavBackStackEntry import kotlinx.serialization.Serializable import kotlin.reflect.KClass +import kotlin.reflect.full.primaryConstructor /** * Sealed class representing the navigation arguments for the main navigation flow. @@ -94,8 +95,7 @@ sealed class NavigationDestination { } private fun createInstance(kClass: KClass, bundle: Bundle?): T? { - val primaryConstructor = kClass.constructors.firstOrNull() - return primaryConstructor?.let { + return kClass.primaryConstructor?.let { val args = it.parameters.associateWith { parameter -> bundle?.get(parameter.name) } diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/components/AppNavigationSuiteScaffold.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/components/AppNavigationSuiteScaffold.kt index 4a4baf198..e001b33a3 100644 --- a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/components/AppNavigationSuiteScaffold.kt +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/components/AppNavigationSuiteScaffold.kt @@ -65,10 +65,14 @@ fun AppNavigationSuiteScaffold( Surface(color = SwissTransferTheme.materialColors.background) { NavigationSuiteScaffoldLayout( navigationSuite = { - if (layoutType == NavigationSuiteType.NavigationBar) { - AppNavigationBar(navigationItems, currentDestination, navigateToSelectedItem) - } else { - AppNavigationRail(navigationItems, currentDestination, navigateToSelectedItem) + when (layoutType) { + NavigationSuiteType.None -> Unit + NavigationSuiteType.NavigationBar -> { + AppNavigationBar(navigationItems, currentDestination, navigateToSelectedItem) + } + else -> { + AppNavigationRail(navigationItems, currentDestination, navigateToSelectedItem) + } } }, layoutType = layoutType,