Updated on 2026-08-14

This commit is contained in:
Tangem 2023-04-07 20:39:24 +08:00
parent 069605e151
commit 36516c900f
234 changed files with 902 additions and 1618 deletions

View file

@ -52,9 +52,11 @@ sealed class AddCustomTokenError(
object UnsupportedSolanaToken : Warning()
}
data class SelectTokeNetworkError(val networkId: String) : AddCustomTokenError(
message = "Unknown network [$networkId] should not be included in the network selection dialog.",
), FbConsumeException
data class SelectTokeNetworkError(val networkId: String) :
AddCustomTokenError(
message = "Unknown network [$networkId] should not be included in the network selection dialog.",
),
FbConsumeException
data class UnAppropriateInitialization(
val of: String,

View file

@ -19,14 +19,14 @@ sealed interface DomainWrapped {
data class Token(
val token: com.tangem.blockchain.common.Token,
override val blockchain: com.tangem.blockchain.common.Blockchain,
override val derivationPath: String?
override val derivationPath: String?,
) : Currency {
override val currencySymbol = token.symbol
}
data class Blockchain(
override val blockchain: com.tangem.blockchain.common.Blockchain,
override val derivationPath: String?
override val derivationPath: String?,
) : Currency {
override val currencySymbol: String = blockchain.currency
}

View file

@ -267,7 +267,8 @@ data class CardDTO(
enum class LinkedTerminalStatus {
Current,
Other,
None;
None,
;
companion object {
internal fun fromSdkStatus(sdkStatus: Card.LinkedTerminalStatus): LinkedTerminalStatus {

View file

@ -32,8 +32,10 @@ class TangemCardTypesResolver(
override fun isMultiwalletAllowed(): Boolean =
!isTangemTwins() && !card.isStart2Coin && !isTangemNote() && !isSaltPay() &&
(card.firmwareVersion >= FirmwareVersion.MultiWalletAvailable ||
card.wallets.firstOrNull()?.curve == EllipticCurve.Secp256k1)
(
card.firmwareVersion >= FirmwareVersion.MultiWalletAvailable ||
card.wallets.firstOrNull()?.curve == EllipticCurve.Secp256k1
)
override fun getBlockchain(): Blockchain {
return when (productType) {

View file

@ -31,7 +31,7 @@ open class Throttler<T>(
}
class ThrottlerWithValues<T, V>(
duration: Long
duration: Long,
) : Throttler<T>(duration), ValuesHolder<T, V> {
private val valuesHolder: MutableMap<T, V?> = mutableMapOf()

View file

@ -38,7 +38,7 @@ interface Field<T> {
data class Data<Data>(
val value: Data,
val isUserInput: Boolean
val isUserInput: Boolean,
)
}

View file

@ -81,11 +81,7 @@ internal class AddCustomTokenHub : BaseStoreHub<AddCustomTokenState>("AddCustomT
}
@Suppress("ComplexMethod")
override suspend fun handleAction(
action: Action,
storeState: DomainState,
cancel: ValueCallback<Action>,
) {
override suspend fun handleAction(action: Action, storeState: DomainState, cancel: ValueCallback<Action>) {
if (action !is AddCustomTokenAction) return
when (action) {

View file

@ -11,7 +11,7 @@ data class ScreenState(
val symbol: ViewStates.TokenField,
val decimals: ViewStates.TokenField,
val derivationPath: ViewStates.TokenField,
val addButton: ViewStates.AddButton
val addButton: ViewStates.AddButton,
)
sealed class ViewStates {
@ -22,6 +22,6 @@ sealed class ViewStates {
) : ViewStates()
data class AddButton(
val isEnabled: Boolean = true
val isEnabled: Boolean = true,
) : ViewStates()
}

View file

@ -3,7 +3,13 @@ package com.tangem.domain.redux
import android.webkit.ValueCallback
import com.tangem.domain.redux.global.DomainGlobalState
import com.tangem.utils.coroutines.FeatureCoroutineExceptionHandler
import kotlinx.coroutines.*
import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.CoroutineName
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Job
import kotlinx.coroutines.asCoroutineDispatcher
import kotlinx.coroutines.job
import kotlinx.coroutines.launch
import org.rekotlin.Action
import org.rekotlin.DispatchFunction
import org.rekotlin.Middleware
@ -38,14 +44,14 @@ internal interface ReStoreReducer<State> {
*/
internal abstract class BaseStoreHub<State>(
private val name: String,
private val dispatcher: CoroutineDispatcher = Executors.newFixedThreadPool(1).asCoroutineDispatcher()
private val dispatcher: CoroutineDispatcher = Executors.newFixedThreadPool(1).asCoroutineDispatcher(),
) : ReStoreHub<DomainState, State> {
val globalState: DomainGlobalState
get() = domainStore.state.globalState
val hubScope = CoroutineScope(
Job() + dispatcher + CoroutineName(name) + FeatureCoroutineExceptionHandler.create(name)
Job() + dispatcher + CoroutineName(name) + FeatureCoroutineExceptionHandler.create(name),
)
private val actionsAndJobs = mutableMapOf<Action, Job>()