Updated on 2026-08-14
This commit is contained in:
parent
92f2c8fcf0
commit
bca3dd3459
6 changed files with 135 additions and 28 deletions
33
.idea/codeStyles/Project.xml
generated
33
.idea/codeStyles/Project.xml
generated
|
|
@ -5,6 +5,39 @@
|
|||
<JavaCodeStyleSettings>
|
||||
<option name="CLASS_COUNT_TO_USE_IMPORT_ON_DEMAND" value="5" />
|
||||
<option name="NAMES_COUNT_TO_USE_IMPORT_ON_DEMAND" value="3" />
|
||||
<option name="IMPORT_LAYOUT_TABLE">
|
||||
<value>
|
||||
<package name="" withSubpackages="true" static="false" module="true" />
|
||||
<package name="android" withSubpackages="true" static="true" />
|
||||
<package name="androidx" withSubpackages="true" static="true" />
|
||||
<package name="com" withSubpackages="true" static="true" />
|
||||
<package name="junit" withSubpackages="true" static="true" />
|
||||
<package name="net" withSubpackages="true" static="true" />
|
||||
<package name="org" withSubpackages="true" static="true" />
|
||||
<package name="java" withSubpackages="true" static="true" />
|
||||
<package name="javax" withSubpackages="true" static="true" />
|
||||
<package name="" withSubpackages="true" static="true" />
|
||||
<emptyLine />
|
||||
<package name="android" withSubpackages="true" static="false" />
|
||||
<emptyLine />
|
||||
<package name="androidx" withSubpackages="true" static="false" />
|
||||
<emptyLine />
|
||||
<package name="com" withSubpackages="true" static="false" />
|
||||
<emptyLine />
|
||||
<package name="junit" withSubpackages="true" static="false" />
|
||||
<emptyLine />
|
||||
<package name="net" withSubpackages="true" static="false" />
|
||||
<emptyLine />
|
||||
<package name="org" withSubpackages="true" static="false" />
|
||||
<emptyLine />
|
||||
<package name="java" withSubpackages="true" static="false" />
|
||||
<emptyLine />
|
||||
<package name="javax" withSubpackages="true" static="false" />
|
||||
<emptyLine />
|
||||
<package name="" withSubpackages="true" static="false" />
|
||||
<emptyLine />
|
||||
</value>
|
||||
</option>
|
||||
</JavaCodeStyleSettings>
|
||||
<JetCodeStyleSettings>
|
||||
<option name="PACKAGES_TO_USE_STAR_IMPORTS">
|
||||
|
|
|
|||
|
|
@ -2,10 +2,8 @@ package com.tangem.tap.features.home
|
|||
|
||||
import androidx.activity.compose.BackHandler
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.DisposableEffect
|
||||
import androidx.compose.runtime.MutableState
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
|
|
@ -13,7 +11,7 @@ import com.arkivanov.essenty.lifecycle.subscribe
|
|||
import com.tangem.core.decompose.context.AppComponentContext
|
||||
import com.tangem.core.decompose.model.getOrCreateModel
|
||||
import com.tangem.core.ui.components.SystemBarsIconsDisposable
|
||||
import com.tangem.core.ui.res.LocalRootBackgroundColor
|
||||
import com.tangem.core.ui.utils.ChangeRootBackgroundColorEffect
|
||||
import com.tangem.core.ui.utils.findActivity
|
||||
import com.tangem.tap.common.redux.AppState
|
||||
import com.tangem.tap.features.home.api.HomeComponent
|
||||
|
|
@ -65,17 +63,7 @@ internal class DefaultHomeComponent @AssistedInject constructor(
|
|||
onShopButtonClick = model::onShopClick,
|
||||
onSearchTokensClick = model::onSearchClick,
|
||||
)
|
||||
|
||||
val rootBackgroundColor = LocalRootBackgroundColor.current
|
||||
val previousColor = remember { rootBackgroundColor.value }
|
||||
val storiesBackgroundColor = Color(color = 0xFF010101)
|
||||
|
||||
DisposableEffect(Unit) {
|
||||
rootBackgroundColor.value = storiesBackgroundColor
|
||||
onDispose {
|
||||
rootBackgroundColor.value = previousColor
|
||||
}
|
||||
}
|
||||
ChangeRootBackgroundColorEffect(Color(color = 0xFF010101))
|
||||
}
|
||||
|
||||
override fun newState(state: HomeState) {
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ fun TangemTheme(
|
|||
CompositionLocalProvider(
|
||||
LocalTangemShimmer provides TangemShimmer,
|
||||
LocalMainBottomSheetColor provides remember { mutableStateOf(Color.Unspecified) },
|
||||
LocalRootBackgroundColor provides remember { mutableStateOf(rootBackgroundColor) },
|
||||
LocalRootBackgroundColor provides remember(rootBackgroundColor) { mutableStateOf(rootBackgroundColor) },
|
||||
LocalTextSelectionColors provides TangemTextSelectionColors,
|
||||
) {
|
||||
ProvideTextStyle(
|
||||
|
|
|
|||
|
|
@ -0,0 +1,31 @@
|
|||
package com.tangem.core.ui.utils
|
||||
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.DisposableEffect
|
||||
import androidx.compose.runtime.LaunchedEffect
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import com.tangem.core.ui.res.LocalRootBackgroundColor
|
||||
|
||||
@Composable
|
||||
fun ChangeRootBackgroundColorEffect(color: Color) {
|
||||
var rootBackgroundColor by LocalRootBackgroundColor.current
|
||||
var previousColor by remember { mutableStateOf(rootBackgroundColor) }
|
||||
|
||||
DisposableEffect(color) {
|
||||
rootBackgroundColor = color
|
||||
onDispose {
|
||||
rootBackgroundColor = previousColor
|
||||
}
|
||||
}
|
||||
|
||||
LaunchedEffect(rootBackgroundColor) {
|
||||
if (rootBackgroundColor != color) {
|
||||
previousColor = rootBackgroundColor
|
||||
rootBackgroundColor = color
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,66 @@
|
|||
package com.tangem.domain.wallets.models
|
||||
|
||||
import com.squareup.moshi.Json
|
||||
import com.squareup.moshi.JsonClass
|
||||
import com.tangem.crypto.hdWallet.DerivationPath
|
||||
import com.tangem.domain.models.scan.ScanResponse
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
sealed interface NewUserWallet {
|
||||
|
||||
val name: String
|
||||
val walletId: UserWalletId
|
||||
|
||||
@JsonClass(generateAdapter = true)
|
||||
data class Cold(
|
||||
@Json(name = "name")
|
||||
override val name: String,
|
||||
@Json(name = "walletId")
|
||||
override val walletId: UserWalletId,
|
||||
@Json(name = "cardsInWallet")
|
||||
val cardsInWallet: Set<String>,
|
||||
@Json(name = "isMultiCurrency")
|
||||
val isMultiCurrency: Boolean,
|
||||
@Json(name = "hasBackupError")
|
||||
val hasBackupError: Boolean,
|
||||
@Json(name = "scanResponse")
|
||||
val scanResponse: ScanResponse,
|
||||
) : NewUserWallet
|
||||
|
||||
@JsonClass(generateAdapter = true)
|
||||
data class Hot(
|
||||
@Json(name = "name")
|
||||
override val name: String,
|
||||
@Json(name = "walletId")
|
||||
override val walletId: UserWalletId,
|
||||
) : NewUserWallet
|
||||
|
||||
@JsonClass(generateAdapter = true)
|
||||
data class Pay(
|
||||
@Json(name = "name")
|
||||
override val name: String,
|
||||
@Json(name = "walletId")
|
||||
override val walletId: UserWalletId,
|
||||
@Json(name = "cardsInWallet")
|
||||
val cardsInWallet: Set<String>,
|
||||
@Json(name = "scanResponse")
|
||||
val scanResponse: ScanResponse,
|
||||
) : NewUserWallet
|
||||
}
|
||||
|
||||
@JsonClass(generateAdapter = true)
|
||||
data class UserWalletAccount(
|
||||
val accountId: AccountId,
|
||||
val userWalletId: UserWalletId,
|
||||
val name: String,
|
||||
val derivationPath: DerivationPath,
|
||||
val otherInfo: String,
|
||||
)
|
||||
|
||||
@Serializable
|
||||
@JvmInline
|
||||
@JsonClass(generateAdapter = true)
|
||||
value class AccountId(
|
||||
@Json(name = "stringValue")
|
||||
val stringValue: String,
|
||||
)
|
||||
|
|
@ -1,16 +1,14 @@
|
|||
package com.tangem.feature.stories.impl
|
||||
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.DisposableEffect
|
||||
import androidx.compose.runtime.Stable
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||
import com.tangem.common.ui.swapStoriesScreen.SwapStoriesScreen
|
||||
import com.tangem.core.decompose.context.AppComponentContext
|
||||
import com.tangem.core.decompose.model.getOrCreateModel
|
||||
import com.tangem.core.ui.res.LocalRootBackgroundColor
|
||||
import com.tangem.core.ui.res.TangemColorPalette
|
||||
import com.tangem.core.ui.utils.ChangeRootBackgroundColorEffect
|
||||
import com.tangem.feature.stories.api.StoriesComponent
|
||||
import com.tangem.feature.stories.impl.model.StoriesModel
|
||||
import dagger.assisted.Assisted
|
||||
|
|
@ -29,16 +27,7 @@ internal class DefaultStoriesComponent @AssistedInject constructor(
|
|||
override fun Content(modifier: Modifier) {
|
||||
val state = model.state.collectAsStateWithLifecycle()
|
||||
SwapStoriesScreen(state.value)
|
||||
|
||||
val rootBackgroundColor = LocalRootBackgroundColor.current
|
||||
val previousColor = remember { rootBackgroundColor.value }
|
||||
|
||||
DisposableEffect(Unit) {
|
||||
rootBackgroundColor.value = TangemColorPalette.Black
|
||||
onDispose {
|
||||
rootBackgroundColor.value = previousColor
|
||||
}
|
||||
}
|
||||
ChangeRootBackgroundColorEffect(TangemColorPalette.Black)
|
||||
}
|
||||
|
||||
@AssistedFactory
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue