Updated on 2026-08-14
This commit is contained in:
commit
252bd57891
20 changed files with 170 additions and 99 deletions
|
|
@ -8,6 +8,7 @@ import com.google.firebase.ktx.Firebase
|
|||
import com.google.firebase.remoteconfig.ktx.remoteConfig
|
||||
import com.google.firebase.remoteconfig.ktx.remoteConfigSettings
|
||||
import com.tangem.Log
|
||||
import com.tangem.LogFormat
|
||||
import com.tangem.blockchain.network.BlockchainSdkRetrofitBuilder
|
||||
import com.tangem.domain.DomainLayer
|
||||
import com.tangem.network.common.MoshiConverter
|
||||
|
|
@ -108,7 +109,21 @@ class TapApplication : Application(), ImageLoaderFactory {
|
|||
val infoHolder = AdditionalFeedbackInfo()
|
||||
infoHolder.setAppVersion(this)
|
||||
|
||||
val logWriter = TangemLogCollector()
|
||||
val logLevels = listOf(
|
||||
Log.Level.ApduCommand,
|
||||
Log.Level.Apdu,
|
||||
Log.Level.Tlv,
|
||||
Log.Level.Nfc,
|
||||
Log.Level.Command,
|
||||
Log.Level.Session,
|
||||
Log.Level.View,
|
||||
Log.Level.Network,
|
||||
Log.Level.Error,
|
||||
)
|
||||
val logWriter = TangemLogCollector(
|
||||
levels = logLevels,
|
||||
messageFormatter = LogFormat.StairsFormatter()
|
||||
)
|
||||
Log.addLogger(logWriter)
|
||||
|
||||
store.dispatch(GlobalAction.SetFeedbackManager(FeedbackManager(infoHolder, logWriter)))
|
||||
|
|
@ -126,4 +141,5 @@ class TapApplication : Application(), ImageLoaderFactory {
|
|||
data class LogConfig(
|
||||
val coil: Boolean = BuildConfig.DEBUG,
|
||||
val storeAction: Boolean = BuildConfig.DEBUG,
|
||||
val zendesk: Boolean = BuildConfig.DEBUG,
|
||||
)
|
||||
|
|
@ -27,6 +27,7 @@ fun Blockchain.getRoundIconRes(): Int {
|
|||
Blockchain.BSC, Blockchain.BSCTestnet, Blockchain.Binance, Blockchain.BinanceTestnet -> R.drawable.ic_bsc_round
|
||||
Blockchain.Dogecoin -> R.drawable.ic_dogecoin_round
|
||||
Blockchain.Tron, Blockchain.TronTestnet -> R.drawable.ic_tron_round
|
||||
Blockchain.Gnosis -> R.drawable.ic_gnosis_round
|
||||
else -> R.drawable.ic_tangem_logo
|
||||
}
|
||||
}
|
||||
|
|
@ -53,6 +54,7 @@ fun Blockchain.getGreyedOutIconRes(): Int {
|
|||
Blockchain.BSC, Blockchain.BSCTestnet, Blockchain.Binance, Blockchain.BinanceTestnet -> R.drawable.ic_bsc_no_color
|
||||
Blockchain.Dogecoin -> R.drawable.ic_dogecoin_no_color
|
||||
Blockchain.Tron, Blockchain.TronTestnet -> R.drawable.ic_tron_no_color
|
||||
Blockchain.Gnosis -> R.drawable.ic_gnosis_no_color
|
||||
else -> R.drawable.ic_tangem_logo
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,18 +6,19 @@ import com.tangem.tap.common.extensions.sendEmail
|
|||
import com.tangem.tap.common.log.TangemLogCollector
|
||||
import com.tangem.tap.common.zendesk.ZendeskConfig
|
||||
import com.tangem.tap.foregroundActivityObserver
|
||||
import com.tangem.tap.logConfig
|
||||
import com.tangem.tap.withForegroundActivity
|
||||
import com.tangem.wallet.R
|
||||
import com.zendesk.logger.Logger
|
||||
import timber.log.Timber
|
||||
import zendesk.chat.Chat
|
||||
import zendesk.chat.ChatConfiguration
|
||||
import zendesk.chat.ChatEngine
|
||||
import zendesk.configurations.Configuration
|
||||
import zendesk.messaging.MessagingActivity
|
||||
import java.io.File
|
||||
import java.io.FileWriter
|
||||
import java.io.StringWriter
|
||||
import timber.log.Timber
|
||||
import zendesk.configurations.Configuration
|
||||
import zendesk.core.AnonymousIdentity
|
||||
import zendesk.core.Zendesk
|
||||
import zendesk.support.Support
|
||||
import zendesk.support.request.RequestConfiguration
|
||||
import zendesk.support.requestlist.RequestListActivity
|
||||
import zendesk.support.requestlist.RequestListConfiguration
|
||||
|
||||
/**
|
||||
[REDACTED_AUTHOR]
|
||||
|
|
@ -30,14 +31,14 @@ class FeedbackManager(
|
|||
context: Context,
|
||||
zendeskConfig: ZendeskConfig,
|
||||
) {
|
||||
Zendesk.INSTANCE.init(
|
||||
/* context = */ context,
|
||||
/* zendeskUrl = */ zendeskConfig.url,
|
||||
/* applicationId = */ zendeskConfig.appId,
|
||||
/* oauthClientId = */ zendeskConfig.clientId,
|
||||
Chat.INSTANCE.init(
|
||||
context,
|
||||
zendeskConfig.accountKey,
|
||||
zendeskConfig.appId
|
||||
)
|
||||
Support.INSTANCE.init(Zendesk.INSTANCE)
|
||||
Zendesk.INSTANCE.setIdentity(AnonymousIdentity())
|
||||
|
||||
// Zendesk logs
|
||||
Logger.setLoggable(logConfig.zendesk)
|
||||
}
|
||||
|
||||
fun sendEmail(feedbackData: FeedbackData, onFail: ((Exception) -> Unit)? = null) {
|
||||
|
|
@ -57,11 +58,8 @@ class FeedbackManager(
|
|||
fun openChat(feedbackData: FeedbackData) {
|
||||
feedbackData.prepare(infoHolder)
|
||||
foregroundActivityObserver.withForegroundActivity { activity ->
|
||||
RequestListActivity.builder()
|
||||
.show(
|
||||
/* context = */ activity,
|
||||
/* configurations = */ buildConfigs(activity, feedbackData)
|
||||
)
|
||||
setChatVisitorNote(activity, feedbackData)
|
||||
showMessagingActivity(activity)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -84,20 +82,30 @@ class FeedbackManager(
|
|||
}
|
||||
}
|
||||
|
||||
private fun buildConfigs(
|
||||
private fun setChatVisitorNote(
|
||||
context: Context,
|
||||
feedbackData: FeedbackData,
|
||||
): List<Configuration> {
|
||||
return listOf(
|
||||
// Request configuration
|
||||
RequestConfiguration.Builder()
|
||||
.withRequestSubject(context.getString(feedbackData.subjectResId))
|
||||
.config(),
|
||||
// Request list configuration
|
||||
RequestListConfiguration.Builder()
|
||||
.withContactUsButtonVisible(true)
|
||||
.config(),
|
||||
)
|
||||
) {
|
||||
Chat.INSTANCE.providers()
|
||||
?.profileProvider()
|
||||
?.setVisitorNote(feedbackData.joinTogether(context, infoHolder))
|
||||
}
|
||||
|
||||
private fun showMessagingActivity(context: Context) {
|
||||
MessagingActivity.builder()
|
||||
.withMultilineResponseOptionsEnabled(false)
|
||||
.withBotLabelStringRes(R.string.chat_bot_name)
|
||||
.withBotAvatarDrawable(R.mipmap.ic_launcher)
|
||||
.withEngines(ChatEngine.engine())
|
||||
.show(context, buildChatConfig())
|
||||
}
|
||||
|
||||
private fun buildChatConfig(): Configuration {
|
||||
return ChatConfiguration.builder()
|
||||
.withOfflineFormEnabled(true)
|
||||
.withAgentAvailabilityEnabled(true)
|
||||
.withPreChatFormEnabled(false)
|
||||
.build()
|
||||
}
|
||||
|
||||
private fun getSupportEmail(): String {
|
||||
|
|
|
|||
|
|
@ -1,25 +1,31 @@
|
|||
package com.tangem.tap.common.log
|
||||
|
||||
import com.tangem.Log
|
||||
import com.tangem.LogFormat
|
||||
import com.tangem.TangemSdkLogger
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.Date
|
||||
import java.util.*
|
||||
|
||||
class TangemLogCollector(
|
||||
private val levels: List<Log.Level>,
|
||||
private val messageFormatter: LogFormat,
|
||||
) : TangemSdkLogger {
|
||||
|
||||
class TangemLogCollector : TangemSdkLogger {
|
||||
private val dateFormatter = SimpleDateFormat("HH:mm:ss.SSS")
|
||||
private val logs = mutableListOf<String>()
|
||||
private val mutex = Object()
|
||||
|
||||
override fun log(message: () -> String, level: Log.Level) {
|
||||
val time = dateFormatter.format(Date())
|
||||
if (!levels.contains(level)) return
|
||||
|
||||
synchronized(mutex) {
|
||||
logs.add("$time: ${message()}\n")
|
||||
val formattedMessage = messageFormatter.format(message, level)
|
||||
val logMessage = "${dateFormatter.format(Date())}: $formattedMessage"
|
||||
logs.add("$logMessage\n")
|
||||
}
|
||||
}
|
||||
|
||||
fun getLogs(): List<String> = synchronized(mutex) { logs.toList() }
|
||||
|
||||
fun clearLogs() {
|
||||
synchronized(mutex) { logs.clear() }
|
||||
}
|
||||
fun clearLogs() = synchronized(mutex) { logs.clear() }
|
||||
}
|
||||
|
|
@ -11,6 +11,8 @@ data class ZendeskConfig(
|
|||
val appId: String,
|
||||
@Json(name = "zendeskClientId")
|
||||
val clientId: String,
|
||||
@Json(name = "zendeskAccountKey")
|
||||
val accountKey: String,
|
||||
@Json(name = "zendeskUrl")
|
||||
val url: String,
|
||||
)
|
||||
|
|
@ -28,11 +28,15 @@ class WalletConnectNetworkUtils {
|
|||
peer.name.contains("BSC") -> {
|
||||
Blockchain.BSC
|
||||
}
|
||||
peer.url.contains("honeyswap.1hive.eth.limo") -> {
|
||||
// Check if something's changed after this bug report:
|
||||
// https://github.com/1Hive/honeyswap-interface/issues/83
|
||||
Blockchain.Gnosis
|
||||
}
|
||||
else -> {
|
||||
Blockchain.Ethereum
|
||||
Blockchain.Ethereum
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -2,7 +2,16 @@ package com.tangem.tap.features.tokens.ui.compose
|
|||
|
||||
import androidx.compose.foundation.Image
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.Spacer
|
||||
import androidx.compose.foundation.layout.fillMaxHeight
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.foundation.layout.width
|
||||
import androidx.compose.foundation.shape.CircleShape
|
||||
import androidx.compose.material.Divider
|
||||
import androidx.compose.material.Text
|
||||
|
|
@ -132,7 +141,9 @@ fun ExpandedCurrencyItem(
|
|||
val contract = currency.contracts.firstOrNull { it.blockchain == blockchain }
|
||||
?: return@map
|
||||
val added = if (contract.address != null) {
|
||||
addedTokens.map { it.token.contractAddress }.contains(contract.address)
|
||||
addedTokens.any {
|
||||
it.token.contractAddress == contract.address && it.blockchain == contract.blockchain
|
||||
}
|
||||
} else {
|
||||
addedBlockchains.contains(blockchain)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import androidx.recyclerview.widget.RecyclerView
|
|||
import com.tangem.blockchain.common.Blockchain
|
||||
import com.tangem.blockchain.common.Token
|
||||
import com.tangem.domain.common.TapWorkarounds.derivationStyle
|
||||
import com.tangem.tap.common.extensions.getGreyedOutIconRes
|
||||
import com.tangem.tap.common.extensions.getRoundIconRes
|
||||
import com.tangem.tap.common.extensions.getString
|
||||
import com.tangem.tap.common.extensions.hide
|
||||
import com.tangem.tap.common.extensions.show
|
||||
|
|
@ -118,7 +118,7 @@ class WalletAdapter
|
|||
|
||||
badgeCustomBalance.isVisible = isCustomCurrency
|
||||
ivBlockchain.isVisible = wallet.currency.isToken()
|
||||
ivBlockchain.setImageResource(wallet.currency.blockchain.getGreyedOutIconRes())
|
||||
ivBlockchain.setImageResource(wallet.currency.blockchain.getRoundIconRes())
|
||||
|
||||
cardWallet.setOnClickListener {
|
||||
store.dispatch(WalletAction.MultiWallet.SelectWallet(wallet))
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@ class CurrencyIconView @JvmOverloads constructor(
|
|||
init {
|
||||
elevation = 0f
|
||||
cardElevation = 0f
|
||||
radius = dpToPx(8f)
|
||||
background = null
|
||||
radius = dpToPx(6f)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue