Updated on 2026-08-14

This commit is contained in:
Tangem 2023-06-07 07:02:28 +03:00
parent 4affe1293d
commit e73e91e07a
4 changed files with 17 additions and 14 deletions

View file

@ -1,13 +1,15 @@
package com.tangem.tap.features.intentHandler
import android.content.Intent
import java.util.concurrent.CopyOnWriteArrayList
/**
[REDACTED_AUTHOR]
*/
class MainIntentHandler {
// TODO: fixme: close it with the combined interfaces IntentHandler and IntentHandlerHolder
class IntentProcessor {
private val intentHandlers = mutableListOf<IntentHandler>()
private val intentHandlers = CopyOnWriteArrayList<IntentHandler>()
fun addHandler(handler: IntentHandler) {
intentHandlers.add(handler)
@ -22,7 +24,7 @@ class MainIntentHandler {
}
suspend fun handleIntent(intent: Intent?) {
intentHandlers.toList().forEach {
intentHandlers.forEach {
it.handleIntent(intent)
}
}

View file

@ -10,6 +10,7 @@ import timber.log.Timber
[REDACTED_AUTHOR]
*/
class SellCurrencyIntentHandler : IntentHandler {
override suspend fun handleIntent(intent: Intent?): Boolean {
return try {
val intentData = intent?.data ?: return false
@ -34,7 +35,7 @@ class SellCurrencyIntentHandler : IntentHandler {
}
}
companion object {
private companion object {
private const val TRANSACTION_ID_PARAM = "transactionId"
private const val CURRENCY_CODE_PARAM = "baseCurrencyCode"
private const val CURRENCY_AMOUNT_PARAM = "baseCurrencyAmount"

View file

@ -30,7 +30,7 @@ class WalletConnectLinkIntentHandler : IntentHandler {
}
}
companion object {
private companion object {
private const val TANGEM_SCHEME = "tangem"
private const val TANGEM_WC_PREFIX = "tangem://wc?uri="
}