-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #43 from stslex/dev
Store refactor
- Loading branch information
Showing
14 changed files
with
165 additions
and
78 deletions.
There are no files selected for viewing
37 changes: 37 additions & 0 deletions
37
core/ui/src/androidMain/kotlin/com/stslex/wizard/core/ui/viewModel/ViewModelBean.android.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package com.stslex.wizard.core.ui.viewModel | ||
|
||
import androidx.lifecycle.ViewModel | ||
import org.koin.androidx.viewmodel.dsl.viewModelOf | ||
import org.koin.core.definition.BeanDefinition | ||
import org.koin.core.definition.KoinDefinition | ||
import org.koin.core.module.Module | ||
|
||
actual inline fun <reified R : ViewModel> Module.viewModelOf( | ||
crossinline constructor: () -> R, | ||
noinline options: (BeanDefinition<R>.() -> Unit)?, | ||
): KoinDefinition<R> = viewModelOf(constructor, options) | ||
|
||
actual inline fun <reified R : ViewModel, reified T1> Module.viewModelOf( | ||
crossinline constructor: (T1) -> R, | ||
noinline options: (BeanDefinition<R>.() -> Unit)?, | ||
): KoinDefinition<R> = viewModelOf(constructor, options) | ||
|
||
actual inline fun <reified R : ViewModel, reified T1, reified T2> Module.viewModelOf( | ||
crossinline constructor: (T1, T2) -> R, | ||
noinline options: (BeanDefinition<R>.() -> Unit)?, | ||
): KoinDefinition<R> = viewModelOf(constructor, options) | ||
|
||
actual inline fun <reified R : ViewModel, reified T1, reified T2, reified T3> Module.viewModelOf( | ||
crossinline constructor: (T1, T2, T3) -> R, | ||
noinline options: (BeanDefinition<R>.() -> Unit)?, | ||
): KoinDefinition<R> = viewModelOf(constructor, options) | ||
|
||
actual inline fun <reified R : ViewModel, reified T1, reified T2, reified T3, reified T4> Module.viewModelOf( | ||
crossinline constructor: (T1, T2, T3, T4) -> R, | ||
noinline options: (BeanDefinition<R>.() -> Unit)?, | ||
): KoinDefinition<R> = viewModelOf(constructor, options) | ||
|
||
actual inline fun <reified R : ViewModel, reified T1, reified T2, reified T3, reified T4, reified T5> Module.viewModelOf( | ||
crossinline constructor: (T1, T2, T3, T4, T5) -> R, | ||
noinline options: (BeanDefinition<R>.() -> Unit)?, | ||
): KoinDefinition<R> = viewModelOf(constructor, options) |
36 changes: 36 additions & 0 deletions
36
core/ui/src/commonMain/kotlin/com/stslex/wizard/core/ui/mvi/StoreBean.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package com.stslex.wizard.core.ui.mvi | ||
|
||
import com.stslex.wizard.core.ui.viewModel.viewModelOf | ||
import org.koin.core.definition.BeanDefinition | ||
import org.koin.core.definition.KoinDefinition | ||
import org.koin.core.module.Module | ||
|
||
inline fun <reified R : Store<*, *, *, *>> Module.storeOf( | ||
crossinline constructor: () -> R, | ||
noinline options: (BeanDefinition<R>.() -> Unit)? = null, | ||
): KoinDefinition<R> = viewModelOf(constructor, options) | ||
|
||
inline fun <reified R : Store<*, *, *, *>, reified T1> Module.storeOf( | ||
crossinline constructor: (T1) -> R, | ||
noinline options: (BeanDefinition<R>.() -> Unit)? = null, | ||
): KoinDefinition<R> = viewModelOf(constructor, options) | ||
|
||
inline fun <reified R : Store<*, *, *, *>, reified T1, reified T2> Module.storeOf( | ||
crossinline constructor: (T1, T2) -> R, | ||
noinline options: (BeanDefinition<R>.() -> Unit)? = null, | ||
): KoinDefinition<R> = viewModelOf(constructor, options) | ||
|
||
inline fun <reified R : Store<*, *, *, *>, reified T1, reified T2, reified T3> Module.storeOf( | ||
crossinline constructor: (T1, T2, T3) -> R, | ||
noinline options: (BeanDefinition<R>.() -> Unit)? = null, | ||
): KoinDefinition<R> = viewModelOf(constructor, options) | ||
|
||
inline fun <reified R : Store<*, *, *, *>, reified T1, reified T2, reified T3, reified T4> Module.storeOf( | ||
crossinline constructor: (T1, T2, T3, T4) -> R, | ||
noinline options: (BeanDefinition<R>.() -> Unit)? = null, | ||
): KoinDefinition<R> = viewModelOf(constructor, options) | ||
|
||
inline fun <reified R : Store<*, *, *, *>, reified T1, reified T2, reified T3, reified T4, reified T5> Module.storeOf( | ||
crossinline constructor: (T1, T2, T3, T4, T5) -> R, | ||
noinline options: (BeanDefinition<R>.() -> Unit)? = null, | ||
): KoinDefinition<R> = viewModelOf(constructor, options) |
36 changes: 36 additions & 0 deletions
36
core/ui/src/commonMain/kotlin/com/stslex/wizard/core/ui/viewModel/ViewModelBean.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package com.stslex.wizard.core.ui.viewModel | ||
|
||
import androidx.lifecycle.ViewModel | ||
import org.koin.core.definition.BeanDefinition | ||
import org.koin.core.definition.KoinDefinition | ||
import org.koin.core.module.Module | ||
|
||
expect inline fun <reified R : ViewModel> Module.viewModelOf( | ||
crossinline constructor: () -> R, | ||
noinline options: (BeanDefinition<R>.() -> Unit)? = null, | ||
): KoinDefinition<R> | ||
|
||
expect inline fun <reified R : ViewModel, reified T1> Module.viewModelOf( | ||
crossinline constructor: (T1) -> R, | ||
noinline options: (BeanDefinition<R>.() -> Unit)? = null, | ||
): KoinDefinition<R> | ||
|
||
expect inline fun <reified R : ViewModel, reified T1, reified T2> Module.viewModelOf( | ||
crossinline constructor: (T1, T2) -> R, | ||
noinline options: (BeanDefinition<R>.() -> Unit)? = null, | ||
): KoinDefinition<R> | ||
|
||
expect inline fun <reified R : ViewModel, reified T1, reified T2, reified T3> Module.viewModelOf( | ||
crossinline constructor: (T1, T2, T3) -> R, | ||
noinline options: (BeanDefinition<R>.() -> Unit)? = null, | ||
): KoinDefinition<R> | ||
|
||
expect inline fun <reified R : ViewModel, reified T1, reified T2, reified T3, reified T4> Module.viewModelOf( | ||
crossinline constructor: (T1, T2, T3, T4) -> R, | ||
noinline options: (BeanDefinition<R>.() -> Unit)? = null, | ||
): KoinDefinition<R> | ||
|
||
expect inline fun <reified R : ViewModel, reified T1, reified T2, reified T3, reified T4, reified T5> Module.viewModelOf( | ||
crossinline constructor: (T1, T2, T3, T4, T5) -> R, | ||
noinline options: (BeanDefinition<R>.() -> Unit)? = null, | ||
): KoinDefinition<R> |
37 changes: 37 additions & 0 deletions
37
core/ui/src/iosMain/kotlin/com/stslex/wizard/core/ui/viewModel/ViewModelBean.ios.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package com.stslex.wizard.core.ui.viewModel | ||
|
||
import androidx.lifecycle.ViewModel | ||
import org.koin.core.definition.BeanDefinition | ||
import org.koin.core.definition.KoinDefinition | ||
import org.koin.core.module.Module | ||
import org.koin.core.module.dsl.factoryOf | ||
|
||
actual inline fun <reified R : ViewModel> Module.viewModelOf( | ||
crossinline constructor: () -> R, | ||
noinline options: (BeanDefinition<R>.() -> Unit)?, | ||
): KoinDefinition<R> = factoryOf(constructor, options) | ||
|
||
actual inline fun <reified R : ViewModel, reified T1> Module.viewModelOf( | ||
crossinline constructor: (T1) -> R, | ||
noinline options: (BeanDefinition<R>.() -> Unit)?, | ||
): KoinDefinition<R> = factoryOf(constructor, options) | ||
|
||
actual inline fun <reified R : ViewModel, reified T1, reified T2> Module.viewModelOf( | ||
crossinline constructor: (T1, T2) -> R, | ||
noinline options: (BeanDefinition<R>.() -> Unit)?, | ||
): KoinDefinition<R> = factoryOf(constructor, options) | ||
|
||
actual inline fun <reified R : ViewModel, reified T1, reified T2, reified T3> Module.viewModelOf( | ||
crossinline constructor: (T1, T2, T3) -> R, | ||
noinline options: (BeanDefinition<R>.() -> Unit)?, | ||
): KoinDefinition<R> = factoryOf(constructor, options) | ||
|
||
actual inline fun <reified R : ViewModel, reified T1, reified T2, reified T3, reified T4> Module.viewModelOf( | ||
crossinline constructor: (T1, T2, T3, T4) -> R, | ||
noinline options: (BeanDefinition<R>.() -> Unit)?, | ||
): KoinDefinition<R> = factoryOf(constructor, options) | ||
|
||
actual inline fun <reified R : ViewModel, reified T1, reified T2, reified T3, reified T4, reified T5> Module.viewModelOf( | ||
crossinline constructor: (T1, T2, T3, T4, T5) -> R, | ||
noinline options: (BeanDefinition<R>.() -> Unit)?, | ||
): KoinDefinition<R> = factoryOf(constructor, options) |
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
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
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
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
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
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
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
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
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
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