Updated on 2026-08-14

This commit is contained in:
Tangem 2024-05-28 19:20:56 +04:00
parent f71fe3aa6b
commit cf7d5814d6
33 changed files with 476 additions and 2 deletions

1
features/details/api/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
/build

View file

@ -0,0 +1,21 @@
plugins {
alias(deps.plugins.android.library)
alias(deps.plugins.kotlin.android)
id("configuration")
}
android {
namespace = "com.tangem.features.details.api"
}
dependencies {
/* Project - Domain */
implementation(projects.domain.wallets.models)
/* Project - Core */
implementation(projects.core.decompose)
/* AndroidX */
implementation(deps.androidx.fragment.ktx)
}

View file

@ -0,0 +1,9 @@
package com.tangem.features.details
import androidx.fragment.app.Fragment
import com.tangem.core.decompose.context.AppComponentContext
interface DetailsEntryPoint {
fun entryFragment(parentContext: AppComponentContext): Fragment
}

View file

@ -0,0 +1,6 @@
package com.tangem.features.details
interface DetailsFeatureToggles {
val isRedesignEnabled: Boolean
}

1
features/details/impl/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
/build

View file

@ -0,0 +1,45 @@
plugins {
alias(deps.plugins.android.library)
alias(deps.plugins.kotlin.android)
alias(deps.plugins.kotlin.kapt)
alias(deps.plugins.kotlin.serialization)
alias(deps.plugins.hilt.android)
id("configuration")
}
android {
namespace = "com.tangem.features.details.impl"
}
dependencies {
/* Project - API */
implementation(projects.features.details.api)
/* Project - Core */
implementation(projects.core.decompose)
implementation(projects.core.ui)
implementation(projects.core.featuretoggles)
/* Project - Domain */
implementation(projects.domain.wallets.models)
/* AndroidX */
implementation(deps.androidx.fragment.ktx)
implementation(deps.lifecycle.compose)
/* Compose */
implementation(deps.compose.ui)
implementation(deps.compose.ui.tooling)
implementation(deps.compose.accompanist.systemUiController)
implementation(deps.compose.foundation)
implementation(deps.compose.material3)
implementation(deps.compose.shimmer)
/* DI */
implementation(deps.hilt.android)
kapt(deps.hilt.kapt)
/* Other */
implementation(deps.kotlin.immutable.collections)
}

View file

@ -0,0 +1,11 @@
package com.tangem.features.details
import com.tangem.core.featuretoggle.manager.FeatureTogglesManager
internal class DefaultDetailsFeatureToggles(
private val featureTogglesManager: FeatureTogglesManager,
) : DetailsFeatureToggles {
override val isRedesignEnabled: Boolean
get() = featureTogglesManager.isFeatureEnabled("DETAILS_REDESIGN_ENABLED")
}

View file

@ -0,0 +1,33 @@
package com.tangem.features.details
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.fragment.app.Fragment
import com.tangem.core.decompose.context.AppComponentContext
import com.tangem.core.ui.UiDependencies
import com.tangem.core.ui.screen.ComposeFragment
import com.tangem.features.details.component.preview.PreviewDetailsComponent
import dagger.hilt.android.AndroidEntryPoint
import javax.inject.Inject
// TODO: Remove after [REDACTED_JIRA]
@AndroidEntryPoint
internal class DetailsFragment : ComposeFragment() {
@Inject
override lateinit var uiDependencies: UiDependencies
@Composable
override fun ScreenContent(modifier: Modifier) {
// TODO: Update to use the actual component in [REDACTED_TASK_KEY]
PreviewDetailsComponent().View(modifier = modifier)
}
companion object : DetailsEntryPoint {
override fun entryFragment(parentContext: AppComponentContext): Fragment {
// TODO: Update to use the actual component in [REDACTED_TASK_KEY]
return DetailsFragment()
}
}
}

View file

@ -0,0 +1,22 @@
package com.tangem.features.details.component
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import com.tangem.core.decompose.context.AppComponentContext
import com.tangem.domain.wallets.models.UserWalletId
interface DetailsComponent {
@Composable
@Suppress("TopLevelComposableFunctions") // TODO: Remove this check
fun View(modifier: Modifier)
interface Factory {
fun create(context: AppComponentContext, params: Params): DetailsComponent
}
data class Params(
val selectedUserWalletId: UserWalletId,
)
}

View file

@ -0,0 +1,16 @@
package com.tangem.features.details.component
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import com.tangem.core.decompose.context.AppComponentContext
interface UserWalletListComponent {
@Composable
@Suppress("TopLevelComposableFunctions") // TODO: Remove this check
fun View(modifier: Modifier)
interface Factory {
fun create(context: AppComponentContext): UserWalletListComponent
}
}

View file

@ -0,0 +1,23 @@
package com.tangem.features.details.component
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import com.tangem.core.decompose.context.AppComponentContext
import com.tangem.domain.wallets.models.UserWalletId
interface WalletConnectComponent {
suspend fun checkIsAvailable(): Boolean
@Composable
@Suppress("TopLevelComposableFunctions") // TODO: Remove this check
fun View(modifier: Modifier)
interface Factory {
fun create(context: AppComponentContext, params: Params): WalletConnectComponent
}
data class Params(
val userWalletId: UserWalletId,
)
}

View file

@ -0,0 +1,14 @@
package com.tangem.features.details.component.preview
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import com.tangem.features.details.component.DetailsComponent
internal class PreviewDetailsComponent : DetailsComponent {
@Composable
@Suppress("TopLevelComposableFunctions") // TODO: Remove this check
override fun View(modifier: Modifier) {
TODO("Will be implemented in [REDACTED_TASK_KEY]")
}
}

View file

@ -0,0 +1,14 @@
package com.tangem.features.details.component.preview
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import com.tangem.features.details.component.UserWalletListComponent
internal class PreviewUserWalletListComponent : UserWalletListComponent {
@Composable
@Suppress("TopLevelComposableFunctions") // TODO: Remove this check
override fun View(modifier: Modifier) {
TODO("Will be implemented in [REDACTED_TASK_KEY]")
}
}

View file

@ -0,0 +1,16 @@
package com.tangem.features.details.component.preview
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import com.tangem.features.details.component.WalletConnectComponent
internal class PreviewWalletConnectComponent : WalletConnectComponent {
override suspend fun checkIsAvailable(): Boolean = true
@Composable
@Suppress("TopLevelComposableFunctions") // TODO: Remove this check
override fun View(modifier: Modifier) {
TODO("Will be implemented in [REDACTED_TASK_KEY]")
}
}

View file

@ -0,0 +1,29 @@
package com.tangem.features.details.di
import com.tangem.core.featuretoggle.manager.FeatureTogglesManager
import com.tangem.features.details.DefaultDetailsFeatureToggles
import com.tangem.features.details.DetailsEntryPoint
import com.tangem.features.details.DetailsFeatureToggles
import com.tangem.features.details.DetailsFragment
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.components.SingletonComponent
import javax.inject.Singleton
@Module
@InstallIn(SingletonComponent::class)
internal object FeatureModule {
@Provides
@Singleton
fun provideFeatureToggles(featureTogglesManager: FeatureTogglesManager): DetailsFeatureToggles {
return DefaultDetailsFeatureToggles(featureTogglesManager)
}
@Provides
@Singleton
fun provideEntryPoint(): DetailsEntryPoint {
return DetailsFragment.Companion
}
}

View file

@ -0,0 +1,20 @@
package com.tangem.features.details.di
import com.tangem.core.decompose.di.DecomposeComponent
import com.tangem.core.decompose.model.Model
import com.tangem.features.details.model.DetailsModel
import dagger.Binds
import dagger.Module
import dagger.hilt.InstallIn
import dagger.multibindings.ClassKey
import dagger.multibindings.IntoMap
@Module
@InstallIn(DecomposeComponent::class)
internal interface ModelModule {
@Binds
@IntoMap
@ClassKey(DetailsModel::class)
fun provideDetailsModel(model: DetailsModel): Model
}

View file

@ -0,0 +1,17 @@
package com.tangem.features.details.entity
import androidx.annotation.DrawableRes
import kotlinx.collections.immutable.ImmutableList
internal data class DetailsFooterUM(
val appVersion: String,
val socials: ImmutableList<Social>,
) {
data class Social(
val id: String,
@DrawableRes
val iconResId: Int,
val onClick: () -> Unit,
)
}

View file

@ -0,0 +1,40 @@
package com.tangem.features.details.entity
import androidx.annotation.DrawableRes
import androidx.compose.runtime.Composable
import androidx.compose.runtime.Immutable
import androidx.compose.ui.Modifier
import com.tangem.core.ui.extensions.TextReference
import kotlinx.collections.immutable.ImmutableList
@Immutable
internal sealed class DetailsItemUM {
abstract val id: String
data class Basic(
override val id: String,
val items: ImmutableList<Item>,
) : DetailsItemUM() {
data class Item(
val title: TextReference,
@DrawableRes
val iconRes: Int,
val onClick: () -> Unit,
)
}
data class Component(
override val id: String,
val content: Content,
) : DetailsItemUM() {
fun interface Content {
@Composable
@Suppress("TopLevelComposableFunctions", "ComposableFunctionName")
operator fun invoke(modifier: Modifier)
}
}
}

View file

@ -0,0 +1,9 @@
package com.tangem.features.details.entity
import kotlinx.collections.immutable.ImmutableList
internal data class DetailsUM(
val items: ImmutableList<DetailsItemUM>,
val footer: DetailsFooterUM,
val popBack: () -> Unit,
)

View file

@ -0,0 +1,22 @@
package com.tangem.features.details.entity
import androidx.annotation.DrawableRes
import com.tangem.core.ui.extensions.TextReference
import com.tangem.domain.wallets.models.UserWalletId
import kotlinx.collections.immutable.ImmutableList
internal data class UserWalletListUM(
val userWallets: ImmutableList<UserWalletUM>,
val addNewWalletText: TextReference,
val onAddNewWalletClick: () -> Unit,
) {
data class UserWalletUM(
val id: UserWalletId,
val name: String,
val information: TextReference,
@DrawableRes
val imageResId: Int,
val onClick: () -> Unit,
)
}

View file

@ -0,0 +1,10 @@
package com.tangem.features.details.model
import com.tangem.core.decompose.model.Model
import com.tangem.utils.coroutines.CoroutineDispatcherProvider
import javax.inject.Inject
// TODO: Will be implemented later
internal class DetailsModel @Inject constructor(
override val dispatchers: CoroutineDispatcherProvider,
) : Model()