Updated on 2026-08-14
This commit is contained in:
parent
75802c1551
commit
1ca2672884
42 changed files with 160 additions and 625 deletions
|
|
@ -199,7 +199,6 @@ abstract class BaseTestCase : TestCase(
|
||||||
// build even when the app version resolves to 1.0.0-SNAPSHOT on CI (then 1.0.0 < x.xx would
|
// build even when the app version resolves to 1.0.0-SNAPSHOT on CI (then 1.0.0 < x.xx would
|
||||||
// disable them). On the releases/6.0 branch every toggle with version <= 6.0 ships enabled.
|
// disable them). On the releases/6.0 branch every toggle with version <= 6.0 ships enabled.
|
||||||
// 6.0
|
// 6.0
|
||||||
"APP_REDESIGN_ENABLED" to true,
|
|
||||||
"TWI_1326_YIELD_MODE_SWAP_ENABLED" to true,
|
"TWI_1326_YIELD_MODE_SWAP_ENABLED" to true,
|
||||||
// 6.1
|
// 6.1
|
||||||
"TWI_1638_VA_MVP0_ENABLED" to true,
|
"TWI_1638_VA_MVP0_ENABLED" to true,
|
||||||
|
|
|
||||||
|
|
@ -1,17 +0,0 @@
|
||||||
package com.tangem.tap.core.ui
|
|
||||||
|
|
||||||
import com.tangem.core.configtoggle.FeatureToggles
|
|
||||||
import com.tangem.core.configtoggle.feature.FeatureTogglesManager
|
|
||||||
import com.tangem.core.ui.DesignFeatureToggles
|
|
||||||
import javax.inject.Inject
|
|
||||||
|
|
||||||
class DefaultDesignFeatureToggles @Inject constructor(
|
|
||||||
private val featureTogglesManager: FeatureTogglesManager,
|
|
||||||
) : DesignFeatureToggles {
|
|
||||||
|
|
||||||
override val isRedesignEnabled: Boolean
|
|
||||||
get() = true
|
|
||||||
|
|
||||||
override val isWarningsRefactoringEnabled: Boolean
|
|
||||||
get() = featureTogglesManager.isFeatureEnabled(FeatureToggles.AND_14829_WARNINGS_REFACTORING_ENABLED)
|
|
||||||
}
|
|
||||||
|
|
@ -4,7 +4,6 @@ import androidx.compose.material3.SnackbarHostState
|
||||||
import com.tangem.core.decompose.di.GlobalUiMessageSender
|
import com.tangem.core.decompose.di.GlobalUiMessageSender
|
||||||
import com.tangem.core.decompose.ui.DefaultUiMessageSender
|
import com.tangem.core.decompose.ui.DefaultUiMessageSender
|
||||||
import com.tangem.core.decompose.ui.UiMessageSender
|
import com.tangem.core.decompose.ui.UiMessageSender
|
||||||
import com.tangem.core.ui.DesignFeatureToggles
|
|
||||||
import com.tangem.core.ui.UiDependencies
|
import com.tangem.core.ui.UiDependencies
|
||||||
import com.tangem.core.ui.components.snackbar.TangemTopSnackbarHostState
|
import com.tangem.core.ui.components.snackbar.TangemTopSnackbarHostState
|
||||||
import com.tangem.core.ui.haptic.VibratorHapticManager
|
import com.tangem.core.ui.haptic.VibratorHapticManager
|
||||||
|
|
@ -25,7 +24,6 @@ internal object UiDependenciesModule {
|
||||||
fun provideUiDependencies(
|
fun provideUiDependencies(
|
||||||
vibratorHapticManager: VibratorHapticManager,
|
vibratorHapticManager: VibratorHapticManager,
|
||||||
appThemeModeHolder: AppThemeModeHolder,
|
appThemeModeHolder: AppThemeModeHolder,
|
||||||
designFeatureToggles: DesignFeatureToggles,
|
|
||||||
): UiDependencies {
|
): UiDependencies {
|
||||||
return object : UiDependencies {
|
return object : UiDependencies {
|
||||||
override val vibratorHapticManager = vibratorHapticManager
|
override val vibratorHapticManager = vibratorHapticManager
|
||||||
|
|
@ -33,7 +31,6 @@ internal object UiDependenciesModule {
|
||||||
override val globalSnackbarHostState: SnackbarHostState = SnackbarHostState()
|
override val globalSnackbarHostState: SnackbarHostState = SnackbarHostState()
|
||||||
override val globalTopSnackbarHostState: TangemTopSnackbarHostState = TangemTopSnackbarHostState()
|
override val globalTopSnackbarHostState: TangemTopSnackbarHostState = TangemTopSnackbarHostState()
|
||||||
override val eventMessageHandler: EventMessageHandler = EventMessageHandler()
|
override val eventMessageHandler: EventMessageHandler = EventMessageHandler()
|
||||||
override val designFeatureToggles: DesignFeatureToggles = designFeatureToggles
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,16 +0,0 @@
|
||||||
package com.tangem.tap.di.core.ui
|
|
||||||
|
|
||||||
import com.tangem.core.ui.DesignFeatureToggles
|
|
||||||
import com.tangem.tap.core.ui.DefaultDesignFeatureToggles
|
|
||||||
import dagger.Binds
|
|
||||||
import dagger.Module
|
|
||||||
import dagger.hilt.InstallIn
|
|
||||||
import dagger.hilt.components.SingletonComponent
|
|
||||||
|
|
||||||
@Module
|
|
||||||
@InstallIn(SingletonComponent::class)
|
|
||||||
interface CoreUiBindsModule {
|
|
||||||
|
|
||||||
@Binds
|
|
||||||
fun bindDesignFeatureToggles(impl: DefaultDesignFeatureToggles): DesignFeatureToggles
|
|
||||||
}
|
|
||||||
|
|
@ -4,7 +4,6 @@ import android.content.res.Configuration
|
||||||
import androidx.compose.foundation.background
|
import androidx.compose.foundation.background
|
||||||
import androidx.compose.foundation.layout.*
|
import androidx.compose.foundation.layout.*
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.CompositionLocalProvider
|
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.tooling.preview.Preview
|
import androidx.compose.ui.tooling.preview.Preview
|
||||||
|
|
@ -93,12 +92,10 @@ private fun PreviewV1() {
|
||||||
@Composable
|
@Composable
|
||||||
private fun PreviewV2() {
|
private fun PreviewV2() {
|
||||||
TangemThemePreviewRedesign {
|
TangemThemePreviewRedesign {
|
||||||
CompositionLocalProvider(LocalRedesignEnabled provides true) {
|
|
||||||
Column(Modifier.background(TangemTheme.colors2.surface.level3)) {
|
Column(Modifier.background(TangemTheme.colors2.surface.level3)) {
|
||||||
repeat(20) {
|
repeat(20) {
|
||||||
MarketsListItemPlaceholder()
|
MarketsListItemPlaceholder()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
@ -12,10 +12,9 @@ object QuickActionsConverter {
|
||||||
fun quickActions(
|
fun quickActions(
|
||||||
cryptoData: CryptoCurrencyData,
|
cryptoData: CryptoCurrencyData,
|
||||||
tokenActionsHandler: TokenActionsHandler,
|
tokenActionsHandler: TokenActionsHandler,
|
||||||
isRedesignEnabled: Boolean,
|
|
||||||
context: TokenActionsContext = TokenActionsContext.Markets,
|
context: TokenActionsContext = TokenActionsContext.Markets,
|
||||||
): QuickActions {
|
): QuickActions {
|
||||||
val states = toQuickActionStates(cryptoData.actions, isRedesignEnabled, context)
|
val states = toQuickActionStates(cryptoData.actions, context)
|
||||||
return QuickActions(
|
return QuickActions(
|
||||||
actions = states.map { it.action }.toImmutableList(),
|
actions = states.map { it.action }.toImmutableList(),
|
||||||
onQuickActionClick = { quickActionUM ->
|
onQuickActionClick = { quickActionUM ->
|
||||||
|
|
@ -70,21 +69,18 @@ object QuickActionsConverter {
|
||||||
*/
|
*/
|
||||||
fun toQuickActions(
|
fun toQuickActions(
|
||||||
actions: List<TokenActionsState.ActionState>,
|
actions: List<TokenActionsState.ActionState>,
|
||||||
isRedesignEnabled: Boolean,
|
|
||||||
context: TokenActionsContext = TokenActionsContext.Markets,
|
context: TokenActionsContext = TokenActionsContext.Markets,
|
||||||
): ImmutableList<QuickActionUM> =
|
): ImmutableList<QuickActionUM> = toQuickActionStates(actions, context).map { it.action }.toImmutableList()
|
||||||
toQuickActionStates(actions, isRedesignEnabled, context).map { it.action }.toImmutableList()
|
|
||||||
|
|
||||||
private fun toQuickActionStates(
|
private fun toQuickActionStates(
|
||||||
actions: List<TokenActionsState.ActionState>,
|
actions: List<TokenActionsState.ActionState>,
|
||||||
isRedesignEnabled: Boolean,
|
|
||||||
context: TokenActionsContext,
|
context: TokenActionsContext,
|
||||||
): List<QuickActionState> {
|
): List<QuickActionState> {
|
||||||
val allowed = context.allowedActionsInOrder
|
val allowed = context.allowedActionsInOrder
|
||||||
?: return actions
|
?: return actions
|
||||||
.filter { it.unavailabilityReason == ScenarioUnavailabilityReason.None }
|
.filter { it.unavailabilityReason == ScenarioUnavailabilityReason.None }
|
||||||
.mapNotNull { action ->
|
.mapNotNull { action ->
|
||||||
action.toQuickActionUM(isRedesignEnabled)?.let { QuickActionState(it, isEnabled = true) }
|
action.toQuickActionUM()?.let { QuickActionState(it, isEnabled = true) }
|
||||||
}
|
}
|
||||||
|
|
||||||
val byBsAction = actions.associateBy { it.toBsAction() }
|
val byBsAction = actions.associateBy { it.toBsAction() }
|
||||||
|
|
@ -94,13 +90,13 @@ object QuickActionsConverter {
|
||||||
when (action) {
|
when (action) {
|
||||||
TokenActionsBSContentUM.Action.SendWithSwap ->
|
TokenActionsBSContentUM.Action.SendWithSwap ->
|
||||||
if (isExchangeAvailable) {
|
if (isExchangeAvailable) {
|
||||||
QuickActionState(swapAndSendUM(isRedesignEnabled), isEnabled = true)
|
QuickActionState(QuickActionUM.V2.SwapAndSend, isEnabled = true)
|
||||||
} else {
|
} else {
|
||||||
null
|
null
|
||||||
}
|
}
|
||||||
else -> {
|
else -> {
|
||||||
val state = byBsAction[action] ?: return@mapNotNull null
|
val state = byBsAction[action] ?: return@mapNotNull null
|
||||||
val um = state.toQuickActionUM(isRedesignEnabled) ?: return@mapNotNull null
|
val um = state.toQuickActionUM() ?: return@mapNotNull null
|
||||||
QuickActionState(um, isEnabled = state.unavailabilityReason == ScenarioUnavailabilityReason.None)
|
QuickActionState(um, isEnabled = state.unavailabilityReason == ScenarioUnavailabilityReason.None)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -109,13 +105,7 @@ object QuickActionsConverter {
|
||||||
|
|
||||||
private data class QuickActionState(val action: QuickActionUM, val isEnabled: Boolean)
|
private data class QuickActionState(val action: QuickActionUM, val isEnabled: Boolean)
|
||||||
|
|
||||||
private fun swapAndSendUM(isRedesignEnabled: Boolean): QuickActionUM =
|
private fun TokenActionsState.ActionState.toQuickActionUM(): QuickActionUM? = when (this) {
|
||||||
if (isRedesignEnabled) QuickActionUM.V2.SwapAndSend else QuickActionUM.V1.SwapAndSend
|
|
||||||
|
|
||||||
private fun TokenActionsState.ActionState.toQuickActionUM(isRedesignEnabled: Boolean): QuickActionUM? =
|
|
||||||
if (isRedesignEnabled) toV2() else toV1()
|
|
||||||
|
|
||||||
private fun TokenActionsState.ActionState.toV2(): QuickActionUM? = when (this) {
|
|
||||||
is TokenActionsState.ActionState.Buy -> QuickActionUM.V2.Buy
|
is TokenActionsState.ActionState.Buy -> QuickActionUM.V2.Buy
|
||||||
is TokenActionsState.ActionState.Swap -> QuickActionUM.V2.Exchange(shouldShowBadge)
|
is TokenActionsState.ActionState.Swap -> QuickActionUM.V2.Exchange(shouldShowBadge)
|
||||||
is TokenActionsState.ActionState.Receive -> QuickActionUM.V2.Receive
|
is TokenActionsState.ActionState.Receive -> QuickActionUM.V2.Receive
|
||||||
|
|
@ -126,17 +116,6 @@ object QuickActionsConverter {
|
||||||
else -> null
|
else -> null
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun TokenActionsState.ActionState.toV1(): QuickActionUM? = when (this) {
|
|
||||||
is TokenActionsState.ActionState.Buy -> QuickActionUM.V1.Buy
|
|
||||||
is TokenActionsState.ActionState.Swap -> QuickActionUM.V1.Exchange(shouldShowBadge)
|
|
||||||
is TokenActionsState.ActionState.Receive -> QuickActionUM.V1.Receive
|
|
||||||
is TokenActionsState.ActionState.Send -> QuickActionUM.V1.Send
|
|
||||||
is TokenActionsState.ActionState.Sell -> QuickActionUM.V1.Sell
|
|
||||||
is TokenActionsState.ActionState.Stake -> QuickActionUM.V1.Stake
|
|
||||||
is TokenActionsState.ActionState.YieldMode -> QuickActionUM.V1.YieldMode(apy)
|
|
||||||
else -> null
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun TokenActionsState.ActionState.toBsAction(): TokenActionsBSContentUM.Action? = when (this) {
|
private fun TokenActionsState.ActionState.toBsAction(): TokenActionsBSContentUM.Action? = when (this) {
|
||||||
is TokenActionsState.ActionState.Buy -> TokenActionsBSContentUM.Action.Buy
|
is TokenActionsState.ActionState.Buy -> TokenActionsBSContentUM.Action.Buy
|
||||||
is TokenActionsState.ActionState.Swap -> TokenActionsBSContentUM.Action.Exchange
|
is TokenActionsState.ActionState.Swap -> TokenActionsBSContentUM.Action.Exchange
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,6 @@ internal class QuickActionsConverterTest {
|
||||||
// Act
|
// Act
|
||||||
val result = QuickActionsConverter.toQuickActions(
|
val result = QuickActionsConverter.toQuickActions(
|
||||||
actions = actions,
|
actions = actions,
|
||||||
isRedesignEnabled = true,
|
|
||||||
context = TokenActionsContext.AddFunds,
|
context = TokenActionsContext.AddFunds,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -45,7 +44,6 @@ internal class QuickActionsConverterTest {
|
||||||
// Act
|
// Act
|
||||||
val result = QuickActionsConverter.toQuickActions(
|
val result = QuickActionsConverter.toQuickActions(
|
||||||
actions = actions,
|
actions = actions,
|
||||||
isRedesignEnabled = true,
|
|
||||||
context = TokenActionsContext.Markets,
|
context = TokenActionsContext.Markets,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -68,7 +66,6 @@ internal class QuickActionsConverterTest {
|
||||||
// Act
|
// Act
|
||||||
val result = QuickActionsConverter.toQuickActions(
|
val result = QuickActionsConverter.toQuickActions(
|
||||||
actions = actions,
|
actions = actions,
|
||||||
isRedesignEnabled = true,
|
|
||||||
context = TokenActionsContext.Markets,
|
context = TokenActionsContext.Markets,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -92,7 +89,6 @@ internal class QuickActionsConverterTest {
|
||||||
// Act
|
// Act
|
||||||
val result = QuickActionsConverter.toQuickActions(
|
val result = QuickActionsConverter.toQuickActions(
|
||||||
actions = actions,
|
actions = actions,
|
||||||
isRedesignEnabled = true,
|
|
||||||
context = TokenActionsContext.Transfer,
|
context = TokenActionsContext.Transfer,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -116,7 +112,6 @@ internal class QuickActionsConverterTest {
|
||||||
// Act
|
// Act
|
||||||
val result = QuickActionsConverter.toQuickActions(
|
val result = QuickActionsConverter.toQuickActions(
|
||||||
actions = actions,
|
actions = actions,
|
||||||
isRedesignEnabled = true,
|
|
||||||
context = TokenActionsContext.Transfer,
|
context = TokenActionsContext.Transfer,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -141,7 +136,6 @@ internal class QuickActionsConverterTest {
|
||||||
// Act
|
// Act
|
||||||
val result = QuickActionsConverter.toQuickActions(
|
val result = QuickActionsConverter.toQuickActions(
|
||||||
actions = actions,
|
actions = actions,
|
||||||
isRedesignEnabled = true,
|
|
||||||
context = TokenActionsContext.AddFunds,
|
context = TokenActionsContext.AddFunds,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -167,7 +161,6 @@ internal class QuickActionsConverterTest {
|
||||||
// Act
|
// Act
|
||||||
val result = QuickActionsConverter.toQuickActions(
|
val result = QuickActionsConverter.toQuickActions(
|
||||||
actions = actions,
|
actions = actions,
|
||||||
isRedesignEnabled = true,
|
|
||||||
context = TokenActionsContext.Transfer,
|
context = TokenActionsContext.Transfer,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -194,7 +187,6 @@ internal class QuickActionsConverterTest {
|
||||||
val result = QuickActionsConverter.quickActions(
|
val result = QuickActionsConverter.quickActions(
|
||||||
cryptoData = cryptoData(actions),
|
cryptoData = cryptoData(actions),
|
||||||
tokenActionsHandler = mockk(relaxed = true),
|
tokenActionsHandler = mockk(relaxed = true),
|
||||||
isRedesignEnabled = true,
|
|
||||||
context = TokenActionsContext.Transfer,
|
context = TokenActionsContext.Transfer,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -215,7 +207,6 @@ internal class QuickActionsConverterTest {
|
||||||
val result = QuickActionsConverter.quickActions(
|
val result = QuickActionsConverter.quickActions(
|
||||||
cryptoData = cryptoData(actions),
|
cryptoData = cryptoData(actions),
|
||||||
tokenActionsHandler = mockk(relaxed = true),
|
tokenActionsHandler = mockk(relaxed = true),
|
||||||
isRedesignEnabled = true,
|
|
||||||
context = TokenActionsContext.AddFunds,
|
context = TokenActionsContext.AddFunds,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,6 @@ import androidx.compose.foundation.layout.*
|
||||||
import androidx.compose.material3.Icon
|
import androidx.compose.material3.Icon
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.CompositionLocalProvider
|
|
||||||
import androidx.compose.runtime.Immutable
|
import androidx.compose.runtime.Immutable
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
|
|
@ -30,7 +29,6 @@ import com.tangem.core.ui.extensions.TextReference
|
||||||
import com.tangem.core.ui.extensions.resolveReference
|
import com.tangem.core.ui.extensions.resolveReference
|
||||||
import com.tangem.core.ui.extensions.stringReference
|
import com.tangem.core.ui.extensions.stringReference
|
||||||
import com.tangem.core.ui.extensions.stringResourceSafe
|
import com.tangem.core.ui.extensions.stringResourceSafe
|
||||||
import com.tangem.core.ui.res.LocalRedesignEnabled
|
|
||||||
import com.tangem.core.ui.res.TangemTheme
|
import com.tangem.core.ui.res.TangemTheme
|
||||||
import com.tangem.core.ui.res.TangemThemePreview
|
import com.tangem.core.ui.res.TangemThemePreview
|
||||||
import com.tangem.core.ui.res.TangemThemePreviewRedesign
|
import com.tangem.core.ui.res.TangemThemePreviewRedesign
|
||||||
|
|
@ -190,13 +188,11 @@ private fun PortfolioSelectRowPreview(@PreviewParameter(PreviewProvider::class)
|
||||||
@Composable
|
@Composable
|
||||||
private fun PortfolioSelectRowPreviewV2(@PreviewParameter(PreviewProvider::class) state: PortfolioSelectUM) {
|
private fun PortfolioSelectRowPreviewV2(@PreviewParameter(PreviewProvider::class) state: PortfolioSelectUM) {
|
||||||
TangemThemePreviewRedesign {
|
TangemThemePreviewRedesign {
|
||||||
CompositionLocalProvider(LocalRedesignEnabled provides true) {
|
|
||||||
PortfolioSelectRowV2(
|
PortfolioSelectRowV2(
|
||||||
state = state,
|
state = state,
|
||||||
modifier = Modifier.background(TangemTheme.colors2.surface.level3),
|
modifier = Modifier.background(TangemTheme.colors2.surface.level3),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private class PreviewProvider : PreviewParameterProvider<PortfolioSelectUM> {
|
private class PreviewProvider : PreviewParameterProvider<PortfolioSelectUM> {
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,6 @@ import androidx.compose.foundation.shape.RoundedCornerShape
|
||||||
import androidx.compose.material3.Icon
|
import androidx.compose.material3.Icon
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.CompositionLocalProvider
|
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.graphics.Color
|
import androidx.compose.ui.graphics.Color
|
||||||
|
|
@ -37,7 +36,6 @@ import com.tangem.core.ui.ds.row.TangemRowContainer
|
||||||
import com.tangem.core.ui.ds.row.TangemRowLayoutId
|
import com.tangem.core.ui.ds.row.TangemRowLayoutId
|
||||||
import com.tangem.core.ui.extensions.resolveReference
|
import com.tangem.core.ui.extensions.resolveReference
|
||||||
import com.tangem.core.ui.extensions.stringResourceSafe
|
import com.tangem.core.ui.extensions.stringResourceSafe
|
||||||
import com.tangem.core.ui.res.LocalRedesignEnabled
|
|
||||||
import com.tangem.core.ui.res.TangemTheme
|
import com.tangem.core.ui.res.TangemTheme
|
||||||
import com.tangem.core.ui.res.TangemThemePreviewRedesign
|
import com.tangem.core.ui.res.TangemThemePreviewRedesign
|
||||||
|
|
||||||
|
|
@ -202,7 +200,6 @@ private fun AddButton(state: AddTokenUM.Button, modifier: Modifier = Modifier) {
|
||||||
@Composable
|
@Composable
|
||||||
private fun Preview(@PreviewParameter(PreviewProvider::class) state: AddTokenUM) {
|
private fun Preview(@PreviewParameter(PreviewProvider::class) state: AddTokenUM) {
|
||||||
TangemThemePreviewRedesign {
|
TangemThemePreviewRedesign {
|
||||||
CompositionLocalProvider(LocalRedesignEnabled provides true) {
|
|
||||||
Box(
|
Box(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
|
|
@ -212,5 +209,4 @@ private fun Preview(@PreviewParameter(PreviewProvider::class) state: AddTokenUM)
|
||||||
AddTokenContentV2(state = state)
|
AddTokenContentV2(state = state)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
@ -1,46 +0,0 @@
|
||||||
package com.tangem.common.ui.expressStatus
|
|
||||||
|
|
||||||
import androidx.compose.foundation.lazy.LazyListScope
|
|
||||||
import androidx.compose.ui.Modifier
|
|
||||||
import com.tangem.common.ui.R
|
|
||||||
import com.tangem.common.ui.expressStatus.state.ExpressTransactionStateIconUM
|
|
||||||
import com.tangem.common.ui.expressStatus.state.ExpressTransactionStateUM
|
|
||||||
import com.tangem.core.ui.res.TangemTheme
|
|
||||||
import kotlinx.collections.immutable.PersistentList
|
|
||||||
|
|
||||||
fun LazyListScope.expressTransactionsItemsLegacy(
|
|
||||||
expressTxs: PersistentList<ExpressTransactionStateUM>,
|
|
||||||
modifier: Modifier = Modifier,
|
|
||||||
) {
|
|
||||||
items(
|
|
||||||
count = expressTxs.size,
|
|
||||||
key = { index -> expressTxs[index].info.txId },
|
|
||||||
contentType = { index -> expressTxs[index]::class.java },
|
|
||||||
) { index ->
|
|
||||||
val itemInfo = expressTxs[index].info
|
|
||||||
val (iconRes, tint) = when (itemInfo.iconState) {
|
|
||||||
ExpressTransactionStateIconUM.Warning -> {
|
|
||||||
R.drawable.ic_alert_triangle_20 to TangemTheme.colors.icon.attention
|
|
||||||
}
|
|
||||||
ExpressTransactionStateIconUM.Error -> {
|
|
||||||
R.drawable.ic_alert_circle_24 to TangemTheme.colors.icon.warning
|
|
||||||
}
|
|
||||||
ExpressTransactionStateIconUM.None -> null to null
|
|
||||||
}
|
|
||||||
|
|
||||||
ExpressStatusItem(
|
|
||||||
title = itemInfo.title,
|
|
||||||
fromTokenIconState = itemInfo.fromCurrencyIcon,
|
|
||||||
toTokenIconState = itemInfo.toCurrencyIcon,
|
|
||||||
fromAmount = itemInfo.fromAmount,
|
|
||||||
fromSymbol = itemInfo.fromAmountSymbol,
|
|
||||||
toAmount = itemInfo.toAmount,
|
|
||||||
toSymbol = itemInfo.toAmountSymbol,
|
|
||||||
subtitle = itemInfo.subtitle,
|
|
||||||
onClick = itemInfo.onClick,
|
|
||||||
infoIconRes = iconRes,
|
|
||||||
infoIconTint = tint,
|
|
||||||
modifier = modifier.animateItem(),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -19,10 +19,6 @@
|
||||||
"name": "TWI_485_USEDESK_ENABLED",
|
"name": "TWI_485_USEDESK_ENABLED",
|
||||||
"version": "undefined"
|
"version": "undefined"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "APP_REDESIGN_ENABLED",
|
|
||||||
"version": "6.0"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "VIRTUAL_ACCOUNTS_ENABLED",
|
"name": "VIRTUAL_ACCOUNTS_ENABLED",
|
||||||
"version": "undefined"
|
"version": "undefined"
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,6 @@ internal class FeatureTogglesNamingConventionTest {
|
||||||
/** Toggles created before the AND_/TWI_ naming convention. Do NOT add new entries. */
|
/** Toggles created before the AND_/TWI_ naming convention. Do NOT add new entries. */
|
||||||
val EXCLUDED_TOGGLES_LIST = setOf(
|
val EXCLUDED_TOGGLES_LIST = setOf(
|
||||||
"ADDRESS_SYNC_ENABLED",
|
"ADDRESS_SYNC_ENABLED",
|
||||||
"APP_REDESIGN_ENABLED",
|
|
||||||
"NEW_CARD_SCANNING_ENABLED",
|
"NEW_CARD_SCANNING_ENABLED",
|
||||||
"VIRTUAL_ACCOUNTS_ENABLED",
|
"VIRTUAL_ACCOUNTS_ENABLED",
|
||||||
"VISA_ONBOARDING_ENABLED",
|
"VISA_ONBOARDING_ENABLED",
|
||||||
|
|
|
||||||
|
|
@ -1,7 +0,0 @@
|
||||||
package com.tangem.core.ui
|
|
||||||
|
|
||||||
interface DesignFeatureToggles {
|
|
||||||
val isRedesignEnabled: Boolean
|
|
||||||
|
|
||||||
val isWarningsRefactoringEnabled: Boolean
|
|
||||||
}
|
|
||||||
|
|
@ -19,6 +19,4 @@ interface UiDependencies {
|
||||||
val globalTopSnackbarHostState: TangemTopSnackbarHostState
|
val globalTopSnackbarHostState: TangemTopSnackbarHostState
|
||||||
|
|
||||||
val eventMessageHandler: EventMessageHandler
|
val eventMessageHandler: EventMessageHandler
|
||||||
|
|
||||||
val designFeatureToggles: DesignFeatureToggles
|
|
||||||
}
|
}
|
||||||
|
|
@ -10,44 +10,15 @@ import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.tooling.preview.Preview
|
import androidx.compose.ui.tooling.preview.Preview
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import com.tangem.core.ui.R
|
import com.tangem.core.ui.R
|
||||||
import com.tangem.core.ui.components.buttons.SecondarySmallButton
|
|
||||||
import com.tangem.core.ui.components.buttons.SmallButtonConfig
|
|
||||||
import com.tangem.core.ui.ds.button.*
|
import com.tangem.core.ui.ds.button.*
|
||||||
import com.tangem.core.ui.extensions.resourceReference
|
import com.tangem.core.ui.extensions.resourceReference
|
||||||
import com.tangem.core.ui.extensions.stringResourceSafe
|
import com.tangem.core.ui.extensions.stringResourceSafe
|
||||||
import com.tangem.core.ui.res.LocalRedesignEnabled
|
|
||||||
import com.tangem.core.ui.res.TangemTheme
|
import com.tangem.core.ui.res.TangemTheme
|
||||||
import com.tangem.core.ui.res.TangemThemePreview
|
|
||||||
import com.tangem.core.ui.res.TangemThemePreviewRedesign
|
import com.tangem.core.ui.res.TangemThemePreviewRedesign
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun UnableToLoadData(onRetryClick: () -> Unit, modifier: Modifier = Modifier) {
|
fun UnableToLoadData(onRetryClick: () -> Unit, modifier: Modifier = Modifier) {
|
||||||
if (LocalRedesignEnabled.current) {
|
|
||||||
UnableToLoadDataV2(onRetryClick, modifier)
|
UnableToLoadDataV2(onRetryClick, modifier)
|
||||||
} else {
|
|
||||||
UnableToLoadDataV1(onRetryClick, modifier)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Composable
|
|
||||||
private fun UnableToLoadDataV1(onRetryClick: () -> Unit, modifier: Modifier = Modifier) {
|
|
||||||
Column(
|
|
||||||
modifier = modifier,
|
|
||||||
verticalArrangement = Arrangement.spacedBy(TangemTheme.dimens.spacing12),
|
|
||||||
horizontalAlignment = Alignment.CenterHorizontally,
|
|
||||||
) {
|
|
||||||
Text(
|
|
||||||
text = stringResourceSafe(R.string.markets_loading_error_title),
|
|
||||||
style = TangemTheme.typography.caption1,
|
|
||||||
color = TangemTheme.colors.text.tertiary,
|
|
||||||
)
|
|
||||||
SecondarySmallButton(
|
|
||||||
config = SmallButtonConfig(
|
|
||||||
text = resourceReference(R.string.try_to_load_data_again_button_title),
|
|
||||||
onClick = onRetryClick,
|
|
||||||
),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
|
|
@ -81,12 +52,3 @@ private fun PreviewV2() {
|
||||||
UnableToLoadDataV2(onRetryClick = {})
|
UnableToLoadDataV2(onRetryClick = {})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Preview
|
|
||||||
@Preview(uiMode = Configuration.UI_MODE_NIGHT_YES)
|
|
||||||
@Composable
|
|
||||||
private fun PreviewV1() {
|
|
||||||
TangemThemePreview {
|
|
||||||
UnableToLoadDataV1(onRetryClick = {})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -2,22 +2,13 @@ package com.tangem.core.ui.components.bottomsheets.message
|
||||||
|
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import com.tangem.core.ui.res.LocalRedesignEnabled
|
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun MessageBottomSheet(state: MessageBottomSheetUM, onDismissRequest: () -> Unit) {
|
fun MessageBottomSheet(state: MessageBottomSheetUM, onDismissRequest: () -> Unit) {
|
||||||
if (LocalRedesignEnabled.current) {
|
|
||||||
MessageBottomSheetV2(state, onDismissRequest)
|
MessageBottomSheetV2(state, onDismissRequest)
|
||||||
} else {
|
|
||||||
MessageBottomSheetV1(state, onDismissRequest)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun MessageBottomSheetContent(state: MessageBottomSheetUM, modifier: Modifier = Modifier) {
|
fun MessageBottomSheetContent(state: MessageBottomSheetUM, modifier: Modifier = Modifier) {
|
||||||
if (LocalRedesignEnabled.current) {
|
|
||||||
MessageBottomSheetContentV2(state, modifier)
|
MessageBottomSheetContentV2(state, modifier)
|
||||||
} else {
|
|
||||||
MessageBottomSheetContentV1(state, modifier)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
@ -19,7 +19,6 @@ import androidx.compose.ui.unit.Dp
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import com.tangem.core.ui.components.CircleShimmer
|
import com.tangem.core.ui.components.CircleShimmer
|
||||||
import com.tangem.core.ui.extensions.conditional
|
import com.tangem.core.ui.extensions.conditional
|
||||||
import com.tangem.core.ui.res.LocalRedesignEnabled
|
|
||||||
import com.tangem.core.ui.res.TangemTheme
|
import com.tangem.core.ui.res.TangemTheme
|
||||||
import com.tangem.core.ui.test.TokenElementsTestTags
|
import com.tangem.core.ui.test.TokenElementsTestTags
|
||||||
import com.tangem.core.ui.utils.getGreyScaleColorFilter
|
import com.tangem.core.ui.utils.getGreyScaleColorFilter
|
||||||
|
|
@ -51,11 +50,7 @@ fun TangemCurrencyIcon(state: CurrencyIconState, modifier: Modifier = Modifier,
|
||||||
modifier = iconModifier,
|
modifier = iconModifier,
|
||||||
shouldShowTopBadge = shouldDisplayNetwork,
|
shouldShowTopBadge = shouldDisplayNetwork,
|
||||||
networkBadgeSize = 14.dp,
|
networkBadgeSize = 14.dp,
|
||||||
networkBadgeBackground = if (LocalRedesignEnabled.current) {
|
networkBadgeBackground = TangemTheme.colors2.surface.level1,
|
||||||
TangemTheme.colors2.surface.level1
|
|
||||||
} else {
|
|
||||||
TangemTheme.colors.background.primary
|
|
||||||
},
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,10 +7,8 @@ import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.CompositionLocalProvider
|
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.text.SpanStyle
|
import androidx.compose.ui.text.SpanStyle
|
||||||
import androidx.compose.ui.text.TextStyle
|
|
||||||
import androidx.compose.ui.text.buildAnnotatedString
|
import androidx.compose.ui.text.buildAnnotatedString
|
||||||
import androidx.compose.ui.text.withStyle
|
import androidx.compose.ui.text.withStyle
|
||||||
import androidx.compose.ui.tooling.preview.Preview
|
import androidx.compose.ui.tooling.preview.Preview
|
||||||
|
|
@ -21,7 +19,6 @@ import com.tangem.core.ui.extensions.TextReference
|
||||||
import com.tangem.core.ui.extensions.resolveReference
|
import com.tangem.core.ui.extensions.resolveReference
|
||||||
import com.tangem.core.ui.extensions.stringReference
|
import com.tangem.core.ui.extensions.stringReference
|
||||||
import com.tangem.core.ui.extensions.stringResourceSafe
|
import com.tangem.core.ui.extensions.stringResourceSafe
|
||||||
import com.tangem.core.ui.res.LocalRedesignEnabled
|
|
||||||
import com.tangem.core.ui.res.TangemTheme
|
import com.tangem.core.ui.res.TangemTheme
|
||||||
import com.tangem.core.ui.res.TangemThemePreview
|
import com.tangem.core.ui.res.TangemThemePreview
|
||||||
import com.tangem.core.ui.res.TangemThemePreviewRedesign
|
import com.tangem.core.ui.res.TangemThemePreviewRedesign
|
||||||
|
|
@ -34,67 +31,13 @@ fun DescriptionItem(
|
||||||
hasFullDescription: Boolean,
|
hasFullDescription: Boolean,
|
||||||
onReadMoreClick: () -> Unit,
|
onReadMoreClick: () -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
textStyle: TextStyle = TangemTheme.typography.body2,
|
|
||||||
) {
|
) {
|
||||||
if (LocalRedesignEnabled.current) {
|
|
||||||
DescriptionItemV2(
|
DescriptionItemV2(
|
||||||
description = description,
|
description = description,
|
||||||
hasFullDescription = hasFullDescription,
|
hasFullDescription = hasFullDescription,
|
||||||
onReadMoreClick = onReadMoreClick,
|
onReadMoreClick = onReadMoreClick,
|
||||||
modifier = modifier,
|
modifier = modifier,
|
||||||
)
|
)
|
||||||
} else {
|
|
||||||
DescriptionItemV1(
|
|
||||||
description = description,
|
|
||||||
hasFullDescription = hasFullDescription,
|
|
||||||
onReadMoreClick = onReadMoreClick,
|
|
||||||
modifier = modifier,
|
|
||||||
textStyle = textStyle,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Composable
|
|
||||||
private fun DescriptionItemV1(
|
|
||||||
description: TextReference,
|
|
||||||
hasFullDescription: Boolean,
|
|
||||||
onReadMoreClick: () -> Unit,
|
|
||||||
modifier: Modifier = Modifier,
|
|
||||||
textStyle: TextStyle = TangemTheme.typography.body2,
|
|
||||||
) {
|
|
||||||
if (hasFullDescription) {
|
|
||||||
val text = buildAnnotatedString {
|
|
||||||
withStyle(SpanStyle(color = TangemTheme.colors.text.secondary)) {
|
|
||||||
append(description.resolveReference())
|
|
||||||
}
|
|
||||||
withStyle(SpanStyle(color = TangemTheme.colors.text.accent)) {
|
|
||||||
append(
|
|
||||||
" " + stringResourceSafe(R.string.common_read_more).replace(
|
|
||||||
' ',
|
|
||||||
StringsSigns.NON_BREAKING_SPACE,
|
|
||||||
),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Text(
|
|
||||||
modifier = modifier
|
|
||||||
.clickable(
|
|
||||||
interactionSource = null,
|
|
||||||
indication = null,
|
|
||||||
onClick = onReadMoreClick,
|
|
||||||
),
|
|
||||||
text = text,
|
|
||||||
style = textStyle,
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
Text(
|
|
||||||
modifier = modifier,
|
|
||||||
text = description.resolveReference(),
|
|
||||||
style = textStyle,
|
|
||||||
color = TangemTheme.colors.text.secondary,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
|
|
@ -141,34 +84,7 @@ private fun DescriptionItemV2(
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun DescriptionPlaceholder(modifier: Modifier = Modifier) {
|
fun DescriptionPlaceholder(modifier: Modifier = Modifier) {
|
||||||
if (LocalRedesignEnabled.current) {
|
|
||||||
DescriptionPlaceholderV2(modifier)
|
DescriptionPlaceholderV2(modifier)
|
||||||
} else {
|
|
||||||
DescriptionPlaceholderV1(modifier)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Composable
|
|
||||||
private fun DescriptionPlaceholderV1(modifier: Modifier = Modifier) {
|
|
||||||
Column(
|
|
||||||
modifier = modifier,
|
|
||||||
) {
|
|
||||||
TextShimmer(
|
|
||||||
modifier = Modifier.fillMaxWidth(),
|
|
||||||
style = TangemTheme.typography.body2,
|
|
||||||
textSizeHeight = true,
|
|
||||||
)
|
|
||||||
TextShimmer(
|
|
||||||
modifier = Modifier.fillMaxWidth(),
|
|
||||||
style = TangemTheme.typography.body2,
|
|
||||||
textSizeHeight = true,
|
|
||||||
)
|
|
||||||
TextShimmer(
|
|
||||||
modifier = Modifier.fillMaxWidth(fraction = 0.8f),
|
|
||||||
style = TangemTheme.typography.body2,
|
|
||||||
textSizeHeight = true,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
|
|
@ -213,7 +129,6 @@ private fun ContentPreviewV1() {
|
||||||
@Preview
|
@Preview
|
||||||
@Composable
|
@Composable
|
||||||
private fun ContentPreviewV2() {
|
private fun ContentPreviewV2() {
|
||||||
CompositionLocalProvider(LocalRedesignEnabled provides true) {
|
|
||||||
TangemThemePreviewRedesign {
|
TangemThemePreviewRedesign {
|
||||||
DescriptionItem(
|
DescriptionItem(
|
||||||
description = stringReference(
|
description = stringReference(
|
||||||
|
|
@ -224,7 +139,6 @@ private fun ContentPreviewV2() {
|
||||||
onReadMoreClick = {},
|
onReadMoreClick = {},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Preview
|
@Preview
|
||||||
|
|
@ -245,7 +159,6 @@ private fun PreviewPlaceholderV1() {
|
||||||
@Preview
|
@Preview
|
||||||
@Composable
|
@Composable
|
||||||
private fun PreviewPlaceholderV2() {
|
private fun PreviewPlaceholderV2() {
|
||||||
CompositionLocalProvider(LocalRedesignEnabled provides true) {
|
|
||||||
TangemThemePreviewRedesign {
|
TangemThemePreviewRedesign {
|
||||||
PreviewShimmerContainer(
|
PreviewShimmerContainer(
|
||||||
actualContent = {
|
actualContent = {
|
||||||
|
|
@ -256,5 +169,4 @@ private fun PreviewPlaceholderV2() {
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
@ -5,7 +5,6 @@ import androidx.compose.foundation.layout.*
|
||||||
import androidx.compose.material3.Icon
|
import androidx.compose.material3.Icon
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.CompositionLocalProvider
|
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.graphics.vector.ImageVector
|
import androidx.compose.ui.graphics.vector.ImageVector
|
||||||
|
|
@ -14,7 +13,6 @@ import androidx.compose.ui.text.TextStyle
|
||||||
import androidx.compose.ui.text.style.TextOverflow
|
import androidx.compose.ui.text.style.TextOverflow
|
||||||
import androidx.compose.ui.tooling.preview.Preview
|
import androidx.compose.ui.tooling.preview.Preview
|
||||||
import com.tangem.core.ui.R
|
import com.tangem.core.ui.R
|
||||||
import com.tangem.core.ui.res.LocalRedesignEnabled
|
|
||||||
import com.tangem.core.ui.res.TangemTheme
|
import com.tangem.core.ui.res.TangemTheme
|
||||||
import com.tangem.core.ui.res.TangemThemePreview
|
import com.tangem.core.ui.res.TangemThemePreview
|
||||||
import com.tangem.core.ui.res.TangemThemePreviewRedesign
|
import com.tangem.core.ui.res.TangemThemePreviewRedesign
|
||||||
|
|
@ -27,7 +25,6 @@ fun PriceChangeInPercent(
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
isDisabled: Boolean = false,
|
isDisabled: Boolean = false,
|
||||||
) {
|
) {
|
||||||
if (LocalRedesignEnabled.current) {
|
|
||||||
PriceChangeInPercentV2(
|
PriceChangeInPercentV2(
|
||||||
modifier = modifier,
|
modifier = modifier,
|
||||||
valueInPercent = valueInPercent,
|
valueInPercent = valueInPercent,
|
||||||
|
|
@ -35,64 +32,6 @@ fun PriceChangeInPercent(
|
||||||
textStyle = textStyle,
|
textStyle = textStyle,
|
||||||
isDisabled = isDisabled,
|
isDisabled = isDisabled,
|
||||||
)
|
)
|
||||||
} else {
|
|
||||||
PriceChangeInPercentV1(
|
|
||||||
modifier = modifier,
|
|
||||||
valueInPercent = valueInPercent,
|
|
||||||
type = type,
|
|
||||||
textStyle = textStyle,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Composable
|
|
||||||
private fun PriceChangeInPercentV1(
|
|
||||||
valueInPercent: String,
|
|
||||||
type: PriceChangeType,
|
|
||||||
textStyle: TextStyle,
|
|
||||||
modifier: Modifier = Modifier,
|
|
||||||
) {
|
|
||||||
if (valueInPercent.isBlank()) {
|
|
||||||
Box(modifier)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
Row(
|
|
||||||
modifier = modifier,
|
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
|
||||||
horizontalArrangement = Arrangement.spacedBy(space = TangemTheme.dimens.spacing2),
|
|
||||||
) {
|
|
||||||
Icon(
|
|
||||||
modifier = Modifier
|
|
||||||
.size(TangemTheme.dimens.size8)
|
|
||||||
.align(Alignment.CenterVertically),
|
|
||||||
imageVector = ImageVector.vectorResource(
|
|
||||||
id = when (type) {
|
|
||||||
PriceChangeType.UP -> R.drawable.ic_arrow_up_8
|
|
||||||
PriceChangeType.DOWN -> R.drawable.ic_arrow_down_8
|
|
||||||
PriceChangeType.NEUTRAL -> R.drawable.ic_elipse_8
|
|
||||||
},
|
|
||||||
),
|
|
||||||
tint = when (type) {
|
|
||||||
PriceChangeType.UP -> TangemTheme.colors.icon.accent
|
|
||||||
PriceChangeType.DOWN -> TangemTheme.colors.icon.warning
|
|
||||||
PriceChangeType.NEUTRAL -> TangemTheme.colors.icon.inactive
|
|
||||||
},
|
|
||||||
contentDescription = null,
|
|
||||||
)
|
|
||||||
|
|
||||||
Text(
|
|
||||||
text = valueInPercent,
|
|
||||||
color = when (type) {
|
|
||||||
PriceChangeType.UP -> TangemTheme.colors.text.accent
|
|
||||||
PriceChangeType.DOWN -> TangemTheme.colors.text.warning
|
|
||||||
PriceChangeType.NEUTRAL -> TangemTheme.colors.text.disabled
|
|
||||||
},
|
|
||||||
style = textStyle,
|
|
||||||
overflow = TextOverflow.Visible,
|
|
||||||
maxLines = 1,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
|
|
@ -191,7 +130,6 @@ private fun PreviewV1() {
|
||||||
@Composable
|
@Composable
|
||||||
private fun PreviewV2() {
|
private fun PreviewV2() {
|
||||||
TangemThemePreviewRedesign {
|
TangemThemePreviewRedesign {
|
||||||
CompositionLocalProvider(LocalRedesignEnabled provides true) {
|
|
||||||
Column {
|
Column {
|
||||||
PriceChangeInPercent(
|
PriceChangeInPercent(
|
||||||
valueInPercent = "52.00%",
|
valueInPercent = "52.00%",
|
||||||
|
|
@ -217,7 +155,6 @@ private fun PreviewV2() {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//endregion Preview
|
//endregion Preview
|
||||||
|
|
@ -6,9 +6,6 @@ import androidx.compose.foundation.layout.Arrangement
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
import androidx.compose.foundation.layout.fillMaxSize
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
import androidx.compose.material3.CircularProgressIndicator
|
import androidx.compose.material3.CircularProgressIndicator
|
||||||
import androidx.compose.material3.SnackbarDuration
|
|
||||||
import androidx.compose.material3.SnackbarHostState
|
|
||||||
import androidx.compose.material3.SnackbarResult
|
|
||||||
import androidx.compose.runtime.*
|
import androidx.compose.runtime.*
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
|
|
@ -28,10 +25,6 @@ import com.tangem.core.ui.res.*
|
||||||
@Composable
|
@Composable
|
||||||
fun EventMessageEffect(
|
fun EventMessageEffect(
|
||||||
messageHandler: EventMessageHandler = LocalEventMessageHandler.current,
|
messageHandler: EventMessageHandler = LocalEventMessageHandler.current,
|
||||||
snackbarHostState: SnackbarHostState = LocalSnackbarHostState.current,
|
|
||||||
onShowSnackbar: suspend (SnackbarMessage, Context) -> Unit = { message, context ->
|
|
||||||
showSnackbar(snackbarHostState, message, context)
|
|
||||||
},
|
|
||||||
topSnackbarHostState: TangemTopSnackbarHostState = LocalTopSnackbarHostState.current,
|
topSnackbarHostState: TangemTopSnackbarHostState = LocalTopSnackbarHostState.current,
|
||||||
onShowTopSnackbar: suspend (SnackbarMessage) -> Unit = { message ->
|
onShowTopSnackbar: suspend (SnackbarMessage) -> Unit = { message ->
|
||||||
topSnackbarHostState.showSnackbar(message)
|
topSnackbarHostState.showSnackbar(message)
|
||||||
|
|
@ -44,16 +37,11 @@ fun EventMessageEffect(
|
||||||
var dialogMessage: DialogMessage? by remember { mutableStateOf(value = null) }
|
var dialogMessage: DialogMessage? by remember { mutableStateOf(value = null) }
|
||||||
var bottomSheetMessage: BottomSheetMessage? by remember { mutableStateOf(value = null) }
|
var bottomSheetMessage: BottomSheetMessage? by remember { mutableStateOf(value = null) }
|
||||||
var loadingMessage: GlobalLoadingMessage? by remember { mutableStateOf(value = null) }
|
var loadingMessage: GlobalLoadingMessage? by remember { mutableStateOf(value = null) }
|
||||||
val isRedesignEnabled = LocalRedesignEnabled.current
|
|
||||||
|
|
||||||
EventEffect(event = messageEvent) { message ->
|
EventEffect(event = messageEvent) { message ->
|
||||||
when (message) {
|
when (message) {
|
||||||
is SnackbarMessage -> {
|
is SnackbarMessage -> {
|
||||||
if (isRedesignEnabled) {
|
|
||||||
onShowTopSnackbar(message)
|
onShowTopSnackbar(message)
|
||||||
} else {
|
|
||||||
onShowSnackbar(message, context)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
is DialogMessage -> {
|
is DialogMessage -> {
|
||||||
dialogMessage = message
|
dialogMessage = message
|
||||||
|
|
@ -155,23 +143,6 @@ private fun MessageDialog(message: DialogMessage, onDismissRequest: () -> Unit)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
private suspend fun showSnackbar(snackbarHostState: SnackbarHostState, message: SnackbarMessage, context: Context) {
|
|
||||||
val result = snackbarHostState.showSnackbar(
|
|
||||||
message = message.message.resolveReference(context.resources),
|
|
||||||
actionLabel = message.actionLabel?.resolveReference(context.resources),
|
|
||||||
duration = when (message.duration) {
|
|
||||||
SnackbarMessage.Duration.Short -> SnackbarDuration.Short
|
|
||||||
SnackbarMessage.Duration.Long -> SnackbarDuration.Long
|
|
||||||
SnackbarMessage.Duration.Indefinite -> SnackbarDuration.Indefinite
|
|
||||||
},
|
|
||||||
)
|
|
||||||
|
|
||||||
when (result) {
|
|
||||||
SnackbarResult.Dismissed -> message.onDismissRequest()
|
|
||||||
SnackbarResult.ActionPerformed -> message.action?.invoke()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun showToast(message: ToastMessage, context: Context) {
|
private fun showToast(message: ToastMessage, context: Context) {
|
||||||
Toast.makeText(
|
Toast.makeText(
|
||||||
/* context = */ context,
|
/* context = */ context,
|
||||||
|
|
|
||||||
|
|
@ -65,11 +65,7 @@ fun TangemTheme(
|
||||||
typography = typography,
|
typography = typography,
|
||||||
dimens = dimens,
|
dimens = dimens,
|
||||||
content = {
|
content = {
|
||||||
if (uiDependencies.designFeatureToggles.isRedesignEnabled) {
|
|
||||||
TangemThemeRedesign { content() }
|
TangemThemeRedesign { content() }
|
||||||
} else {
|
|
||||||
content()
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
@ -452,14 +448,6 @@ val LocalHazeState = staticCompositionLocalOf<HazeState> {
|
||||||
error("No HazeState provided")
|
error("No HazeState provided")
|
||||||
}
|
}
|
||||||
|
|
||||||
val LocalRedesignEnabled = staticCompositionLocalOf<Boolean> {
|
|
||||||
false
|
|
||||||
}
|
|
||||||
|
|
||||||
val LocalVisaRedesignEnabled = staticCompositionLocalOf<Boolean> {
|
|
||||||
false
|
|
||||||
}
|
|
||||||
|
|
||||||
val LocalPowerSavingState = compositionLocalOf<PowerSavingState> {
|
val LocalPowerSavingState = compositionLocalOf<PowerSavingState> {
|
||||||
error("No PowerSavingState provided")
|
error("No PowerSavingState provided")
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,6 @@ fun TangemThemeRedesign(content: @Composable () -> Unit) {
|
||||||
colorScheme = tangemColorScheme(colors = rememberedColors),
|
colorScheme = tangemColorScheme(colors = rememberedColors),
|
||||||
) {
|
) {
|
||||||
CompositionLocalProvider(
|
CompositionLocalProvider(
|
||||||
LocalRedesignEnabled provides true,
|
|
||||||
LocalTangemColors provides rememberedColors,
|
LocalTangemColors provides rememberedColors,
|
||||||
LocalTangemColors2 provides if (LocalIsInDarkTheme.current) darkThemeColors2() else lightThemeColors2(),
|
LocalTangemColors2 provides if (LocalIsInDarkTheme.current) darkThemeColors2() else lightThemeColors2(),
|
||||||
LocalTangemColors3 provides rememberedColors3,
|
LocalTangemColors3 provides rememberedColors3,
|
||||||
|
|
|
||||||
|
|
@ -395,7 +395,7 @@ internal class AddToPortfolioModel @Inject constructor(
|
||||||
currency = addedToken.currency,
|
currency = addedToken.currency,
|
||||||
accountId = selectedPortfolio.account.account.account.accountId,
|
accountId = selectedPortfolio.account.account.account.accountId,
|
||||||
).onEach { state ->
|
).onEach { state ->
|
||||||
val requestedQuickActions = toQuickActions(state.states, isRedesignEnabled = true)
|
val requestedQuickActions = toQuickActions(state.states)
|
||||||
when {
|
when {
|
||||||
requestedQuickActions.isNotEmpty() -> {
|
requestedQuickActions.isNotEmpty() -> {
|
||||||
timerJob.cancel()
|
timerJob.cancel()
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,6 @@ import androidx.compose.foundation.shape.RoundedCornerShape
|
||||||
import androidx.compose.material3.Icon
|
import androidx.compose.material3.Icon
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.CompositionLocalProvider
|
|
||||||
import androidx.compose.runtime.key
|
import androidx.compose.runtime.key
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
|
|
@ -36,7 +35,6 @@ import com.tangem.core.ui.ds.row.TangemRowContainer
|
||||||
import com.tangem.core.ui.ds.row.TangemRowLayoutId
|
import com.tangem.core.ui.ds.row.TangemRowLayoutId
|
||||||
import com.tangem.core.ui.extensions.resourceReference
|
import com.tangem.core.ui.extensions.resourceReference
|
||||||
import com.tangem.core.ui.extensions.stringResourceSafe
|
import com.tangem.core.ui.extensions.stringResourceSafe
|
||||||
import com.tangem.core.ui.res.LocalRedesignEnabled
|
|
||||||
import com.tangem.core.ui.res.TangemTheme
|
import com.tangem.core.ui.res.TangemTheme
|
||||||
import com.tangem.core.ui.res.TangemThemePreview
|
import com.tangem.core.ui.res.TangemThemePreview
|
||||||
import com.tangem.core.ui.res.TangemThemePreviewRedesign
|
import com.tangem.core.ui.res.TangemThemePreviewRedesign
|
||||||
|
|
@ -220,12 +218,10 @@ private fun Preview(@PreviewParameter(ChooseNetworkContentProvider::class) conte
|
||||||
@Preview(showBackground = true, widthDp = 360, uiMode = Configuration.UI_MODE_NIGHT_YES)
|
@Preview(showBackground = true, widthDp = 360, uiMode = Configuration.UI_MODE_NIGHT_YES)
|
||||||
private fun PreviewV2(@PreviewParameter(ChooseNetworkContentProvider::class) content: ChooseNetworkUM) {
|
private fun PreviewV2(@PreviewParameter(ChooseNetworkContentProvider::class) content: ChooseNetworkUM) {
|
||||||
TangemThemePreviewRedesign {
|
TangemThemePreviewRedesign {
|
||||||
CompositionLocalProvider(LocalRedesignEnabled provides true) {
|
|
||||||
ChooseNetworkContent(
|
ChooseNetworkContent(
|
||||||
state = content,
|
state = content,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
internal class ChooseNetworkContentProvider : PreviewParameterProvider<ChooseNetworkUM> {
|
internal class ChooseNetworkContentProvider : PreviewParameterProvider<ChooseNetworkUM> {
|
||||||
|
|
|
||||||
|
|
@ -77,7 +77,7 @@ import com.tangem.core.ui.ds.row.token.internal.TokenRowTitle
|
||||||
import com.tangem.core.ui.extensions.*
|
import com.tangem.core.ui.extensions.*
|
||||||
import com.tangem.core.ui.res.TangemColorPalette
|
import com.tangem.core.ui.res.TangemColorPalette
|
||||||
import com.tangem.core.ui.res.TangemTheme
|
import com.tangem.core.ui.res.TangemTheme
|
||||||
import com.tangem.core.ui.res.TangemThemePreview
|
import com.tangem.core.ui.res.TangemThemePreviewRedesign
|
||||||
import com.tangem.core.ui.test.BuyTokenScreenTestTags
|
import com.tangem.core.ui.test.BuyTokenScreenTestTags
|
||||||
import com.tangem.core.ui.utils.ProvideSharedTransitionScope
|
import com.tangem.core.ui.utils.ProvideSharedTransitionScope
|
||||||
import com.tangem.core.ui.utils.TangemSharedTransitionLayout
|
import com.tangem.core.ui.utils.TangemSharedTransitionLayout
|
||||||
|
|
@ -851,7 +851,7 @@ private fun LazyListScope.tokensNotFound(modifier: Modifier = Modifier) {
|
||||||
@Preview
|
@Preview
|
||||||
@Composable
|
@Composable
|
||||||
private fun TokenScreenPreview(@PreviewParameter(ChooseTokenScreenPreviewProvider::class) state: ChooseTokenFullUM) {
|
private fun TokenScreenPreview(@PreviewParameter(ChooseTokenScreenPreviewProvider::class) state: ChooseTokenFullUM) {
|
||||||
TangemThemePreview {
|
TangemThemePreviewRedesign {
|
||||||
ChooseTokenScreen(
|
ChooseTokenScreen(
|
||||||
state = state,
|
state = state,
|
||||||
modifier = Modifier,
|
modifier = Modifier,
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@ import android.content.res.Configuration
|
||||||
import androidx.compose.foundation.layout.PaddingValues
|
import androidx.compose.foundation.layout.PaddingValues
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.CompositionLocalProvider
|
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.tooling.preview.Preview
|
import androidx.compose.ui.tooling.preview.Preview
|
||||||
import androidx.compose.ui.tooling.preview.PreviewParameter
|
import androidx.compose.ui.tooling.preview.PreviewParameter
|
||||||
|
|
@ -14,7 +13,6 @@ import com.tangem.core.ui.components.bottomsheets.TangemBottomSheetConfig
|
||||||
import com.tangem.core.ui.components.bottomsheets.TangemBottomSheetConfigContent
|
import com.tangem.core.ui.components.bottomsheets.TangemBottomSheetConfigContent
|
||||||
import com.tangem.core.ui.components.bottomsheets.TangemBottomSheetType
|
import com.tangem.core.ui.components.bottomsheets.TangemBottomSheetType
|
||||||
import com.tangem.core.ui.ds2.topnavigation.TangemTopNavigation
|
import com.tangem.core.ui.ds2.topnavigation.TangemTopNavigation
|
||||||
import com.tangem.core.ui.res.LocalRedesignEnabled
|
|
||||||
import com.tangem.core.ui.res.TangemTheme
|
import com.tangem.core.ui.res.TangemTheme
|
||||||
import com.tangem.core.ui.res.TangemThemePreview
|
import com.tangem.core.ui.res.TangemThemePreview
|
||||||
import com.tangem.core.ui.res.TangemThemePreviewRedesign
|
import com.tangem.core.ui.res.TangemThemePreviewRedesign
|
||||||
|
|
@ -73,7 +71,6 @@ private fun Preview(@PreviewParameter(PortfolioSelectorPreviewStateProvider::cla
|
||||||
@Composable
|
@Composable
|
||||||
private fun PreviewV2(@PreviewParameter(PortfolioSelectorPreviewStateProvider::class) params: PortfolioSelectorUM) {
|
private fun PreviewV2(@PreviewParameter(PortfolioSelectorPreviewStateProvider::class) params: PortfolioSelectorUM) {
|
||||||
TangemThemePreviewRedesign {
|
TangemThemePreviewRedesign {
|
||||||
CompositionLocalProvider(LocalRedesignEnabled provides true) {
|
|
||||||
PortfolioSelectorBS(
|
PortfolioSelectorBS(
|
||||||
state = params,
|
state = params,
|
||||||
onDismiss = {},
|
onDismiss = {},
|
||||||
|
|
@ -81,5 +78,4 @@ private fun PreviewV2(@PreviewParameter(PortfolioSelectorPreviewStateProvider::c
|
||||||
onBack = {},
|
onBack = {},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
@ -32,7 +32,6 @@ import com.tangem.core.ui.ds.row.TangemRowLayoutId
|
||||||
import com.tangem.core.ui.extensions.conditional
|
import com.tangem.core.ui.extensions.conditional
|
||||||
import com.tangem.core.ui.extensions.resolveReference
|
import com.tangem.core.ui.extensions.resolveReference
|
||||||
import com.tangem.core.ui.res.LocalCanScrollBackward
|
import com.tangem.core.ui.res.LocalCanScrollBackward
|
||||||
import com.tangem.core.ui.res.LocalRedesignEnabled
|
|
||||||
import com.tangem.core.ui.res.TangemTheme
|
import com.tangem.core.ui.res.TangemTheme
|
||||||
import com.tangem.core.ui.res.TangemThemePreviewRedesign
|
import com.tangem.core.ui.res.TangemThemePreviewRedesign
|
||||||
import com.tangem.features.commonfeatures.impl.portfolioselector.entity.PortfolioSelectorItemUM
|
import com.tangem.features.commonfeatures.impl.portfolioselector.entity.PortfolioSelectorItemUM
|
||||||
|
|
@ -218,7 +217,6 @@ private fun WalletNameRow(model: PortfolioSelectorItemUM.GroupTitle, modifier: M
|
||||||
@Composable
|
@Composable
|
||||||
private fun Preview(@PreviewParameter(PortfolioSelectorPreviewStateProvider::class) params: PortfolioSelectorUM) {
|
private fun Preview(@PreviewParameter(PortfolioSelectorPreviewStateProvider::class) params: PortfolioSelectorUM) {
|
||||||
TangemThemePreviewRedesign {
|
TangemThemePreviewRedesign {
|
||||||
CompositionLocalProvider(LocalRedesignEnabled provides true) {
|
|
||||||
Box(
|
Box(
|
||||||
modifier = Modifier.fillMaxWidth(),
|
modifier = Modifier.fillMaxWidth(),
|
||||||
contentAlignment = Alignment.Center,
|
contentAlignment = Alignment.Center,
|
||||||
|
|
@ -229,5 +227,4 @@ private fun Preview(@PreviewParameter(PortfolioSelectorPreviewStateProvider::cla
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
@ -85,7 +85,6 @@ internal class TokenActionsUiBuilder @Inject constructor(
|
||||||
quickActions = quickActions(
|
quickActions = quickActions(
|
||||||
cryptoData = cryptoCurrencyData,
|
cryptoData = cryptoCurrencyData,
|
||||||
tokenActionsHandler = tokenActionsHandler,
|
tokenActionsHandler = tokenActionsHandler,
|
||||||
isRedesignEnabled = true,
|
|
||||||
context = params.context,
|
context = params.context,
|
||||||
),
|
),
|
||||||
bottomActionText = bottomActionText(bottomAction),
|
bottomActionText = bottomActionText(bottomAction),
|
||||||
|
|
|
||||||
|
|
@ -229,7 +229,6 @@ private fun WalletPortfolioRow(name: TextReference, deviceIcon: DeviceIconUM, mo
|
||||||
@Composable
|
@Composable
|
||||||
private fun Preview(@PreviewParameter(TokenActionsContentPreviewProviderV2::class) state: TokenActionsUM) {
|
private fun Preview(@PreviewParameter(TokenActionsContentPreviewProviderV2::class) state: TokenActionsUM) {
|
||||||
TangemThemePreviewRedesign {
|
TangemThemePreviewRedesign {
|
||||||
CompositionLocalProvider(LocalRedesignEnabled provides true) {
|
|
||||||
Box(
|
Box(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
|
|
@ -241,7 +240,6 @@ private fun Preview(@PreviewParameter(TokenActionsContentPreviewProviderV2::clas
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private class TokenActionsContentPreviewProviderV2 : PreviewParameterProvider<TokenActionsUM> {
|
private class TokenActionsContentPreviewProviderV2 : PreviewParameterProvider<TokenActionsUM> {
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,6 @@ import com.tangem.core.ui.components.pager.PagerIndicator
|
||||||
import com.tangem.core.ui.ds.message.TangemMessage
|
import com.tangem.core.ui.ds.message.TangemMessage
|
||||||
import com.tangem.core.ui.extensions.stringReference
|
import com.tangem.core.ui.extensions.stringReference
|
||||||
import com.tangem.core.ui.res.TangemTheme
|
import com.tangem.core.ui.res.TangemTheme
|
||||||
import com.tangem.core.ui.res.TangemThemePreview
|
|
||||||
import com.tangem.core.ui.res.TangemThemePreviewRedesign
|
import com.tangem.core.ui.res.TangemThemePreviewRedesign
|
||||||
import com.tangem.features.promobanners.api.PromoBannersBlockComponent.Placeholder
|
import com.tangem.features.promobanners.api.PromoBannersBlockComponent.Placeholder
|
||||||
import com.tangem.features.promobanners.impl.model.PromoBannerNotificationUM
|
import com.tangem.features.promobanners.impl.model.PromoBannerNotificationUM
|
||||||
|
|
@ -243,19 +242,6 @@ private fun previewState(bannerCount: Int) = PromoBannersBlockUM(
|
||||||
onPageChanged = {},
|
onPageChanged = {},
|
||||||
)
|
)
|
||||||
|
|
||||||
@Preview(showBackground = true, widthDp = 360)
|
|
||||||
@Preview(showBackground = true, widthDp = 360, uiMode = Configuration.UI_MODE_NIGHT_YES)
|
|
||||||
@Composable
|
|
||||||
private fun Preview_PromoBannersBlock_Legacy() {
|
|
||||||
TangemThemePreview {
|
|
||||||
PromoBannersBlock(
|
|
||||||
state = previewState(bannerCount = 2),
|
|
||||||
horizontalItemPadding = 12.dp,
|
|
||||||
modifier = Modifier.padding(vertical = 16.dp),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Preview(showBackground = true, widthDp = 360)
|
@Preview(showBackground = true, widthDp = 360)
|
||||||
@Preview(showBackground = true, widthDp = 360, uiMode = Configuration.UI_MODE_NIGHT_YES)
|
@Preview(showBackground = true, widthDp = 360, uiMode = Configuration.UI_MODE_NIGHT_YES)
|
||||||
@Composable
|
@Composable
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ package com.tangem.features.tangempay.components.express
|
||||||
|
|
||||||
import androidx.compose.foundation.lazy.LazyListScope
|
import androidx.compose.foundation.lazy.LazyListScope
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import com.tangem.common.ui.expressStatus.expressTransactionsItemsLegacy
|
import com.tangem.common.ui.expressStatus.expressTransactionsItems
|
||||||
import com.tangem.common.ui.expressStatus.state.*
|
import com.tangem.common.ui.expressStatus.state.*
|
||||||
import com.tangem.core.ui.components.currency.icon.CurrencyIconState
|
import com.tangem.core.ui.components.currency.icon.CurrencyIconState
|
||||||
import com.tangem.core.ui.extensions.TextReference
|
import com.tangem.core.ui.extensions.TextReference
|
||||||
|
|
@ -17,18 +17,11 @@ internal class PreviewEmptyExpressTransactionsComponent : ExpressTransactionsCom
|
||||||
|
|
||||||
override val state: StateFlow<ExpressTransactionsBlockState> = MutableStateFlow(getInitialState())
|
override val state: StateFlow<ExpressTransactionsBlockState> = MutableStateFlow(getInitialState())
|
||||||
|
|
||||||
override fun LazyListScope.expressTransactionsContentLegacy(
|
|
||||||
state: PersistentList<ExpressTransactionStateUM>,
|
|
||||||
modifier: Modifier,
|
|
||||||
) {
|
|
||||||
expressTransactionsItemsLegacy(expressTxs = state, modifier = modifier)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun LazyListScope.expressTransactionsContent(
|
override fun LazyListScope.expressTransactionsContent(
|
||||||
state: PersistentList<ExpressTransactionStateUM>,
|
state: PersistentList<ExpressTransactionStateUM>,
|
||||||
modifier: Modifier,
|
modifier: Modifier,
|
||||||
) {
|
) {
|
||||||
expressTransactionsItemsLegacy(expressTxs = state, modifier = modifier)
|
expressTransactionsItems(expressTxs = state, modifier = modifier)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getInitialState(): ExpressTransactionsBlockState {
|
private fun getInitialState(): ExpressTransactionsBlockState {
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,6 @@ import androidx.compose.foundation.layout.*
|
||||||
import androidx.compose.foundation.shape.CircleShape
|
import androidx.compose.foundation.shape.CircleShape
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.CompositionLocalProvider
|
|
||||||
import androidx.compose.runtime.key
|
import androidx.compose.runtime.key
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
|
|
@ -26,8 +25,6 @@ import com.tangem.core.ui.ds2.button.TangemButton
|
||||||
import com.tangem.core.ui.extensions.TextReference.Res
|
import com.tangem.core.ui.extensions.TextReference.Res
|
||||||
import com.tangem.core.ui.extensions.resolveReference
|
import com.tangem.core.ui.extensions.resolveReference
|
||||||
import com.tangem.core.ui.extensions.resourceReference
|
import com.tangem.core.ui.extensions.resourceReference
|
||||||
import com.tangem.core.ui.res.LocalRedesignEnabled
|
|
||||||
import com.tangem.core.ui.res.LocalVisaRedesignEnabled
|
|
||||||
import com.tangem.core.ui.res.TangemTheme
|
import com.tangem.core.ui.res.TangemTheme
|
||||||
import com.tangem.core.ui.res.TangemThemePreviewRedesign
|
import com.tangem.core.ui.res.TangemThemePreviewRedesign
|
||||||
import com.tangem.core.ui.res.generated.icons.Icons
|
import com.tangem.core.ui.res.generated.icons.Icons
|
||||||
|
|
@ -126,10 +123,6 @@ private fun TangemPayTopUpItem(state: TangemPayAddFundsItemUM, modifier: Modifie
|
||||||
@Composable
|
@Composable
|
||||||
private fun TangemPayAddFundsContentPreview() {
|
private fun TangemPayAddFundsContentPreview() {
|
||||||
TangemThemePreviewRedesign {
|
TangemThemePreviewRedesign {
|
||||||
CompositionLocalProvider(
|
|
||||||
LocalVisaRedesignEnabled provides true,
|
|
||||||
LocalRedesignEnabled provides true,
|
|
||||||
) {
|
|
||||||
TangemPayAddFundsContentV2(
|
TangemPayAddFundsContentV2(
|
||||||
state = TangemPayAddFundsUM(
|
state = TangemPayAddFundsUM(
|
||||||
items = persistentListOf(
|
items = persistentListOf(
|
||||||
|
|
@ -161,5 +154,4 @@ private fun TangemPayAddFundsContentPreview() {
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
@ -319,9 +319,6 @@ private fun previewCardDetailsState(): TangemPayCardDetailsUM = TangemPayCardDet
|
||||||
@Composable
|
@Composable
|
||||||
private fun TangemPayCardPageScreenPreviewV2() {
|
private fun TangemPayCardPageScreenPreviewV2() {
|
||||||
TangemThemePreviewRedesign {
|
TangemThemePreviewRedesign {
|
||||||
CompositionLocalProvider(
|
|
||||||
LocalRedesignEnabled provides true,
|
|
||||||
) {
|
|
||||||
TangemPayCardPageScreen(
|
TangemPayCardPageScreen(
|
||||||
state = TangemPayCardPageUM.stub(),
|
state = TangemPayCardPageUM.stub(),
|
||||||
cardSection = {
|
cardSection = {
|
||||||
|
|
@ -332,5 +329,4 @@ private fun TangemPayCardPageScreenPreviewV2() {
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
@ -8,7 +8,6 @@ import androidx.compose.foundation.shape.RoundedCornerShape
|
||||||
import androidx.compose.material3.Icon
|
import androidx.compose.material3.Icon
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.CompositionLocalProvider
|
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.draw.clip
|
import androidx.compose.ui.draw.clip
|
||||||
|
|
@ -193,9 +192,6 @@ private fun SubtitleLimit(state: TangemPayDailyLimitBlockState, modifier: Modifi
|
||||||
@Composable
|
@Composable
|
||||||
private fun PreviewV2() {
|
private fun PreviewV2() {
|
||||||
TangemThemePreviewRedesign {
|
TangemThemePreviewRedesign {
|
||||||
CompositionLocalProvider(
|
|
||||||
LocalRedesignEnabled provides true,
|
|
||||||
) {
|
|
||||||
Column(
|
Column(
|
||||||
verticalArrangement = Arrangement.spacedBy(16.dp),
|
verticalArrangement = Arrangement.spacedBy(16.dp),
|
||||||
) {
|
) {
|
||||||
|
|
@ -204,5 +200,4 @@ private fun PreviewV2() {
|
||||||
TangemPayDailyLimitBlock(state = TangemPayDailyLimitBlockState.Loading)
|
TangemPayDailyLimitBlock(state = TangemPayDailyLimitBlockState.Loading)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
@ -3,10 +3,8 @@ package com.tangem.features.tangempay.component
|
||||||
import androidx.compose.foundation.lazy.LazyListScope
|
import androidx.compose.foundation.lazy.LazyListScope
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import com.tangem.core.decompose.context.AppComponentContext
|
import com.tangem.core.decompose.context.AppComponentContext
|
||||||
import com.tangem.core.ui.res.LocalRedesignEnabled
|
|
||||||
import com.tangem.features.tangempay.entity.TangemPayMainUM
|
import com.tangem.features.tangempay.entity.TangemPayMainUM
|
||||||
import com.tangem.features.tangempay.ui.TangemPayMainBlockContent
|
import com.tangem.features.tangempay.ui.TangemPayMainBlockContent
|
||||||
import com.tangem.features.tangempay.ui.TangemPayMainBlockItem
|
|
||||||
import dagger.assisted.Assisted
|
import dagger.assisted.Assisted
|
||||||
import dagger.assisted.AssistedFactory
|
import dagger.assisted.AssistedFactory
|
||||||
import dagger.assisted.AssistedInject
|
import dagger.assisted.AssistedInject
|
||||||
|
|
@ -28,11 +26,7 @@ internal class DefaultTangemPayMainBlockComponent @AssistedInject constructor(
|
||||||
key = TANGEM_PAY_ACCOUNT_CONTENT_TYPE,
|
key = TANGEM_PAY_ACCOUNT_CONTENT_TYPE,
|
||||||
contentType = TANGEM_PAY_ACCOUNT_CONTENT_TYPE,
|
contentType = TANGEM_PAY_ACCOUNT_CONTENT_TYPE,
|
||||||
) {
|
) {
|
||||||
if (LocalRedesignEnabled.current) {
|
|
||||||
TangemPayMainBlockContent(state, isBalanceHidden, modifier)
|
TangemPayMainBlockContent(state, isBalanceHidden, modifier)
|
||||||
} else {
|
|
||||||
TangemPayMainBlockItem(state, isBalanceHidden, modifier)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,6 @@ import com.tangem.core.ui.components.text.applyBladeBrush
|
||||||
import com.tangem.core.ui.ds.row.TangemRowContainer
|
import com.tangem.core.ui.ds.row.TangemRowContainer
|
||||||
import com.tangem.core.ui.ds.row.TangemRowLayoutId
|
import com.tangem.core.ui.ds.row.TangemRowLayoutId
|
||||||
import com.tangem.core.ui.extensions.*
|
import com.tangem.core.ui.extensions.*
|
||||||
import com.tangem.core.ui.res.LocalRedesignEnabled
|
|
||||||
import com.tangem.core.ui.res.TangemTheme
|
import com.tangem.core.ui.res.TangemTheme
|
||||||
import com.tangem.core.ui.res.TangemThemePreviewRedesign
|
import com.tangem.core.ui.res.TangemThemePreviewRedesign
|
||||||
import com.tangem.core.ui.test.TangemPayTestTags
|
import com.tangem.core.ui.test.TangemPayTestTags
|
||||||
|
|
@ -284,8 +283,7 @@ private fun TangemPayMainLoading(modifier: Modifier = Modifier) {
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun getVisaIconPainter(): Painter {
|
private fun getVisaIconPainter(): Painter {
|
||||||
val resource = if (LocalRedesignEnabled.current) R.drawable.ic_visa_in_banner else R.drawable.img_visa_36
|
return painterResource(R.drawable.ic_visa_in_banner)
|
||||||
return painterResource(resource)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// region Preview
|
// region Preview
|
||||||
|
|
|
||||||
|
|
@ -16,11 +16,6 @@ interface ExpressTransactionsComponent {
|
||||||
|
|
||||||
val state: StateFlow<ExpressTransactionsBlockState>
|
val state: StateFlow<ExpressTransactionsBlockState>
|
||||||
|
|
||||||
fun LazyListScope.expressTransactionsContentLegacy(
|
|
||||||
state: PersistentList<ExpressTransactionStateUM>,
|
|
||||||
modifier: Modifier,
|
|
||||||
)
|
|
||||||
|
|
||||||
fun LazyListScope.expressTransactionsContent(state: PersistentList<ExpressTransactionStateUM>, modifier: Modifier)
|
fun LazyListScope.expressTransactionsContent(state: PersistentList<ExpressTransactionStateUM>, modifier: Modifier)
|
||||||
|
|
||||||
data class Params(
|
data class Params(
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,6 @@ import androidx.compose.runtime.Stable
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import com.arkivanov.essenty.lifecycle.subscribe
|
import com.arkivanov.essenty.lifecycle.subscribe
|
||||||
import com.tangem.common.ui.expressStatus.expressTransactionsItems
|
import com.tangem.common.ui.expressStatus.expressTransactionsItems
|
||||||
import com.tangem.common.ui.expressStatus.expressTransactionsItemsLegacy
|
|
||||||
import com.tangem.common.ui.expressStatus.state.ExpressTransactionStateUM
|
import com.tangem.common.ui.expressStatus.state.ExpressTransactionStateUM
|
||||||
import com.tangem.common.ui.expressStatus.state.ExpressTransactionsBlockState
|
import com.tangem.common.ui.expressStatus.state.ExpressTransactionsBlockState
|
||||||
import com.tangem.core.decompose.context.AppComponentContext
|
import com.tangem.core.decompose.context.AppComponentContext
|
||||||
|
|
@ -34,13 +33,6 @@ internal class DefaultExpressTransactionsComponent @AssistedInject constructor(
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun LazyListScope.expressTransactionsContentLegacy(
|
|
||||||
state: PersistentList<ExpressTransactionStateUM>,
|
|
||||||
modifier: Modifier,
|
|
||||||
) {
|
|
||||||
expressTransactionsItemsLegacy(expressTxs = state, modifier = modifier)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun LazyListScope.expressTransactionsContent(
|
override fun LazyListScope.expressTransactionsContent(
|
||||||
state: PersistentList<ExpressTransactionStateUM>,
|
state: PersistentList<ExpressTransactionStateUM>,
|
||||||
modifier: Modifier,
|
modifier: Modifier,
|
||||||
|
|
|
||||||
|
|
@ -348,11 +348,6 @@ private val PreviewExpressTransactionsComponent = object : ExpressTransactionsCo
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
override fun LazyListScope.expressTransactionsContentLegacy(
|
|
||||||
state: PersistentList<ExpressTransactionStateUM>,
|
|
||||||
modifier: Modifier,
|
|
||||||
) = Unit
|
|
||||||
|
|
||||||
override fun LazyListScope.expressTransactionsContent(
|
override fun LazyListScope.expressTransactionsContent(
|
||||||
state: PersistentList<ExpressTransactionStateUM>,
|
state: PersistentList<ExpressTransactionStateUM>,
|
||||||
modifier: Modifier,
|
modifier: Modifier,
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,6 @@ import com.tangem.core.ui.ds.button.TangemButtonSize
|
||||||
import com.tangem.core.ui.extensions.TextReference
|
import com.tangem.core.ui.extensions.TextReference
|
||||||
import com.tangem.core.ui.extensions.resourceReference
|
import com.tangem.core.ui.extensions.resourceReference
|
||||||
import com.tangem.core.ui.res.LocalHazeState
|
import com.tangem.core.ui.res.LocalHazeState
|
||||||
import com.tangem.core.ui.res.LocalRedesignEnabled
|
|
||||||
import com.tangem.core.ui.res.TangemTheme
|
import com.tangem.core.ui.res.TangemTheme
|
||||||
import com.tangem.core.ui.res.TangemThemePreviewRedesign
|
import com.tangem.core.ui.res.TangemThemePreviewRedesign
|
||||||
import com.tangem.feature.tokendetails.presentation.tokendetails.state.TransferUM
|
import com.tangem.feature.tokendetails.presentation.tokendetails.state.TransferUM
|
||||||
|
|
@ -143,14 +142,12 @@ private fun TailLoader() {
|
||||||
@Composable
|
@Composable
|
||||||
private fun Preview(@PreviewParameter(TransferPreviewProvider::class) state: TransferUM) {
|
private fun Preview(@PreviewParameter(TransferPreviewProvider::class) state: TransferUM) {
|
||||||
TangemThemePreviewRedesign {
|
TangemThemePreviewRedesign {
|
||||||
CompositionLocalProvider(LocalRedesignEnabled provides true) {
|
|
||||||
TransferBottomSheetContent(
|
TransferBottomSheetContent(
|
||||||
state = state,
|
state = state,
|
||||||
onCloseClick = {},
|
onCloseClick = {},
|
||||||
modifier = Modifier.padding(horizontal = 16.dp),
|
modifier = Modifier.padding(horizontal = 16.dp),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private class TransferPreviewProvider : PreviewParameterProvider<TransferUM> {
|
private class TransferPreviewProvider : PreviewParameterProvider<TransferUM> {
|
||||||
|
|
|
||||||
|
|
@ -467,7 +467,6 @@ private fun DescriptionWithMoreBlock(
|
||||||
.padding(horizontal = 12.dp),
|
.padding(horizontal = 12.dp),
|
||||||
description = model.text,
|
description = model.text,
|
||||||
hasFullDescription = true,
|
hasFullDescription = true,
|
||||||
textStyle = TangemTheme.typography.caption2,
|
|
||||||
onReadMoreClick = onDescriptionClick,
|
onReadMoreClick = onDescriptionClick,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ internal class WcConnectionsComponent(
|
||||||
|
|
||||||
WcConnectionsContent(modifier = modifier, state = state, snackbarHostState = snackbarHostState)
|
WcConnectionsContent(modifier = modifier, state = state, snackbarHostState = snackbarHostState)
|
||||||
|
|
||||||
EventMessageEffect(messageHandler = messageHandler, snackbarHostState = snackbarHostState)
|
EventMessageEffect(messageHandler = messageHandler)
|
||||||
bottomSheet.child?.instance?.BottomSheet()
|
bottomSheet.child?.instance?.BottomSheet()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue