Updated on 2026-08-14
This commit is contained in:
parent
938c8e72cb
commit
8c4f39aab5
4 changed files with 24 additions and 8 deletions
|
|
@ -3,21 +3,21 @@ package com.tangem.domain.apptheme.model
|
|||
/**
|
||||
* Enumerates the possible modes for the application's theme.
|
||||
*/
|
||||
enum class AppThemeMode {
|
||||
enum class AppThemeMode(val value: String) {
|
||||
/**
|
||||
* Forces the dark theme mode regardless of system settings.
|
||||
*/
|
||||
FORCE_DARK,
|
||||
FORCE_DARK("Dark"),
|
||||
|
||||
/**
|
||||
* Forces the light theme mode regardless of system settings.
|
||||
*/
|
||||
FORCE_LIGHT,
|
||||
FORCE_LIGHT("Light"),
|
||||
|
||||
/**
|
||||
* Follows the system-wide theme mode.
|
||||
*/
|
||||
FOLLOW_SYSTEM,
|
||||
FOLLOW_SYSTEM("System"),
|
||||
|
||||
;
|
||||
|
||||
|
|
@ -30,6 +30,6 @@ enum class AppThemeMode {
|
|||
/**
|
||||
* List of available [AppThemeMode]s.
|
||||
* */
|
||||
val available: List<AppThemeMode> = values().toList()
|
||||
val available: List<AppThemeMode> = entries
|
||||
}
|
||||
}
|
||||
|
|
@ -103,6 +103,8 @@ dependencies {
|
|||
implementation(projects.domain.transaction)
|
||||
implementation(projects.domain.yieldSupply)
|
||||
implementation(projects.domain.yieldSupply.models)
|
||||
implementation(projects.domain.appTheme)
|
||||
implementation(projects.domain.appTheme.models)
|
||||
|
||||
/** Feature Apis */
|
||||
implementation(projects.features.details.api)
|
||||
|
|
|
|||
|
|
@ -10,6 +10,8 @@ import com.tangem.core.analytics.models.event.MainScreenAnalyticsEvent
|
|||
import com.tangem.core.decompose.di.ModelScoped
|
||||
import com.tangem.core.decompose.model.Model
|
||||
import com.tangem.domain.account.featuretoggle.AccountsFeatureToggles
|
||||
import com.tangem.domain.apptheme.GetAppThemeModeUseCase
|
||||
import com.tangem.domain.apptheme.model.AppThemeMode
|
||||
import com.tangem.domain.balancehiding.GetBalanceHidingSettingsUseCase
|
||||
import com.tangem.domain.common.wallets.UserWalletsListRepository
|
||||
import com.tangem.domain.models.wallet.UserWallet
|
||||
|
|
@ -96,6 +98,7 @@ internal class WalletModel @Inject constructor(
|
|||
private val yieldSupplyFeatureToggles: YieldSupplyFeatureToggles,
|
||||
private val accountsFeatureToggles: AccountsFeatureToggles,
|
||||
private val tangemPayMainScreenCustomerInfoUseCase: TangemPayMainScreenCustomerInfoUseCase,
|
||||
private val getAppThemeModeUseCase: GetAppThemeModeUseCase,
|
||||
val screenLifecycleProvider: ScreenLifecycleProvider,
|
||||
val innerWalletRouter: InnerWalletRouter,
|
||||
) : Model() {
|
||||
|
|
@ -106,14 +109,18 @@ internal class WalletModel @Inject constructor(
|
|||
|
||||
private val walletsUpdateJobHolder = JobHolder()
|
||||
private val refreshWalletJobHolder = JobHolder()
|
||||
private var needToRefreshWallet = false
|
||||
private val clearNFTCacheJobHolder = JobHolder()
|
||||
private val updateTangemPayJobHolder = JobHolder()
|
||||
|
||||
private var needToRefreshWallet = false
|
||||
private var expressTxStatusTaskScheduler = SingleTaskScheduler<Unit>()
|
||||
|
||||
init {
|
||||
analyticsEventsHandler.send(WalletScreenAnalyticsEvent.MainScreen.ScreenOpened)
|
||||
modelScope.launch {
|
||||
val result = getAppThemeModeUseCase().firstOrNull()
|
||||
val theme = result?.getOrElse { AppThemeMode.FOLLOW_SYSTEM } ?: AppThemeMode.FOLLOW_SYSTEM
|
||||
analyticsEventsHandler.send(WalletScreenAnalyticsEvent.MainScreen.ScreenOpened(theme.value))
|
||||
}
|
||||
|
||||
screenLifecycleProvider.isBackgroundState
|
||||
.onEach { isBackground ->
|
||||
|
|
|
|||
|
|
@ -51,7 +51,14 @@ sealed class WalletScreenAnalyticsEvent {
|
|||
params: Map<String, String> = mapOf(),
|
||||
) : AnalyticsEvent(category = "Main Screen", event = event, params = params) {
|
||||
|
||||
data object ScreenOpened : MainScreen(event = "Screen opened")
|
||||
class ScreenOpened(
|
||||
val theme: String,
|
||||
) : MainScreen(
|
||||
event = "Screen opened",
|
||||
params = mapOf(
|
||||
"App Theme" to theme,
|
||||
),
|
||||
)
|
||||
|
||||
class WalletSelected(val isImported: Boolean) : MainScreen(
|
||||
event = "Wallet Selected",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue