Updated on 2026-08-14
This commit is contained in:
parent
4fa5989289
commit
2d0bc9d9e6
12 changed files with 141 additions and 74 deletions
|
|
@ -1,22 +0,0 @@
|
|||
package com.tangem.tap.domain.card
|
||||
|
||||
import arrow.core.Either
|
||||
import arrow.core.left
|
||||
import arrow.core.right
|
||||
import com.tangem.common.doOnFailure
|
||||
import com.tangem.common.doOnSuccess
|
||||
import com.tangem.domain.card.DeleteSavedAccessCodesUseCase
|
||||
import com.tangem.sdk.api.TangemSdkManager
|
||||
|
||||
internal class DefaultDeleteSavedAccessCodesUseCase(
|
||||
private val tangemSdkManager: TangemSdkManager,
|
||||
) : DeleteSavedAccessCodesUseCase {
|
||||
|
||||
override suspend fun invoke(cardId: String): Either<Throwable, Unit> {
|
||||
tangemSdkManager.deleteSavedUserCodes(setOf(cardId))
|
||||
.doOnFailure { return it.left() }
|
||||
.doOnSuccess { return Unit.right() }
|
||||
|
||||
return Unit.right()
|
||||
}
|
||||
}
|
||||
|
|
@ -36,9 +36,9 @@ import com.tangem.tap.domain.userWalletList.utils.*
|
|||
import com.tangem.utils.Provider
|
||||
import com.tangem.utils.ProviderSuspend
|
||||
import com.tangem.utils.coroutines.runSuspendCatching
|
||||
import dagger.Lazy
|
||||
import com.tangem.utils.extensions.addOrReplace
|
||||
import com.tangem.utils.extensions.indexOfFirstOrNull
|
||||
import dagger.Lazy
|
||||
import kotlinx.coroutines.NonCancellable
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import kotlinx.coroutines.flow.update
|
||||
|
|
@ -96,8 +96,8 @@ internal class DefaultUserWalletsListRepository(
|
|||
?: loadedWallets.firstOrNull()?.also {
|
||||
selectedUserWalletRepository.set(it.walletId)
|
||||
}
|
||||
userWallets.value = loadedWallets
|
||||
setSelectedUserWallet(initialSelection)
|
||||
userWallets.value = loadedWallets
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -235,7 +235,6 @@ internal class DefaultUserWalletsListRepository(
|
|||
)
|
||||
}
|
||||
|
||||
userWallets.value = updatedWallets
|
||||
if (currentSelected != null) {
|
||||
if (newSelected == null) {
|
||||
onAllWalletsDeleted()
|
||||
|
|
@ -243,6 +242,7 @@ internal class DefaultUserWalletsListRepository(
|
|||
selectedUserWalletRepository.set(newSelected?.walletId)
|
||||
setSelectedUserWallet(newSelected)
|
||||
}
|
||||
userWallets.value = updatedWallets
|
||||
}
|
||||
|
||||
@Suppress("CyclomaticComplexMethod", "LongMethod")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue