Updated on 2026-08-14
This commit is contained in:
parent
7d9f1f0cf4
commit
2720e5588c
9 changed files with 36 additions and 11 deletions
|
|
@ -22,6 +22,12 @@ internal class RuntimeUserWalletsStore(
|
|||
?.singleOrNull { it.walletId == key }
|
||||
}
|
||||
|
||||
override suspend fun getAllSyncOrNull(): List<UserWallet>? {
|
||||
return walletsStateHolder.userWalletsListManager
|
||||
?.userWallets
|
||||
?.firstOrNull()
|
||||
}
|
||||
|
||||
override suspend fun update(userWalletId: UserWalletId, update: suspend (UserWallet) -> UserWallet) {
|
||||
walletsStateHolder.userWalletsListManager?.update(userWalletId, update)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,6 +9,8 @@ interface UserWalletsStore {
|
|||
|
||||
suspend fun getSyncOrNull(key: UserWalletId): UserWallet?
|
||||
|
||||
suspend fun getAllSyncOrNull(): List<UserWallet>?
|
||||
|
||||
@Throws
|
||||
suspend fun update(userWalletId: UserWalletId, update: suspend (UserWallet) -> UserWallet)
|
||||
}
|
||||
|
|
@ -10,10 +10,7 @@ import com.tangem.datasource.local.preferences.PreferencesKeys
|
|||
import com.tangem.datasource.local.preferences.utils.getObjectMap
|
||||
import com.tangem.datasource.local.userwallet.UserWalletsStore
|
||||
import com.tangem.datasource.local.walletmanager.WalletManagersStore
|
||||
import com.tangem.domain.feedback.models.AppLogModel
|
||||
import com.tangem.domain.feedback.models.BlockchainInfo
|
||||
import com.tangem.domain.feedback.models.CardInfo
|
||||
import com.tangem.domain.feedback.models.PhoneInfo
|
||||
import com.tangem.domain.feedback.models.*
|
||||
import com.tangem.domain.feedback.repository.FeedbackRepository
|
||||
import com.tangem.domain.wallets.models.UserWallet
|
||||
import timber.log.Timber
|
||||
|
|
@ -38,6 +35,13 @@ internal class DefaultFeedbackRepository(
|
|||
private val context: Context,
|
||||
) : FeedbackRepository {
|
||||
|
||||
override suspend fun getUserWalletsInfo(): UserWalletsInfo {
|
||||
return UserWalletsInfo(
|
||||
selectedUserWalletId = getSelectedUserWallet().walletId.stringValue,
|
||||
totalUserWallets = userWalletsStore.getAllSyncOrNull()?.size ?: error("No user wallets found"),
|
||||
)
|
||||
}
|
||||
|
||||
override suspend fun getCardInfo(): CardInfo {
|
||||
return CardInfoConverter.convert(value = getSelectedUserWallet())
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,13 +15,13 @@ internal object CardInfoConverter : Converter<UserWallet, CardInfo> {
|
|||
override fun convert(value: UserWallet): CardInfo {
|
||||
return with(value.scanResponse) {
|
||||
CardInfo(
|
||||
userWalletId = value.walletId.stringValue,
|
||||
cardId = card.cardId,
|
||||
firmwareVersion = card.firmwareVersion.stringValue,
|
||||
cardBlockchain = walletData?.blockchain,
|
||||
signedHashesList = card.wallets.map {
|
||||
CardInfo.SignedHashes(curve = it.curve.curve, total = it.totalSignedHashes?.toString())
|
||||
},
|
||||
isImported = value.isImported,
|
||||
isStart2Coin = value.scanResponse.card.isStart2Coin,
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package com.tangem.domain.feedback
|
|||
import com.tangem.domain.feedback.models.BlockchainInfo
|
||||
import com.tangem.domain.feedback.models.CardInfo
|
||||
import com.tangem.domain.feedback.models.PhoneInfo
|
||||
import com.tangem.domain.feedback.models.UserWalletsInfo
|
||||
import com.tangem.domain.feedback.utils.breakLine
|
||||
import com.tangem.domain.feedback.models.BlockchainInfo.Addresses as BlockchainAddresses
|
||||
|
||||
|
|
@ -10,12 +11,17 @@ internal class FeedbackDataBuilder {
|
|||
|
||||
private val builder = StringBuilder()
|
||||
|
||||
fun addUserWalletsInfo(userWalletsInfo: UserWalletsInfo) {
|
||||
builder.appendKeyValue("User Wallet ID", userWalletsInfo.selectedUserWalletId)
|
||||
builder.appendKeyValue("Total saved wallets", userWalletsInfo.totalUserWallets.toString())
|
||||
}
|
||||
|
||||
fun addCardInfo(cardInfo: CardInfo) {
|
||||
builder.appendKeyValue("Card ID", cardInfo.cardId)
|
||||
builder.appendKeyValue("Firmware version", cardInfo.firmwareVersion)
|
||||
builder.appendKeyValue("Imported wallet", if (cardInfo.isImported) "yes" else "no")
|
||||
builder.appendKeyValue("Card Blockchain", cardInfo.cardBlockchain)
|
||||
builder.appendSignedHashes(cardInfo.signedHashesList)
|
||||
builder.appendKeyValue("User Wallet ID", cardInfo.userWalletId)
|
||||
}
|
||||
|
||||
fun addBlockchainInfoList(blockchainInfoList: List<BlockchainInfo>) {
|
||||
|
|
|
|||
|
|
@ -71,6 +71,8 @@ class GetSupportFeedbackEmailUseCase(
|
|||
skipLine()
|
||||
append(
|
||||
FeedbackDataBuilder().apply {
|
||||
addUserWalletsInfo(userWalletsInfo = feedbackRepository.getUserWalletsInfo())
|
||||
addDelimiter()
|
||||
addCardInfo(cardInfo)
|
||||
addDelimiter()
|
||||
addBlockchainInfoList(blockchainInfoList = feedbackRepository.getBlockchainInfoList())
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
package com.tangem.domain.feedback.models
|
||||
|
||||
data class CardInfo(
|
||||
val userWalletId: String,
|
||||
val cardId: String,
|
||||
val firmwareVersion: String,
|
||||
val cardBlockchain: String?,
|
||||
val signedHashesList: List<SignedHashes>,
|
||||
val isImported: Boolean,
|
||||
val isStart2Coin: Boolean,
|
||||
) {
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,6 @@
|
|||
package com.tangem.domain.feedback.models
|
||||
|
||||
data class UserWalletsInfo(
|
||||
val selectedUserWalletId: String,
|
||||
val totalUserWallets: Int,
|
||||
)
|
||||
|
|
@ -1,13 +1,12 @@
|
|||
package com.tangem.domain.feedback.repository
|
||||
|
||||
import com.tangem.domain.feedback.models.AppLogModel
|
||||
import com.tangem.domain.feedback.models.BlockchainInfo
|
||||
import com.tangem.domain.feedback.models.CardInfo
|
||||
import com.tangem.domain.feedback.models.PhoneInfo
|
||||
import com.tangem.domain.feedback.models.*
|
||||
import java.io.File
|
||||
|
||||
interface FeedbackRepository {
|
||||
|
||||
suspend fun getUserWalletsInfo(): UserWalletsInfo
|
||||
|
||||
suspend fun getCardInfo(): CardInfo
|
||||
|
||||
suspend fun getBlockchainInfoList(): List<BlockchainInfo>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue