Updated on 2026-08-14
This commit is contained in:
parent
5299629221
commit
2fb5b86505
107 changed files with 228 additions and 227 deletions
|
|
@ -2,7 +2,7 @@ package com.tangem.core.decompose.context
|
|||
|
||||
import com.arkivanov.decompose.ComponentContext
|
||||
import com.arkivanov.essenty.instancekeeper.getOrCreate
|
||||
import com.tangem.core.decompose.di.DecomposeComponent
|
||||
import com.tangem.core.decompose.di.ModelComponent
|
||||
import com.tangem.core.decompose.navigation.AppNavigationProvider
|
||||
import com.tangem.core.decompose.navigation.DefaultAppNavigationProvider
|
||||
import com.tangem.core.decompose.navigation.DefaultRouter
|
||||
|
|
@ -15,7 +15,7 @@ import kotlinx.coroutines.CoroutineScope
|
|||
class DefaultAppComponentContext(
|
||||
componentContext: ComponentContext,
|
||||
override val dispatchers: CoroutineDispatcherProvider,
|
||||
override val hiltComponentBuilder: DecomposeComponent.Builder,
|
||||
override val hiltComponentBuilder: ModelComponent.Builder,
|
||||
override val messageSender: UiMessageSender,
|
||||
private val replaceRouter: Router? = null,
|
||||
) : AppComponentContext, ComponentContext by componentContext {
|
||||
|
|
|
|||
|
|
@ -1,9 +0,0 @@
|
|||
package com.tangem.core.decompose.di
|
||||
|
||||
/**
|
||||
* Annotation for marking a dependency as a component scoped.
|
||||
*
|
||||
* This means that the lifecycle of the dependency is limited to the lifecycle of the component it is attached to.
|
||||
*/
|
||||
@Retention(AnnotationRetention.SOURCE)
|
||||
annotation class ComponentScoped
|
||||
|
|
@ -8,5 +8,5 @@ interface HiltComponentBuilderOwner {
|
|||
/**
|
||||
* Provides access to the Hilt component builder instance.
|
||||
*/
|
||||
val hiltComponentBuilder: DecomposeComponent.Builder
|
||||
val hiltComponentBuilder: ModelComponent.Builder
|
||||
}
|
||||
|
|
@ -10,11 +10,11 @@ import dagger.hilt.components.SingletonComponent
|
|||
/**
|
||||
* Interface for the Decompose component.
|
||||
*
|
||||
* It is annotated as [ComponentScoped], meaning it has a lifecycle that is scoped to the component.
|
||||
* It is annotated as [ModelScoped], meaning it has a lifecycle that is scoped to the component.
|
||||
*/
|
||||
@ComponentScoped
|
||||
@ModelScoped
|
||||
@DefineComponent(parent = SingletonComponent::class)
|
||||
interface DecomposeComponent {
|
||||
interface ModelComponent {
|
||||
|
||||
/**
|
||||
* Builder interface for the component.
|
||||
|
|
@ -51,6 +51,6 @@ interface DecomposeComponent {
|
|||
*
|
||||
* @return The built Decompose component.
|
||||
*/
|
||||
fun build(): DecomposeComponent
|
||||
fun build(): ModelComponent
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
package com.tangem.core.decompose.di
|
||||
|
||||
import javax.inject.Scope
|
||||
|
||||
/**
|
||||
* Annotation for marking a dependency as a model scoped.
|
||||
*
|
||||
* This means that the lifecycle of the dependency is limited to the lifecycle of the component's model
|
||||
*/
|
||||
@Scope
|
||||
@Retention(AnnotationRetention.RUNTIME)
|
||||
annotation class ModelScoped
|
||||
|
|
@ -3,7 +3,7 @@ package com.tangem.core.decompose.model
|
|||
import com.arkivanov.essenty.instancekeeper.getOrCreate
|
||||
import com.arkivanov.essenty.instancekeeper.getOrCreateSimple
|
||||
import com.tangem.core.decompose.context.AppComponentContext
|
||||
import com.tangem.core.decompose.di.DecomposeComponent
|
||||
import com.tangem.core.decompose.di.ModelComponent
|
||||
import dagger.hilt.EntryPoint
|
||||
import dagger.hilt.EntryPoints
|
||||
import dagger.hilt.InstallIn
|
||||
|
|
@ -15,7 +15,7 @@ import javax.inject.Provider
|
|||
* It provides a map of model providers.
|
||||
*/
|
||||
@EntryPoint
|
||||
@InstallIn(DecomposeComponent::class)
|
||||
@InstallIn(ModelComponent::class)
|
||||
interface ModelsEntryPoint {
|
||||
|
||||
fun models(): Map<Class<*>, Provider<Model>>
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ package com.tangem.core.decompose.model
|
|||
/**
|
||||
* Lazy container for [Model] params.
|
||||
*
|
||||
* This contrainer can be accessed by DI because it's provided via [com.tangem.core.decompose.di.DecomposeComponent].
|
||||
* This contrainer can be accessed by DI because it's provided via [com.tangem.core.decompose.di.ModelComponent].
|
||||
* */
|
||||
interface ParamsContainer {
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue