diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/MainScaffold.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/MainScaffold.kt index b1ae25bb1..843920d3e 100644 --- a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/MainScaffold.kt +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/MainScaffold.kt @@ -35,8 +35,6 @@ import com.infomaniak.swisstransfer.ui.utils.PreviewMobile import com.infomaniak.swisstransfer.ui.utils.PreviewTablet import com.infomaniak.swisstransfer.ui.utils.isWindowLarge -val LocalNavType = staticCompositionLocalOf { NavigationSuiteType.None } - @Composable fun MainScaffold( navController: NavHostController, @@ -45,9 +43,7 @@ fun MainScaffold( ) { val navType by rememberNavType(currentDestination) - CompositionLocalProvider(LocalNavType provides navType) { - MainScaffold(navType, currentDestination, navController::navigateToSelectedItem, content) - } + MainScaffold(navType, currentDestination, navController::navigateToSelectedItem, content) } @Composable diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/settings/components/OptionScaffold.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/settings/components/OptionScaffold.kt index 05054d13c..48e875d10 100644 --- a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/settings/components/OptionScaffold.kt +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/settings/components/OptionScaffold.kt @@ -23,7 +23,6 @@ import androidx.compose.foundation.layout.padding import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.verticalScroll import androidx.compose.material3.Scaffold -import androidx.compose.material3.adaptive.navigationsuite.NavigationSuiteType import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableIntStateOf @@ -32,7 +31,8 @@ import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier import com.infomaniak.swisstransfer.ui.components.SwissTransferTobAppBar import com.infomaniak.swisstransfer.ui.components.TopAppBarButton -import com.infomaniak.swisstransfer.ui.screen.main.LocalNavType +import com.infomaniak.swisstransfer.ui.theme.LocalWindowAdaptiveInfo +import com.infomaniak.swisstransfer.ui.utils.isWindowSmall @Composable fun OptionScaffold( @@ -43,8 +43,10 @@ fun OptionScaffold( setSelectedSettingOptionPosition: (Int) -> Unit, navigateBack: (() -> Unit)? = null, ) { + val windowAdaptiveInfo = LocalWindowAdaptiveInfo.current + Scaffold(topBar = { - val backNavigationMenu = if (LocalNavType.current == NavigationSuiteType.NavigationBar) { + val backNavigationMenu = if (windowAdaptiveInfo.isWindowSmall()) { TopAppBarButton.backButton(navigateBack ?: {}) } else { null