Updated on 2026-08-14

This commit is contained in:
Tangem 2023-06-06 17:11:37 +03:00
parent cd3d290eb1
commit f3afa55469
9 changed files with 72 additions and 26 deletions

View file

@ -12,8 +12,8 @@ import androidx.compose.ui.platform.ComposeView
import androidx.core.view.WindowCompat
import androidx.core.view.WindowInsetsControllerCompat
import androidx.fragment.app.Fragment
import com.google.accompanist.appcompattheme.AppCompatTheme
import com.tangem.core.analytics.Analytics
import com.tangem.core.ui.res.TangemTheme
import com.tangem.tap.common.analytics.events.IntroductionProcess
import com.tangem.tap.common.redux.navigation.AppScreen
import com.tangem.tap.common.redux.navigation.NavigationAction
@ -37,11 +37,10 @@ class HomeFragment : Fragment(), StoreSubscriber<HomeState> {
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
return ComposeView(inflater.context).apply {
setContent {
BackHandler {
requireActivity().finish()
}
AppCompatTheme {
TangemTheme {
BackHandler {
requireActivity().finish()
}
ScreenContent()
}
}

View file

@ -26,7 +26,7 @@ import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.google.accompanist.systemuicontroller.rememberSystemUiController
import com.tangem.core.ui.res.TangemTheme
import com.tangem.feature.learn2earn.presentation.ui.OneInchStoriesContent
import com.tangem.feature.learn2earn.presentation.ui.OneInchStoriesScreen
import com.tangem.tap.features.home.compose.content.*
import com.tangem.tap.features.home.compose.views.HomeButtons
import com.tangem.tap.features.home.compose.views.StoriesProgressBar
@ -152,12 +152,7 @@ fun StoriesScreen(
colorFilter = if (currentStory.isDarkBackground) null else ColorFilter.tint(Color.Black),
)
when (currentStory) {
Stories.OneInchPromo -> {
// TODO: fixme
TangemTheme {
OneInchStoriesContent({})
}
}
Stories.OneInchPromo -> OneInchStoriesScreen({})
Stories.TangemIntro -> FirstStoriesContent(isPaused, currentStory.duration) { hideContent.value = it }
Stories.RevolutionaryWallet -> StoriesRevolutionaryWallet(currentStory.duration)
Stories.UltraSecureBackup -> StoriesUltraSecureBackup(isPaused, currentStory.duration)
@ -200,7 +195,11 @@ fun StoriesScreen(
if (currentStory != Stories.OneInchPromo) {
HomeButtons(
modifier = Modifier
.padding(start = 16.dp, top = 0.dp, end = 16.dp, bottom = 37.dp)
.padding(
start = TangemTheme.dimens.size16,
end = TangemTheme.dimens.size16,
bottom = TangemTheme.dimens.size36,
)
.fillMaxWidth(),
isDarkBackground = currentStory.isDarkBackground,
btnScanStateInProgress = homeState.value.btnScanStateInProgress,

View file

@ -1,5 +1,4 @@
plugins {
alias(deps.plugins.android.library)
alias(deps.plugins.kotlin.android)
alias(deps.plugins.kotlin.jvm)
id("configuration")
}

View file

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest package="com.tangem.features.learn2earn.api" />

View file

@ -34,6 +34,7 @@ dependencies {
implementation(project(":core:res"))
/** Tangem libraries */
// TODO: fixme: delete if later it doesn't needed
// implementation(deps.tangem.card.core)
// implementation(deps.tangem.card.android) {
// exclude(module = "joda-time")

View file

@ -14,6 +14,7 @@ import androidx.compose.ui.graphics.ColorFilter
import androidx.compose.ui.graphics.Shape
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.tangem.core.ui.res.TangemTheme
import com.tangem.core.ui.res.TangemTypography
@ -103,4 +104,28 @@ private fun ContentBackground(shape: Shape) {
)
.fillMaxSize(),
)
}
@Preview
@Composable
private fun OneInchStoriesContentPreview_Light() {
TangemTheme(
isDark = false,
) {
GetBonusAlert(
onClick = {},
)
}
}
@Preview
@Composable
private fun OneInchStoriesContentPreview_Dark() {
TangemTheme(
isDark = true,
) {
GetBonusAlert(
onClick = {},
)
}
}

View file

@ -11,6 +11,7 @@ import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.tangem.core.ui.components.SecondaryButton
import com.tangem.core.ui.components.SpacerH16
@ -23,16 +24,19 @@ import com.tangem.feature.learn2earn.presentation.ui.component.GradientCircle
/**
[REDACTED_AUTHOR]
*/
@Suppress("ReusedModifierInstance")
// TODO: fixme: make function as internal after adding feature interface
@Composable
fun OneInchStoriesContent(onLearnClick: () -> Unit, modifier: Modifier = Modifier) {
fun OneInchStoriesScreen(onLearnClick: () -> Unit, modifier: Modifier = Modifier) {
Box(modifier = modifier.fillMaxSize()) {
ContentBackground(
modifier = modifier
modifier = Modifier
.fillMaxSize()
.align(Alignment.Center),
)
StoryDescription(
modifier = Modifier
.padding(horizontal = TangemTheme.dimens.size40)
.fillMaxSize(),
headerText = stringResource(id = R.string.story_learn_title),
bodyText = stringResource(id = R.string.story_learn_description),
)
@ -77,13 +81,10 @@ private fun ContentBackground(modifier: Modifier = Modifier) {
}
@Composable
private fun StoryDescription(headerText: String, bodyText: String) {
private fun StoryDescription(headerText: String, bodyText: String, modifier: Modifier = Modifier) {
Column(
modifier = Modifier
.padding(horizontal = TangemTheme.dimens.size40)
.fillMaxSize(),
modifier = modifier,
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.Top,
) {
SpacerH32()
Text(
@ -102,4 +103,28 @@ private fun StoryDescription(headerText: String, bodyText: String) {
color = TangemTheme.colors.text.tertiary,
)
}
}
@Preview
@Composable
private fun OneInchStoriesContentPreview_Light() {
TangemTheme(
isDark = false,
) {
OneInchStoriesScreen(
onLearnClick = {},
)
}
}
@Preview
@Composable
private fun OneInchStoriesContentPreview_Dark() {
TangemTheme(
isDark = true,
) {
OneInchStoriesScreen(
onLearnClick = {},
)
}
}