Skip to content

Commit

Permalink
fix: cleanup and resolve app module startup crash
Browse files Browse the repository at this point in the history
- Assures that `AndroidScopeCompoent` is implemented in lifecycle drivers
  • Loading branch information
wax911 committed Oct 7, 2024
1 parent e4d3880 commit 01df0bd
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@ import androidx.appcompat.app.AppCompatActivity
import androidx.viewbinding.ViewBinding
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.MainScope
import org.koin.android.scope.AndroidScopeComponent
import org.koin.androidx.fragment.android.setupKoinFragmentFactory
import org.koin.androidx.scope.activityRetainedScope
import org.koin.core.component.KoinScopeComponent

abstract class AbstractActivity<B: ViewBinding> : AppCompatActivity(),
CoroutineScope by MainScope(), KoinScopeComponent {
CoroutineScope by MainScope(), AndroidScopeComponent {

override val scope by activityRetainedScope()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Job
import kotlinx.coroutines.MainScope
import kotlinx.coroutines.launch
import org.koin.android.scope.AndroidScopeComponent
import org.koin.androidx.scope.fragmentScope
import org.koin.core.component.KoinScopeComponent

abstract class AbstractFragment<B: ViewBinding>(@LayoutRes layoutId: Int) : Fragment(layoutId),
CoroutineScope by MainScope(), KoinScopeComponent {
CoroutineScope by MainScope(), AndroidScopeComponent {

override val scope by fragmentScope()

Expand Down
3 changes: 0 additions & 3 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
import org.gradle.accessors.dm.LibrariesForLibs
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmCompile

plugins {
`kotlin-dsl`
`maven-publish`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,17 @@ open class CorePlugin : Plugin<Project> {
* Inspecting available extensions
*/
private fun Project.availableExtensions() {
val extensionSchema = project.extensions.extensionsSchema
extensionSchema.forEach {
println("Available extension for module ${project.path}: ${it.name} -> ${it.publicType}")
extensions.extensionsSchema.forEach {
logger.lifecycle("Available extension for module ${project.path}: ${it.name} -> ${it.publicType}")
}
}

/**
* Inspecting available components
*/
private fun Project.availableComponents() {
val collectionSchema = project.components.asMap
collectionSchema.forEach {
println("Available component for module ${project.path}: ${it.key} -> ${it.value}")
components.forEach {
logger.lifecycle("Available component for module ${project.path}: ${it.name} -> ${it}")
}
}

Expand Down

0 comments on commit 01df0bd

Please sign in to comment.