Add some refactoring and first simple test on RoomListPresenter
This commit is contained in:
parent
b3aa9f7ba2
commit
1f2a9026ea
30 changed files with 520 additions and 140 deletions
|
|
@ -18,16 +18,16 @@
|
|||
@Suppress("DSL_SCOPE_VIOLATION")
|
||||
plugins {
|
||||
id("io.element.android-compose-library")
|
||||
alias(libs.plugins.molecule)
|
||||
}
|
||||
|
||||
android {
|
||||
namespace = "io.element.android.x.libraries.presentation"
|
||||
namespace = "io.element.android.x.libraries.architecture"
|
||||
}
|
||||
|
||||
dependencies {
|
||||
api(project(":libraries:core"))
|
||||
api(project(":libraries:di"))
|
||||
api(libs.dagger)
|
||||
api(libs.appyx.core)
|
||||
api(libs.molecule.runtime)
|
||||
api(libs.androidx.lifecycle.runtime)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@ package io.element.android.x.architecture
|
|||
import android.content.Context
|
||||
import android.content.ContextWrapper
|
||||
import com.bumble.appyx.core.node.Node
|
||||
import io.element.android.x.core.di.DaggerComponentOwner
|
||||
|
||||
inline fun <reified T : Any> Node.bindings() = bindings(T::class.java)
|
||||
inline fun <reified T : Any> Context.bindings() = bindings(T::class.java)
|
||||
|
|
@ -28,7 +27,7 @@ fun <T : Any> Context.bindings(klass: Class<T>): T {
|
|||
// search dagger components in the context hierarchy
|
||||
return generateSequence(this) { (it as? ContextWrapper)?.baseContext }
|
||||
.plus(applicationContext)
|
||||
.filterIsInstance<DaggerComponentOwner>()
|
||||
.filterIsInstance<io.element.android.x.di.DaggerComponentOwner>()
|
||||
.map { it.daggerComponent }
|
||||
.flatMap { if (it is Collection<*>) it else listOf(it) }
|
||||
.filterIsInstance(klass)
|
||||
|
|
@ -39,7 +38,7 @@ fun <T : Any> Context.bindings(klass: Class<T>): T {
|
|||
fun <T : Any> Node.bindings(klass: Class<T>): T {
|
||||
// search dagger components in node hierarchy
|
||||
return generateSequence(this, Node::parent)
|
||||
.filterIsInstance<DaggerComponentOwner>()
|
||||
.filterIsInstance<io.element.android.x.di.DaggerComponentOwner>()
|
||||
.map { it.daggerComponent }
|
||||
.flatMap { if (it is Collection<*>) it else listOf(it) }
|
||||
.filterIsInstance(klass)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue