From f7412dfd86d6b2373bf3df484208b31101c572a9 Mon Sep 17 00:00:00 2001 From: Tangem Date: Mon, 15 Jul 2024 20:25:38 +0300 Subject: [PATCH] Updated on 2026-08-14 --- .../components/bottomsheets/TangemBottomSheet.kt | 3 ++- .../referral/ui/AgreementBottomSheetContent.kt | 15 +++++++++------ .../feature/referral/ui/ReferralBottomSheet.kt | 3 +++ 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/core/ui/src/main/java/com/tangem/core/ui/components/bottomsheets/TangemBottomSheet.kt b/core/ui/src/main/java/com/tangem/core/ui/components/bottomsheets/TangemBottomSheet.kt index 8b48fdcf60..67466771ba 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/components/bottomsheets/TangemBottomSheet.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/components/bottomsheets/TangemBottomSheet.kt @@ -141,6 +141,7 @@ inline fun BasicBottomSheet( val model = config.content as? T ?: return val statusBarHeight = with(LocalDensity.current) { WindowInsets.statusBars.getTop(this).toDp() } + val bottomBarHeight = with(LocalDensity.current) { WindowInsets.systemBars.getBottom(this).toDp() } ModalBottomSheet( // FIXME temporary solution to fix height of the bottom sheet @@ -155,7 +156,7 @@ inline fun BasicBottomSheet( Column( modifier = Modifier.let { if (addBottomInsets) { - it.navigationBarsPadding() + it.padding(bottom = bottomBarHeight) } else { it } diff --git a/features/referral/presentation/src/main/java/com/tangem/feature/referral/ui/AgreementBottomSheetContent.kt b/features/referral/presentation/src/main/java/com/tangem/feature/referral/ui/AgreementBottomSheetContent.kt index 204393dc6a..66be1782f1 100644 --- a/features/referral/presentation/src/main/java/com/tangem/feature/referral/ui/AgreementBottomSheetContent.kt +++ b/features/referral/presentation/src/main/java/com/tangem/feature/referral/ui/AgreementBottomSheetContent.kt @@ -2,15 +2,19 @@ package com.tangem.feature.referral.ui import android.content.res.Configuration import androidx.compose.foundation.background -import androidx.compose.foundation.layout.* +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Spacer +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.height import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.verticalScroll import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier -import androidx.compose.ui.platform.LocalDensity import androidx.compose.ui.platform.LocalInspectionMode import androidx.compose.ui.res.stringResource import androidx.compose.ui.tooling.preview.Preview +import androidx.compose.ui.unit.Dp +import androidx.compose.ui.unit.dp import com.google.accompanist.web.WebView import com.google.accompanist.web.rememberWebViewState import com.tangem.core.ui.components.appbar.TangemTopAppBar @@ -22,11 +26,10 @@ import com.tangem.feature.referral.presentation.R * Bottom sheet content with referral program terms of use * * @param url link to the html page + * @param bottomBarHeight bottom insets */ @Composable -internal fun AgreementBottomSheetContent(url: String) { - val bottomBarHeight = with(LocalDensity.current) { WindowInsets.systemBars.getBottom(this).toDp() } - +internal fun AgreementBottomSheetContent(url: String, bottomBarHeight: Dp) { Column( modifier = Modifier .fillMaxSize() @@ -62,6 +65,6 @@ private fun AgreementHtmlView(url: String) { @Composable private fun Preview_AgreementBottomSheet() { TangemThemePreview { - AgreementBottomSheetContent(url = "https://tangem.com/en/") + AgreementBottomSheetContent(url = "https://tangem.com/en/", 50.dp) } } \ No newline at end of file diff --git a/features/referral/presentation/src/main/java/com/tangem/feature/referral/ui/ReferralBottomSheet.kt b/features/referral/presentation/src/main/java/com/tangem/feature/referral/ui/ReferralBottomSheet.kt index d91a122117..678775213a 100644 --- a/features/referral/presentation/src/main/java/com/tangem/feature/referral/ui/ReferralBottomSheet.kt +++ b/features/referral/presentation/src/main/java/com/tangem/feature/referral/ui/ReferralBottomSheet.kt @@ -3,6 +3,7 @@ package com.tangem.feature.referral.ui import androidx.compose.foundation.layout.WindowInsets import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.statusBars +import androidx.compose.foundation.layout.systemBars import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.ModalBottomSheet @@ -24,6 +25,7 @@ internal fun ReferralBottomSheet( config: ReferralStateHolder.ReferralInfoState, ) { val statusBarHeight = with(LocalDensity.current) { WindowInsets.statusBars.getTop(this).toDp() } + val bottomBarHeight = with(LocalDensity.current) { WindowInsets.systemBars.getBottom(this).toDp() } if (isVisible) { ModalBottomSheet( @@ -43,6 +45,7 @@ internal fun ReferralBottomSheet( is ReferralStateHolder.ReferralInfoState.ParticipantContent -> config.url is ReferralStateHolder.ReferralInfoState.Loading -> "" }, + bottomBarHeight = bottomBarHeight, ) } }