Updated on 2026-08-14
This commit is contained in:
parent
8a1b7f8e82
commit
ed58286a8c
7 changed files with 26 additions and 10 deletions
|
|
@ -21,6 +21,7 @@ internal class DefaultVisaAuthTokenStorage @Inject constructor(
|
|||
private val secureStorage by lazy {
|
||||
AndroidSecureStorageV2(
|
||||
appContext = applicationContext,
|
||||
useStrongBox = false,
|
||||
name = "visa_auth_storage",
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ class DefaultVisaOTPStorage @Inject constructor(
|
|||
private val secureStorage by lazy {
|
||||
AndroidSecureStorageV2(
|
||||
appContext = applicationContext,
|
||||
useStrongBox = false,
|
||||
name = "visa_otp_storage",
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,8 +49,9 @@ internal object UserWalletsListManagerModule {
|
|||
return GeneralUserWalletsListManager(
|
||||
runtimeUserWalletsListManager = RuntimeUserWalletsListManager(),
|
||||
biometricUserWalletsListManager = createBiometricUserWalletsListManager(
|
||||
applicationContext,
|
||||
analyticsEventHandler,
|
||||
applicationContext = applicationContext,
|
||||
analyticsEventHandler = analyticsEventHandler,
|
||||
dispatchers = dispatchers,
|
||||
),
|
||||
appPreferencesStore = appPreferencesStore,
|
||||
dispatchers = dispatchers,
|
||||
|
|
@ -60,6 +61,7 @@ internal object UserWalletsListManagerModule {
|
|||
private fun createBiometricUserWalletsListManager(
|
||||
applicationContext: Context,
|
||||
analyticsEventHandler: AnalyticsEventHandler,
|
||||
dispatchers: CoroutineDispatcherProvider,
|
||||
): UserWalletsListManager {
|
||||
val moshi = Moshi.Builder()
|
||||
.add(WalletDerivedKeysMapAdapter())
|
||||
|
|
@ -83,8 +85,14 @@ internal object UserWalletsListManagerModule {
|
|||
),
|
||||
androidSecureStorageV2 = AndroidSecureStorageV2(
|
||||
appContext = applicationContext,
|
||||
useStrongBox = true,
|
||||
name = "user_wallets_storage2",
|
||||
),
|
||||
androidSecureStorageV3 = AndroidSecureStorageV2(
|
||||
appContext = applicationContext,
|
||||
useStrongBox = false,
|
||||
name = "user_wallets_storage3",
|
||||
),
|
||||
)
|
||||
|
||||
val authenticatedStorage = AuthenticatedStorage(
|
||||
|
|
@ -114,7 +122,10 @@ internal object UserWalletsListManagerModule {
|
|||
secureStorage = secureStorage,
|
||||
)
|
||||
|
||||
val selectedUserWalletRepository = DefaultSelectedUserWalletRepository(secureStorage = secureStorage)
|
||||
val selectedUserWalletRepository = DefaultSelectedUserWalletRepository(
|
||||
secureStorage = secureStorage,
|
||||
dispatchers = dispatchers,
|
||||
)
|
||||
|
||||
return BiometricUserWalletsListManager(
|
||||
keysRepository = keysRepository,
|
||||
|
|
|
|||
|
|
@ -327,7 +327,7 @@ internal class BiometricUserWalletsListManager(
|
|||
}
|
||||
}
|
||||
|
||||
private fun findOrSetSelectedWallet(
|
||||
private suspend fun findOrSetSelectedWallet(
|
||||
prevSelectedWalletId: UserWalletId?,
|
||||
prevSelectedWalletIndex: Int,
|
||||
userWallets: List<UserWallet>,
|
||||
|
|
|
|||
|
|
@ -3,6 +3,6 @@ package com.tangem.tap.domain.userWalletList.repository
|
|||
import com.tangem.domain.wallets.models.UserWalletId
|
||||
|
||||
internal interface SelectedUserWalletRepository {
|
||||
fun get(): UserWalletId?
|
||||
fun set(walletId: UserWalletId?)
|
||||
suspend fun get(): UserWalletId?
|
||||
suspend fun set(walletId: UserWalletId?)
|
||||
}
|
||||
|
|
@ -3,17 +3,20 @@ package com.tangem.tap.domain.userWalletList.repository.implementation
|
|||
import com.tangem.common.services.secure.SecureStorage
|
||||
import com.tangem.domain.wallets.models.UserWalletId
|
||||
import com.tangem.tap.domain.userWalletList.repository.SelectedUserWalletRepository
|
||||
import com.tangem.utils.coroutines.CoroutineDispatcherProvider
|
||||
import kotlinx.coroutines.withContext
|
||||
|
||||
internal class DefaultSelectedUserWalletRepository(
|
||||
private val secureStorage: SecureStorage,
|
||||
private val dispatchers: CoroutineDispatcherProvider,
|
||||
) : SelectedUserWalletRepository {
|
||||
override fun get(): UserWalletId? {
|
||||
return secureStorage.get(StorageKey.SelectedWalletId.name)
|
||||
override suspend fun get(): UserWalletId? = withContext(dispatchers.io) {
|
||||
secureStorage.get(StorageKey.SelectedWalletId.name)
|
||||
?.decodeToString(throwOnInvalidSequence = true)
|
||||
?.let { UserWalletId(it) }
|
||||
}
|
||||
|
||||
override fun set(walletId: UserWalletId?) {
|
||||
override suspend fun set(walletId: UserWalletId?) = withContext(dispatchers.io) {
|
||||
if (walletId == null) {
|
||||
secureStorage.delete(StorageKey.SelectedWalletId.name)
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
tangemBlockchainSdk = "releases-5.26.0-1123"
|
||||
#tangemBlockchainSdk = "0.0.1" # Keep it! - used for local builds
|
||||
tangemCardSdk = "releases-5.26.0-493"
|
||||
tangemCardSdk = "releases-5.26.0-503"
|
||||
#tangemCardSdk = "0.0.1" # Keep it! - used for local builds ^
|
||||
tangemVico = "2.0.0-alpha.25-tangem12"
|
||||
#tangemVico = "0.0.1" # Keep it! - used for local builds ^
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue