Updated on 2026-08-14
This commit is contained in:
parent
24c6425299
commit
21a63d246b
10 changed files with 139 additions and 8 deletions
|
|
@ -64,6 +64,7 @@ dependencies {
|
|||
implementation(projects.domain.analytics)
|
||||
implementation(projects.domain.visa)
|
||||
implementation(projects.domain.onboarding)
|
||||
implementation(projects.domain.feedback)
|
||||
|
||||
implementation(projects.common)
|
||||
implementation(projects.core.analytics)
|
||||
|
|
|
|||
|
|
@ -73,15 +73,9 @@ class SendTransactionFailedEmail(
|
|||
|
||||
class FeedbackEmail : FeedbackData {
|
||||
override val subjectResId: Int
|
||||
get() = if (isS2CCard) s2cSubject else tangemSubject
|
||||
override val mainMessageResId: Int
|
||||
get() = if (isS2CCard) s2cMainMessage else tangemMainMessage
|
||||
get() = if (isS2CCard) R.string.feedback_subject_support else R.string.feedback_subject_support_tangem
|
||||
|
||||
private val tangemSubject: Int = R.string.feedback_subject_support_tangem
|
||||
private val tangemMainMessage: Int = R.string.feedback_preface_support
|
||||
|
||||
private val s2cSubject: Int = R.string.feedback_subject_support
|
||||
private val s2cMainMessage: Int = R.string.feedback_preface_support
|
||||
override val mainMessageResId: Int = R.string.feedback_preface_support
|
||||
|
||||
private var isS2CCard = false
|
||||
|
||||
|
|
|
|||
1
domain/feedback/.gitignore
vendored
Normal file
1
domain/feedback/.gitignore
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
/build
|
||||
13
domain/feedback/build.gradle.kts
Normal file
13
domain/feedback/build.gradle.kts
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
plugins {
|
||||
alias(deps.plugins.android.library)
|
||||
alias(deps.plugins.kotlin.android)
|
||||
id("configuration")
|
||||
}
|
||||
|
||||
android {
|
||||
namespace = "com.tangem.domain.feedback"
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(projects.core.res)
|
||||
}
|
||||
|
|
@ -0,0 +1,78 @@
|
|||
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.utils.breakLine
|
||||
|
||||
internal class FeedbackDataBuilder {
|
||||
|
||||
private val builder = StringBuilder()
|
||||
|
||||
fun addCardInfo(cardInfo: CardInfo) {
|
||||
builder.appendKeyValue("Card ID", cardInfo.cardId)
|
||||
builder.appendKeyValue("Firmware version", cardInfo.firmwareVersion)
|
||||
builder.appendKeyValue("Card Blockchain", cardInfo.cardBlockchain)
|
||||
builder.appendSignedHashes(cardInfo.signedHashesList)
|
||||
builder.appendKeyValue("User Wallet ID", cardInfo.userWalletId)
|
||||
}
|
||||
|
||||
fun addBlockchainInfoList(blockchainInfoList: List<BlockchainInfo>) {
|
||||
blockchainInfoList.forEachBlockchain { isLastIndex ->
|
||||
builder.appendKeyValue("Blockchain", blockchain)
|
||||
builder.appendKeyValue("Derivation path", derivationPath)
|
||||
|
||||
// enable later
|
||||
// if (walletInfo.blockchain == Blockchain.Bitcoin) {
|
||||
// builder.appendKeyValue("XPUB", infoHolder.extendedPublicKey)
|
||||
// }
|
||||
|
||||
builder.appendKeyValue("Outputs count", outputsCount)
|
||||
|
||||
if (tokens.isNotEmpty()) {
|
||||
builder.append("Tokens:")
|
||||
builder.breakLine()
|
||||
tokens.forEach { token ->
|
||||
builder.appendKeyValue("ID", token.id ?: "[custom token]")
|
||||
builder.appendKeyValue("Name", token.name)
|
||||
builder.appendKeyValue("Contract address", token.contractAddress)
|
||||
}
|
||||
}
|
||||
|
||||
builder.appendKeyValue("Host", host)
|
||||
builder.appendKeyValue("Wallet address", addresses)
|
||||
builder.appendKeyValue("Explorer link", explorerLink)
|
||||
|
||||
if (!isLastIndex) builder.appendDelimiter()
|
||||
}
|
||||
}
|
||||
|
||||
fun addPhoneInfo(phoneInfo: PhoneInfo) {
|
||||
builder.appendKeyValue("Phone model", phoneInfo.phoneModel)
|
||||
builder.appendKeyValue("OS version", phoneInfo.osVersion)
|
||||
builder.appendKeyValue("App version", phoneInfo.appVersion)
|
||||
}
|
||||
|
||||
fun addDelimiter(): StringBuilder = builder.appendDelimiter()
|
||||
|
||||
fun build(): String = builder.toString()
|
||||
|
||||
private fun StringBuilder.appendKeyValue(key: String, value: String?) {
|
||||
if (value.isNullOrBlank()) return
|
||||
|
||||
val keyValuePrefix = if (key.isBlank()) "" else "$key: "
|
||||
append("$keyValuePrefix$value\n")
|
||||
}
|
||||
|
||||
private fun StringBuilder.appendSignedHashes(signedHashesList: List<CardInfo.SignedHashes>) {
|
||||
signedHashesList.forEach {
|
||||
appendKeyValue("Signed hashes [${it.curve}]", it.total)
|
||||
}
|
||||
}
|
||||
|
||||
private fun StringBuilder.appendDelimiter(): StringBuilder = append("----------\n")
|
||||
|
||||
private inline fun List<BlockchainInfo>.forEachBlockchain(action: BlockchainInfo.(Boolean) -> Unit) {
|
||||
return forEachIndexed { index, info -> info.action(index == lastIndex) }
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
package com.tangem.domain.feedback.models
|
||||
|
||||
data class BlockchainInfo(
|
||||
val blockchain: String,
|
||||
val derivationPath: String,
|
||||
val outputsCount: String?,
|
||||
val host: String,
|
||||
val addresses: String,
|
||||
val explorerLink: String,
|
||||
val tokens: List<TokenInfo>,
|
||||
) {
|
||||
|
||||
data class TokenInfo(
|
||||
val id: String?,
|
||||
val name: String,
|
||||
val contractAddress: String,
|
||||
)
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
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 isStart2Coin: Boolean,
|
||||
) {
|
||||
|
||||
data class SignedHashes(val curve: String, val total: String?)
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
package com.tangem.domain.feedback.models
|
||||
|
||||
data class PhoneInfo(
|
||||
val phoneModel: String,
|
||||
val osVersion: String,
|
||||
val appVersion: String,
|
||||
)
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
package com.tangem.domain.feedback.utils
|
||||
|
||||
fun StringBuilder.breakLine(count: Int = 1): StringBuilder = append("\n".repeat(count))
|
||||
|
||||
fun StringBuilder.skipLine(): StringBuilder = breakLine(count = 2)
|
||||
|
|
@ -138,6 +138,7 @@ include(":domain:transaction")
|
|||
include(":domain:analytics")
|
||||
include(":domain:visa")
|
||||
include(":domain:onboarding")
|
||||
include(":domain:feedback")
|
||||
// endregion Domain modules
|
||||
|
||||
// region Data modules
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue