Updated on 2026-08-14
This commit is contained in:
parent
772ec7b53a
commit
2f5b70dfaa
54 changed files with 261 additions and 202 deletions
|
|
@ -0,0 +1,24 @@
|
|||
package com.tangem.features.send.v2.api.entity
|
||||
|
||||
sealed class PredefinedValues {
|
||||
data object Empty : PredefinedValues()
|
||||
|
||||
sealed class Content : PredefinedValues() {
|
||||
abstract val address: String
|
||||
abstract val amount: String?
|
||||
abstract val memo: String?
|
||||
|
||||
data class Deeplink(
|
||||
override val amount: String,
|
||||
override val address: String,
|
||||
override val memo: String?,
|
||||
val transactionId: String,
|
||||
) : Content()
|
||||
|
||||
data class QrCode(
|
||||
override val amount: String?,
|
||||
override val address: String,
|
||||
override val memo: String?,
|
||||
) : Content()
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
package com.tangem.features.send.v2.api.subcomponents.destination
|
||||
|
||||
/**
|
||||
* Common route for destination
|
||||
*/
|
||||
interface DestinationRoute {
|
||||
val isEditMode: Boolean
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
package com.tangem.features.send.v2.api.subcomponents.destination
|
||||
|
||||
import com.tangem.core.decompose.factory.ComponentFactory
|
||||
import com.tangem.core.ui.decompose.ComposableContentComponent
|
||||
|
||||
interface SendDestinationBlockComponent : ComposableContentComponent {
|
||||
|
||||
interface Factory :
|
||||
ComponentFactory<SendDestinationComponentParams.DestinationBlockParams, SendDestinationBlockComponent>
|
||||
}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
package com.tangem.features.send.v2.api.subcomponents.destination
|
||||
|
||||
import com.tangem.common.ui.navigationButtons.NavigationModelCallback
|
||||
import com.tangem.core.decompose.factory.ComponentFactory
|
||||
import com.tangem.core.ui.decompose.ComposableContentComponent
|
||||
import com.tangem.features.send.v2.api.subcomponents.destination.entity.DestinationUM
|
||||
|
||||
interface SendDestinationComponent : ComposableContentComponent {
|
||||
|
||||
interface ModelCallback : NavigationModelCallback {
|
||||
fun onDestinationResult(destinationUM: DestinationUM)
|
||||
}
|
||||
|
||||
interface Factory : ComponentFactory<SendDestinationComponentParams.DestinationParams, SendDestinationComponent>
|
||||
}
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
package com.tangem.features.send.v2.api.subcomponents.destination
|
||||
|
||||
import com.tangem.core.ui.extensions.TextReference
|
||||
import com.tangem.domain.models.currency.CryptoCurrency
|
||||
import com.tangem.domain.wallets.models.UserWalletId
|
||||
import com.tangem.features.send.v2.api.entity.PredefinedValues
|
||||
import com.tangem.features.send.v2.api.subcomponents.destination.entity.DestinationUM
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.flow.StateFlow
|
||||
|
||||
sealed class SendDestinationComponentParams {
|
||||
|
||||
abstract val state: DestinationUM
|
||||
abstract val analyticsCategoryName: String
|
||||
abstract val userWalletId: UserWalletId
|
||||
abstract val cryptoCurrency: CryptoCurrency
|
||||
|
||||
data class DestinationParams(
|
||||
override val state: DestinationUM,
|
||||
override val analyticsCategoryName: String,
|
||||
override val cryptoCurrency: CryptoCurrency,
|
||||
override val userWalletId: UserWalletId,
|
||||
val title: TextReference,
|
||||
val isBalanceHidingFlow: StateFlow<Boolean>,
|
||||
val currentRoute: Flow<DestinationRoute>,
|
||||
val callback: SendDestinationComponent.ModelCallback,
|
||||
val onBackClick: () -> Unit,
|
||||
val onNextClick: () -> Unit,
|
||||
) : SendDestinationComponentParams()
|
||||
|
||||
data class DestinationBlockParams(
|
||||
override val state: DestinationUM,
|
||||
override val analyticsCategoryName: String,
|
||||
override val userWalletId: UserWalletId,
|
||||
override val cryptoCurrency: CryptoCurrency,
|
||||
val blockClickEnableFlow: StateFlow<Boolean>,
|
||||
val predefinedValues: PredefinedValues,
|
||||
) : SendDestinationComponentParams()
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
package com.tangem.features.send.v2.api.subcomponents.destination.entity
|
||||
|
||||
import androidx.annotation.DrawableRes
|
||||
import androidx.compose.runtime.Immutable
|
||||
import com.tangem.core.ui.extensions.TextReference
|
||||
import com.tangem.domain.models.network.Network
|
||||
import com.tangem.domain.wallets.models.UserWalletId
|
||||
|
||||
@Immutable
|
||||
data class DestinationRecipientListUM(
|
||||
val id: String,
|
||||
val title: TextReference = TextReference.Companion.EMPTY,
|
||||
val subtitle: TextReference = TextReference.Companion.EMPTY,
|
||||
val timestamp: TextReference? = null,
|
||||
val subtitleEndOffset: Int = 0,
|
||||
@DrawableRes val subtitleIconRes: Int? = null,
|
||||
val isVisible: Boolean = true,
|
||||
val isLoading: Boolean = false,
|
||||
val userWalletId: UserWalletId? = null,
|
||||
val network: Network? = null,
|
||||
val address: String? = null,
|
||||
)
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
package com.tangem.features.send.v2.api.subcomponents.destination.entity
|
||||
|
||||
import androidx.compose.foundation.text.KeyboardOptions
|
||||
import androidx.compose.runtime.Immutable
|
||||
import com.tangem.core.ui.extensions.TextReference
|
||||
|
||||
@Immutable
|
||||
sealed class DestinationTextFieldUM {
|
||||
|
||||
/** Current value */
|
||||
abstract val value: String
|
||||
|
||||
/** Keyboard options */
|
||||
abstract val keyboardOptions: KeyboardOptions
|
||||
|
||||
data class RecipientAddress(
|
||||
override val value: String,
|
||||
override val keyboardOptions: KeyboardOptions,
|
||||
val placeholder: TextReference,
|
||||
val label: TextReference,
|
||||
val isError: Boolean = false,
|
||||
val error: TextReference? = null,
|
||||
val isValuePasted: Boolean,
|
||||
// if value is human-readable address, this field contains the actual blockchain address
|
||||
val blockchainAddress: String? = null,
|
||||
) : DestinationTextFieldUM() {
|
||||
|
||||
val actualAddress: String
|
||||
get() = blockchainAddress ?: value
|
||||
}
|
||||
|
||||
data class RecipientMemo(
|
||||
override val value: String,
|
||||
override val keyboardOptions: KeyboardOptions,
|
||||
val placeholder: TextReference,
|
||||
val label: TextReference,
|
||||
val isError: Boolean = false,
|
||||
val error: TextReference? = null,
|
||||
val disabledText: TextReference,
|
||||
val isEnabled: Boolean,
|
||||
val isValuePasted: Boolean,
|
||||
) : DestinationTextFieldUM()
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
package com.tangem.features.send.v2.api.subcomponents.destination.entity
|
||||
|
||||
import androidx.compose.runtime.Immutable
|
||||
import kotlinx.collections.immutable.ImmutableList
|
||||
|
||||
@Immutable
|
||||
sealed class DestinationUM {
|
||||
|
||||
abstract val isPrimaryButtonEnabled: Boolean
|
||||
|
||||
data class Content(
|
||||
override val isPrimaryButtonEnabled: Boolean,
|
||||
val addressTextField: DestinationTextFieldUM.RecipientAddress,
|
||||
val memoTextField: DestinationTextFieldUM.RecipientMemo?,
|
||||
val recent: ImmutableList<DestinationRecipientListUM>,
|
||||
val wallets: ImmutableList<DestinationRecipientListUM>,
|
||||
val networkName: String,
|
||||
val isValidating: Boolean = false,
|
||||
val isInitialized: Boolean = false,
|
||||
val isRedesignEnabled: Boolean = false,
|
||||
) : DestinationUM()
|
||||
|
||||
data class Empty(
|
||||
override val isPrimaryButtonEnabled: Boolean = false,
|
||||
) : DestinationUM()
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue