Updated on 2026-08-14

This commit is contained in:
Tangem 2024-07-17 14:38:33 +04:00
commit dfd7076c2e
31 changed files with 345 additions and 648 deletions

View file

@ -6,6 +6,7 @@ import com.squareup.moshi.JsonDataException
import com.squareup.moshi.Types
import com.tangem.datasource.local.preferences.AppPreferencesStore
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.distinctUntilChanged
import kotlinx.coroutines.flow.firstOrNull
import kotlinx.coroutines.flow.map
@ -20,7 +21,7 @@ inline fun <reified T> AppPreferencesStore.getObject(key: Preferences.Key<String
null
}
}
}
}.distinctUntilChanged()
}
/**
@ -38,7 +39,7 @@ inline fun <reified T> AppPreferencesStore.getObject(key: Preferences.Key<String
} catch (e: JsonDataException) {
default
}
}
}.distinctUntilChanged()
}
/**
@ -100,7 +101,7 @@ suspend inline fun <reified T> AppPreferencesStore.storeObjectList(key: Preferen
/** Get flow of list of data [T] by string [key]. If data is not found, it returns `null` */
inline fun <reified T> AppPreferencesStore.getObjectList(key: Preferences.Key<String>): Flow<List<T>?> {
val adapter = moshi.adapter<List<T>>(Types.newParameterizedType(List::class.java, T::class.java))
return data.map { it[key]?.let(adapter::fromJson) }
return data.map { it[key]?.let(adapter::fromJson) }.distinctUntilChanged()
}
/** Get list of data [T] by string [key], or empty if data is not found */

View file

@ -19,10 +19,6 @@
"name": "WC_SOLANA_TX_SIGN_ENABLED",
"version": "undefined"
},
{
"name": "TOKEN_LIST_LCE_ENABLED",
"version": "5.12.0"
},
{
"name": "CARDANO_TOKENS_SUPPORT_ENABLED",
"version": "5.12.0"

View file

@ -32,6 +32,6 @@ val TangemBlockCardColors: CardColors
get() = CardColors(
containerColor = TangemTheme.colors.background.primary,
contentColor = TangemTheme.colors.text.primary1,
disabledContainerColor = TangemTheme.colors.button.disabled,
disabledContentColor = TangemTheme.colors.text.disabled,
disabledContainerColor = TangemTheme.colors.background.primary,
disabledContentColor = TangemTheme.colors.text.primary1,
)