Updated on 2026-08-14
This commit is contained in:
parent
0d993b5141
commit
e72bf276da
18 changed files with 568 additions and 21 deletions
34
app/src/main/java/com/tangem/tap/domain/model/UserWallet.kt
Normal file
34
app/src/main/java/com/tangem/tap/domain/model/UserWallet.kt
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
package com.tangem.tap.domain.model
|
||||
|
||||
import com.tangem.domain.common.ScanResponse
|
||||
import com.tangem.domain.common.util.UserWalletId
|
||||
import com.tangem.domain.common.util.userWalletId
|
||||
import com.tangem.tap.domain.extensions.getOrLoadCardArtworkUrl
|
||||
|
||||
data class UserWallet(
|
||||
val name: String,
|
||||
val walletId: UserWalletId,
|
||||
val artworkUrl: String,
|
||||
val cardsInWallet: Set<String>,
|
||||
val scanResponse: ScanResponse,
|
||||
) {
|
||||
val cardId: String
|
||||
get() = scanResponse.card.cardId
|
||||
|
||||
companion object {
|
||||
suspend operator fun invoke(
|
||||
scanResponse: ScanResponse,
|
||||
backupCardsIds: Set<String>? = null,
|
||||
): UserWallet {
|
||||
return with(scanResponse) {
|
||||
UserWallet(
|
||||
walletId = card.userWalletId,
|
||||
name = productType.name,
|
||||
artworkUrl = card.getOrLoadCardArtworkUrl(),
|
||||
cardsInWallet = backupCardsIds?.plus(card.cardId) ?: setOf(card.cardId),
|
||||
scanResponse = this,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue