This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@AppScope | |
@Component | |
interface AppComponent { | |
val userComponentFactory: UserComponent.Factory | |
@Component.Factory | |
interface Factory { | |
fun create(@BindsInstance context: Context): AppComponent | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Presenter<S>(state: S) { | |
private val _state = BehaviorRelay.createDefault(state) | |
val state: Observable get() = _state | |
protected fun setState(reducer: S.() -> S) { | |
// Enforce main thread to avoid synchronization | |
// | |
val oldState = stateRelay.value!! | |
stateRelay.accept(oldState.reducer()) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@AppScope | |
@Component(modules = [..., MessageModule::class]) | |
interface AppComponentImpl : AppComponent, Feature1AppComponent, Feature2AppComponent, ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@AppScope | |
@Component(modules = [..., MessageModule::class]) | |
interface AppComponentImpl : AppComponent, Feature1AppComponent, Feature2AppComponent, ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface Feature1AppComponent : AppComponent { <------ | |
val messageRepository: MessageRepository | |
} | |
@ChatControllerScope | |
@Component( | |
dependencies = [Feature1AppComponent::class], <------ | |
modules = [Feature1ControllerModule::class] | |
) | |
internal interface Feature1ControllerComponent { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Feature1ControllerScope | |
@Component(dependencies = [???::class], modules = [Feature1Module::class]) | |
interface Feature1ControllerComponent { | |
val viewModel: InviteViewModel | |
... | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:app | |
_______________/__________________ | |
/ / / / | |
:feature1 :feature2 :feature3 ... :featureN | |
/_________/________/______________/ | |
/ / / | |
:messages / / | |
/____________/______________/ | |
/ | |
:base |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface Feature1AppComponent : AppComponent { | |
val messageRepository: MessageRepository | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:app | |
_______________/__________________ | |
/ / / / | |
:feature1 :feature2 :feature3 ... :featureN | |
/_________/________/______________/ | |
/ | |
:base |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Module | |
object MessageModule { | |
@AppScope | |
@Provides | |
@JvmStatic | |
fun messageRepository(...): MessageRepository { | |
return MessageRepository(...) | |
} | |
} |
NewerOlder