Skip to content

Commit

Permalink
add DSK marker
Browse files Browse the repository at this point in the history
  • Loading branch information
arnaudgiuliani committed Dec 14, 2022
1 parent fa69977 commit 91397a9
Show file tree
Hide file tree
Showing 35 changed files with 907 additions and 429 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import org.koin.android.logger.AndroidLogger
import org.koin.core.KoinApplication
import org.koin.core.annotation.KoinInternalApi
import org.koin.core.logger.Level
import org.koin.core.module.KoinApplicationDslMarker
import org.koin.core.registry.saveProperties
import org.koin.dsl.bind
import org.koin.dsl.binds
Expand All @@ -39,6 +40,7 @@ import java.util.*
* @param level
*/
@OptIn(KoinInternalApi::class)
@KoinApplicationDslMarker
fun KoinApplication.androidLogger(
level: Level = Level.INFO,
): KoinApplication {
Expand All @@ -50,6 +52,7 @@ fun KoinApplication.androidLogger(
* Add Context instance to Koin container
* @param androidContext - Context
*/
@KoinApplicationDslMarker
fun KoinApplication.androidContext(androidContext: Context): KoinApplication {
if (koin.logger.isAt(Level.INFO)) {
koin.logger.info("[init] declare Android Context")
Expand All @@ -74,6 +77,7 @@ fun KoinApplication.androidContext(androidContext: Context): KoinApplication {
* @param koinPropertyFile
*/
@OptIn(KoinInternalApi::class)
@KoinApplicationDslMarker
fun KoinApplication.androidFileProperties(
koinPropertyFile: String = "koin.properties",
): KoinApplication {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ package org.koin.androidx.fragment.dsl

import androidx.fragment.app.Fragment
import org.koin.core.annotation.KoinInternalApi
import org.koin.core.module.KoinDefinition
import org.koin.core.definition.KoinDefinition
import org.koin.core.module.KoinDslMarker
import org.koin.core.module.Module
import org.koin.core.module.dsl.*

Expand All @@ -30,6 +31,7 @@ import org.koin.core.module.dsl.*
* @author Arnaud Giuliani
* @see new
*/
@KoinDslMarker
inline fun <reified R : Fragment> Module.fragmentOf(
crossinline constructor: () -> R,
noinline options: DefinitionOptions<R>? = null,
Expand All @@ -38,6 +40,7 @@ inline fun <reified R : Fragment> Module.fragmentOf(
/**
* @see fragmentOf
*/
@KoinDslMarker
inline fun <reified R : Fragment, reified T1> Module.fragmentOf(
crossinline constructor: (T1) -> R,
noinline options: DefinitionOptions<R>? = null,
Expand All @@ -46,6 +49,7 @@ inline fun <reified R : Fragment, reified T1> Module.fragmentOf(
/**
* @see fragmentOf
*/
@KoinDslMarker
inline fun <reified R : Fragment, reified T1, reified T2> Module.fragmentOf(
crossinline constructor: (T1, T2) -> R,
noinline options: DefinitionOptions<R>? = null,
Expand All @@ -54,6 +58,7 @@ inline fun <reified R : Fragment, reified T1, reified T2> Module.fragmentOf(
/**
* @see fragmentOf
*/
@KoinDslMarker
inline fun <reified R : Fragment, reified T1, reified T2, reified T3> Module.fragmentOf(
crossinline constructor: (T1, T2, T3) -> R,
noinline options: DefinitionOptions<R>? = null,
Expand All @@ -62,6 +67,7 @@ inline fun <reified R : Fragment, reified T1, reified T2, reified T3> Module.fra
/**
* @see fragmentOf
*/
@KoinDslMarker
inline fun <reified R : Fragment, reified T1, reified T2, reified T3, reified T4> Module.fragmentOf(
crossinline constructor: (T1, T2, T3, T4) -> R,
noinline options: DefinitionOptions<R>? = null,
Expand All @@ -70,6 +76,7 @@ inline fun <reified R : Fragment, reified T1, reified T2, reified T3, reified T4
/**
* @see fragmentOf
*/
@KoinDslMarker
inline fun <reified R : Fragment, reified T1, reified T2, reified T3, reified T4, reified T5> Module.fragmentOf(
crossinline constructor: (T1, T2, T3, T4, T5) -> R,
noinline options: DefinitionOptions<R>? = null,
Expand All @@ -78,6 +85,7 @@ inline fun <reified R : Fragment, reified T1, reified T2, reified T3, reified T4
/**
* @see fragmentOf
*/
@KoinDslMarker
inline fun <reified R : Fragment, reified T1, reified T2, reified T3, reified T4, reified T5, reified T6> Module.fragmentOf(
crossinline constructor: (T1, T2, T3, T4, T5, T6) -> R,
noinline options: DefinitionOptions<R>? = null,
Expand All @@ -86,6 +94,7 @@ inline fun <reified R : Fragment, reified T1, reified T2, reified T3, reified T4
/**
* @see fragmentOf
*/
@KoinDslMarker
inline fun <reified R : Fragment, reified T1, reified T2, reified T3, reified T4, reified T5, reified T6, reified T7> Module.fragmentOf(
crossinline constructor: (T1, T2, T3, T4, T5, T6, T7) -> R,
noinline options: DefinitionOptions<R>? = null,
Expand All @@ -94,6 +103,7 @@ inline fun <reified R : Fragment, reified T1, reified T2, reified T3, reified T4
/**
* @see fragmentOf
*/
@KoinDslMarker
inline fun <reified R : Fragment, reified T1, reified T2, reified T3, reified T4, reified T5, reified T6, reified T7, reified T8> Module.fragmentOf(
crossinline constructor: (T1, T2, T3, T4, T5, T6, T7, T8) -> R,
noinline options: DefinitionOptions<R>? = null,
Expand All @@ -102,6 +112,7 @@ inline fun <reified R : Fragment, reified T1, reified T2, reified T3, reified T4
/**
* @see fragmentOf
*/
@KoinDslMarker
inline fun <reified R : Fragment, reified T1, reified T2, reified T3, reified T4, reified T5, reified T6, reified T7, reified T8, reified T9> Module.fragmentOf(
crossinline constructor: (T1, T2, T3, T4, T5, T6, T7, T8, T9) -> R,
noinline options: DefinitionOptions<R>? = null,
Expand All @@ -110,6 +121,7 @@ inline fun <reified R : Fragment, reified T1, reified T2, reified T3, reified T4
/**
* @see fragmentOf
*/
@KoinDslMarker
inline fun <reified R : Fragment, reified T1, reified T2, reified T3, reified T4, reified T5, reified T6, reified T7, reified T8, reified T9, reified T10> Module.fragmentOf(
crossinline constructor: (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10) -> R,
noinline options: DefinitionOptions<R>? = null,
Expand All @@ -118,95 +130,107 @@ inline fun <reified R : Fragment, reified T1, reified T2, reified T3, reified T4
/**
* @see fragmentOf
*/
inline fun <reified R : Fragment, reified T1, reified T2, reified T3, reified T4, reified T5, reified T6, reified T7, reified T8, reified T9, reified T10, reified T11> Module.viewModelOf(
@KoinDslMarker
inline fun <reified R : Fragment, reified T1, reified T2, reified T3, reified T4, reified T5, reified T6, reified T7, reified T8, reified T9, reified T10, reified T11> Module.fragmentOf(
crossinline constructor: (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11) -> R,
noinline options: DefinitionOptions<R>? = null,
): KoinDefinition<R> = fragment { new(constructor) }.onOptions(options)

/**
* @see fragmentOf
*/
inline fun <reified R : Fragment, reified T1, reified T2, reified T3, reified T4, reified T5, reified T6, reified T7, reified T8, reified T9, reified T10, reified T11, reified T12> Module.viewModelOf(
@KoinDslMarker
inline fun <reified R : Fragment, reified T1, reified T2, reified T3, reified T4, reified T5, reified T6, reified T7, reified T8, reified T9, reified T10, reified T11, reified T12> Module.fragmentOf(
crossinline constructor: (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12) -> R,
noinline options: DefinitionOptions<R>? = null,
): KoinDefinition<R> = fragment { new(constructor) }.onOptions(options)

/**
* @see fragmentOf
*/
inline fun <reified R : Fragment, reified T1, reified T2, reified T3, reified T4, reified T5, reified T6, reified T7, reified T8, reified T9, reified T10, reified T11, reified T12, reified T13> Module.viewModelOf(
@KoinDslMarker
inline fun <reified R : Fragment, reified T1, reified T2, reified T3, reified T4, reified T5, reified T6, reified T7, reified T8, reified T9, reified T10, reified T11, reified T12, reified T13> Module.fragmentOf(
crossinline constructor: (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13) -> R,
noinline options: DefinitionOptions<R>? = null,
): KoinDefinition<R> = fragment { new(constructor) }.onOptions(options)

/**
* @see fragmentOf
*/
inline fun <reified R : Fragment, reified T1, reified T2, reified T3, reified T4, reified T5, reified T6, reified T7, reified T8, reified T9, reified T10, reified T11, reified T12, reified T13, reified T14> Module.viewModelOf(
@KoinDslMarker
inline fun <reified R : Fragment, reified T1, reified T2, reified T3, reified T4, reified T5, reified T6, reified T7, reified T8, reified T9, reified T10, reified T11, reified T12, reified T13, reified T14> Module.fragmentOf(
crossinline constructor: (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14) -> R,
noinline options: DefinitionOptions<R>? = null,
): KoinDefinition<R> = fragment { new(constructor) }.onOptions(options)

/**
* @see fragmentOf
*/
inline fun <reified R : Fragment, reified T1, reified T2, reified T3, reified T4, reified T5, reified T6, reified T7, reified T8, reified T9, reified T10, reified T11, reified T12, reified T13, reified T14, reified T15> Module.viewModelOf(
@KoinDslMarker
inline fun <reified R : Fragment, reified T1, reified T2, reified T3, reified T4, reified T5, reified T6, reified T7, reified T8, reified T9, reified T10, reified T11, reified T12, reified T13, reified T14, reified T15> Module.fragmentOf(
crossinline constructor: (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15) -> R,
noinline options: DefinitionOptions<R>? = null,
): KoinDefinition<R> = fragment { new(constructor) }.onOptions(options)

/**
* @see fragmentOf
*/
inline fun <reified R : Fragment, reified T1, reified T2, reified T3, reified T4, reified T5, reified T6, reified T7, reified T8, reified T9, reified T10, reified T11, reified T12, reified T13, reified T14, reified T15, reified T16> Module.viewModelOf(
@KoinDslMarker
inline fun <reified R : Fragment, reified T1, reified T2, reified T3, reified T4, reified T5, reified T6, reified T7, reified T8, reified T9, reified T10, reified T11, reified T12, reified T13, reified T14, reified T15, reified T16> Module.fragmentOf(
crossinline constructor: (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16) -> R,
noinline options: DefinitionOptions<R>? = null,
): KoinDefinition<R> = fragment { new(constructor) }.onOptions(options)

/**
* @see fragmentOf
*/
inline fun <reified R : Fragment, reified T1, reified T2, reified T3, reified T4, reified T5, reified T6, reified T7, reified T8, reified T9, reified T10, reified T11, reified T12, reified T13, reified T14, reified T15, reified T16, reified T17> Module.viewModelOf(
@KoinDslMarker
inline fun <reified R : Fragment, reified T1, reified T2, reified T3, reified T4, reified T5, reified T6, reified T7, reified T8, reified T9, reified T10, reified T11, reified T12, reified T13, reified T14, reified T15, reified T16, reified T17> Module.fragmentOf(
crossinline constructor: (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17) -> R,
noinline options: DefinitionOptions<R>? = null,
): KoinDefinition<R> = fragment { new(constructor) }.onOptions(options)

/**
* @see fragmentOf
*/
inline fun <reified R : Fragment, reified T1, reified T2, reified T3, reified T4, reified T5, reified T6, reified T7, reified T8, reified T9, reified T10, reified T11, reified T12, reified T13, reified T14, reified T15, reified T16, reified T17, reified T18> Module.viewModelOf(
@KoinDslMarker
inline fun <reified R : Fragment, reified T1, reified T2, reified T3, reified T4, reified T5, reified T6, reified T7, reified T8, reified T9, reified T10, reified T11, reified T12, reified T13, reified T14, reified T15, reified T16, reified T17, reified T18> Module.fragmentOf(
crossinline constructor: (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18) -> R,
noinline options: DefinitionOptions<R>? = null,
): KoinDefinition<R> = fragment { new(constructor) }.onOptions(options)

/**
* @see fragmentOf
*/
inline fun <reified R : Fragment, reified T1, reified T2, reified T3, reified T4, reified T5, reified T6, reified T7, reified T8, reified T9, reified T10, reified T11, reified T12, reified T13, reified T14, reified T15, reified T16, reified T17, reified T18, reified T19> Module.viewModelOf(
@KoinDslMarker
inline fun <reified R : Fragment, reified T1, reified T2, reified T3, reified T4, reified T5, reified T6, reified T7, reified T8, reified T9, reified T10, reified T11, reified T12, reified T13, reified T14, reified T15, reified T16, reified T17, reified T18, reified T19> Module.fragmentOf(
crossinline constructor: (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19) -> R,
noinline options: DefinitionOptions<R>? = null,
): KoinDefinition<R> = fragment { new(constructor) }.onOptions(options)

/**
* @see fragmentOf
*/
inline fun <reified R : Fragment, reified T1, reified T2, reified T3, reified T4, reified T5, reified T6, reified T7, reified T8, reified T9, reified T10, reified T11, reified T12, reified T13, reified T14, reified T15, reified T16, reified T17, reified T18, reified T19, reified T20> Module.viewModelOf(
@KoinDslMarker
inline fun <reified R : Fragment, reified T1, reified T2, reified T3, reified T4, reified T5, reified T6, reified T7, reified T8, reified T9, reified T10, reified T11, reified T12, reified T13, reified T14, reified T15, reified T16, reified T17, reified T18, reified T19, reified T20> Module.fragmentOf(
crossinline constructor: (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20) -> R,
noinline options: DefinitionOptions<R>? = null,
): KoinDefinition<R> = fragment { new(constructor) }.onOptions(options)

/**
* @see fragmentOf
*/
inline fun <reified R : Fragment, reified T1, reified T2, reified T3, reified T4, reified T5, reified T6, reified T7, reified T8, reified T9, reified T10, reified T11, reified T12, reified T13, reified T14, reified T15, reified T16, reified T17, reified T18, reified T19, reified T20, reified T21> Module.viewModelOf(
@KoinDslMarker
inline fun <reified R : Fragment, reified T1, reified T2, reified T3, reified T4, reified T5, reified T6, reified T7, reified T8, reified T9, reified T10, reified T11, reified T12, reified T13, reified T14, reified T15, reified T16, reified T17, reified T18, reified T19, reified T20, reified T21> Module.fragmentOf(
crossinline constructor: (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21) -> R,
noinline options: DefinitionOptions<R>? = null,
): KoinDefinition<R> = fragment { new(constructor) }.onOptions(options)

/**
* @see fragmentOf
*/
inline fun <reified R : Fragment, reified T1, reified T2, reified T3, reified T4, reified T5, reified T6, reified T7, reified T8, reified T9, reified T10, reified T11, reified T12, reified T13, reified T14, reified T15, reified T16, reified T17, reified T18, reified T19, reified T20, reified T21, reified T22> Module.viewModelOf(
@KoinDslMarker
inline fun <reified R : Fragment, reified T1, reified T2, reified T3, reified T4, reified T5, reified T6, reified T7, reified T8, reified T9, reified T10, reified T11, reified T12, reified T13, reified T14, reified T15, reified T16, reified T17, reified T18, reified T19, reified T20, reified T21, reified T22> Module.fragmentOf(
crossinline constructor: (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22) -> R,
noinline options: DefinitionOptions<R>? = null,
): KoinDefinition<R> = fragment { new(constructor) }.onOptions(options)
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,10 @@ package org.koin.androidx.fragment.dsl

import androidx.fragment.app.Fragment
import org.koin.core.annotation.KoinReflectAPI
import org.koin.core.definition.BeanDefinition
import org.koin.core.definition.Definition
import org.koin.core.instance.InstanceFactory
import org.koin.core.definition.KoinDefinition
import org.koin.core.instance.newInstance
import org.koin.core.module.KoinDefinition
import org.koin.core.module.KoinDslMarker
import org.koin.core.module.Module
import org.koin.core.qualifier.Qualifier

Expand All @@ -34,6 +33,7 @@ import org.koin.core.qualifier.Qualifier
* @param qualifier - definition qualifier
* @param override - allow definition override
*/
@KoinDslMarker
inline fun <reified T : Fragment> Module.fragment(
qualifier: Qualifier? = null,
noinline definition: Definition<T>
Expand Down
Loading

0 comments on commit 91397a9

Please sign in to comment.