Updated on 2026-08-14
This commit is contained in:
parent
b134a5845a
commit
2f2a5ae7d6
3 changed files with 30 additions and 0 deletions
|
|
@ -1,5 +1,6 @@
|
|||
package com.tangem.tap.common.analytics.events
|
||||
|
||||
import com.tangem.domain.apptheme.model.AppThemeMode
|
||||
import com.tangem.tap.features.details.redux.SecurityOption
|
||||
|
||||
sealed class AnalyticsParam {
|
||||
|
|
@ -139,6 +140,22 @@ sealed class AnalyticsParam {
|
|||
object SeedImport : WalletCreationType(value = "Seed Import")
|
||||
}
|
||||
|
||||
sealed class AppTheme(val value: String) {
|
||||
object System : AppTheme("System")
|
||||
object Dark : AppTheme("Dark")
|
||||
object Light : AppTheme("Light")
|
||||
|
||||
companion object {
|
||||
fun fromAppThemeMode(mode: AppThemeMode): AppTheme {
|
||||
return when (mode) {
|
||||
AppThemeMode.FORCE_DARK -> Dark
|
||||
AppThemeMode.FORCE_LIGHT -> Light
|
||||
AppThemeMode.FOLLOW_SYSTEM -> System
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
companion object Key {
|
||||
const val BLOCKCHAIN = "blockchain"
|
||||
const val TOKEN = "Token"
|
||||
|
|
|
|||
|
|
@ -84,5 +84,10 @@ sealed class Settings(
|
|||
event = "Main Currency Changed",
|
||||
params = mapOf("Currency Type" to currencyType),
|
||||
)
|
||||
|
||||
class ThemeSwitched(theme: AnalyticsParam.AppTheme) : AppSettings(
|
||||
event = "App Theme Switched",
|
||||
params = mapOf("State" to theme.value),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
@ -4,10 +4,13 @@ import androidx.compose.runtime.getValue
|
|||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.lifecycle.LifecycleCoroutineScope
|
||||
import com.tangem.core.analytics.Analytics
|
||||
import com.tangem.core.navigation.AppScreen
|
||||
import com.tangem.core.navigation.NavigationAction
|
||||
import com.tangem.domain.appcurrency.repository.AppCurrencyRepository
|
||||
import com.tangem.domain.apptheme.model.AppThemeMode
|
||||
import com.tangem.tap.common.analytics.events.AnalyticsParam
|
||||
import com.tangem.tap.common.analytics.events.Settings
|
||||
import com.tangem.tap.common.entities.FiatCurrency
|
||||
import com.tangem.tap.common.extensions.dispatchOnMain
|
||||
import com.tangem.tap.common.extensions.dispatchWithMain
|
||||
|
|
@ -121,6 +124,11 @@ internal class AppSettingsViewModel(
|
|||
dialog = dialogsFactory.createThemeModeSelectorDialog(
|
||||
selectedModeIndex = selectedMode.ordinal,
|
||||
onSelect = { mode ->
|
||||
Analytics.send(
|
||||
event = Settings.AppSettings.ThemeSwitched(
|
||||
theme = AnalyticsParam.AppTheme.fromAppThemeMode(mode),
|
||||
),
|
||||
)
|
||||
store.dispatchOnMain(DetailsAction.AppSettings.ChangeAppThemeMode(mode))
|
||||
dismissDialog()
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue