Updated on 2026-08-14

This commit is contained in:
Tangem 2024-07-15 20:25:38 +03:00
parent 75f8a45cd4
commit f7412dfd86
3 changed files with 14 additions and 7 deletions

View file

@ -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)
}
}

View file

@ -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,
)
}
}