This file contains 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 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 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 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 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 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 = [AppComponent::class], modules = [Feature1Module::class]) | |
interface Feature1ControllerComponent { | |
val viewModel: InviteViewModel | |
@Component.Factory | |
interface Factory { | |
fun create( | |
appComponent: AppComponent | |
): Feature1ControllerComponent |
This file contains 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 App : Application(), AppComponentProvider { | |
private lateinit var _appComponent: AppComponentImpl | |
override fun onCreate() { | |
super.onCreate() | |
_appComponent = DaggerAppComponentImpl.factory().create() | |
} | |
override fun appComponent(): AppComponent { |
This file contains 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 AppComponent { | |
val messageRepository: MessageRepository | |
val conversationRepository: ConversationRepository | |
} | |
interface AppComponentProvider { | |
fun appComponent(): AppComponent | |
} |
This file contains 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 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 | |
} |
NewerOlder