arnaud.giuliani
02/23/2021, 1:05 PMarnaud.giuliani
02/26/2021, 8:15 AMatlantis210
03/18/2021, 10:12 AMFabio
03/29/2021, 10:06 PMinject()
) is not going to work.
I'd need ideas/alternatives, is there anything on your mind besides arrow-meta?
Btw if we used something like @Inject val coffeMaker:CoffeeMaker
then ksp could help with that, but that's a big change.
https://kotlinlang.slack.com/archives/C013BA8EQSE/p1617015188066500?thread_ts=1616440343.040500&cid=C013BA8EQSE
https://kotlinlang.slack.com/archives/C013BA8EQSE/p1617020934066700?thread_ts=1616440343.040500&cid=C013BA8EQSEPavel Sidyakin
04/02/2021, 9:07 AMinterface Dependencies {
val dependency0: Dependency0
val dependency1: Dependency1
...
}
The interface is provided to Koin outside.
We want to use DependencyX as a usual singleton dependency.
For now, we have to wrap each dependency into single() function. But this is not convenient: if we change Dependencies interface, we must change the module.
It would we great if Koin can use externally provided dependencies as his dependencies.
Motivation: component holder pattern https://proandroiddev.com/modularization-of-android-applications-in-2021-a79a590d5e5b
I tried to implement it, but the solution is weird. At least because I had to use internal property "definitions":
https://github.com/PavelSidyakin/WeatherForecast/blob/koin_experiments/feature/city_list/src/main/java/com/example/city_list/di/CityListComponentImpl.kt
Would you implement the functionality in the library? Or I can try to implement it. Can you recommend how to do it better?Fabio
04/05/2021, 7:46 AMFabio
04/13/2021, 11:09 AMJohn O'Reilly
05/04/2021, 4:57 PM- Variant 'jsApiElements-published' capability io.insert-koin:koin-core:3.0.1 declares a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'js':
- Incompatible because this component declares a usage of 'kotlin-api' of a component, as well as attribute 'org.jetbrains.kotlin.js.compiler' with value 'legacy' and the consumer needed a usage of 'kotlin-runtime' of a component, as well as attribute 'org.jetbrains.kotlin.js.compiler' with value 'ir'
John O'Reilly
05/04/2021, 6:28 PM./install_all.sh
I get errors like following
Cannot perform signing task ':koin-gradle-plugin:signReleasePublication' because it has no configured signatory
Also, I think I remember that snapshot builds where published somewhere?John O'Reilly
05/06/2021, 12:35 PMarnaud.giuliani
05/11/2021, 4:00 PMJohn O'Reilly
05/25/2021, 11:15 AMarnaud.giuliani
06/03/2021, 12:29 PMManikanta G
06/18/2021, 6:16 PMclass Navigator(fragmentManager:FragmentManager{
//some specific logic using fragmentManager
}
class NavigatorTaker(navigator:Navigator){
fun test(){
navigator.someFunction()
}
}
class VIewModdel(vall navigatorTaker:NavigatorTaker){
fun onLoad(){
navigatorTaker.test()
}
}
I cannoot just create my module like below:
module {
single<Navigator>(????how to provide the fragmentManager here as its available with my activity)
single<NavigatorTaker>(get())
viewmodel {.VIewModdel(get()) }
}
did anyone has already managed to tackle this issue... any help would be highly useful for me 🙇Alexander Zhukov
06/23/2021, 8:42 AMarnaud.giuliani
07/16/2021, 10:13 AMJgafner
08/02/2021, 11:04 AMJgafner
08/02/2021, 1:31 PMNacho Ruiz Martin
08/09/2021, 1:54 PMshahroz
09/10/2021, 11:23 AMburnoo
09/13/2021, 4:20 PMKoinContext
management works in @Composable
functions. I believe the configuration of the Application should be done in the top level composable. This way it is not dependent on Koin initialization in the application class, which allows for easy KoinContext
replacement in @Preview
composables and tests. It introduces a new API - Koin
and KoinScope
composables:
@Composable
fun Koin(
appDeclaration: KoinAppDeclaration? = null,
content: @Composable () -> Unit
) {
val koinApplication = koinApplication(appDeclaration)
CompositionLocalProvider(LocalKoin provides koinApplication.koin) {
content()
}
}
@Composable
fun KoinScope(
getScope: Koin.() -> Scope,
content: @Composable () -> Unit
) {
val koin = getKoin()
val scope = remember {
koin.getScope()
}
CompositionLocalProvider(LocalScope provides scope) {
content()
}
}
I’ve opened PR here with implementation and instrumented tests: https://github.com/InsertKoinIO/koin/pull/1178
On the screenshot there is an example how to use new API with Scope and Preview.
Pros:
- scopes works
- easy KoinContext
replacement in tests
- easy KoinContext
replacement in @Preview
composables
- no need to use application class (which may help with Compose Multiplatform support in the future)
- backward compatibility (using GlobalContext as default value)Michal Klimczak
09/23/2021, 7:36 AMarnaud.giuliani
10/05/2021, 7:51 AMyschimke
10/09/2021, 10:41 AMsingle { CoroutineScope(Dispatchers.Default + SupervisorJob() ) }
single<PeopleInSpaceRepositoryInterface>(createdAtStart = true) {
PeopleInSpaceRepository()
.also {
get<CoroutineScope>().launch {
it.fetchAndStorePeople()
}
}
}
arnaud.giuliani
10/21/2021, 2:05 PMkoinNavGraphViewModel()
function to scope a ViewModel to a given Nav GraphMarcello Galhardo
10/29/2021, 5:07 PMMarcello Galhardo
10/29/2021, 7:01 PMFragmentFactory
but I don’t find a way to inject the Koin’s ViewModelProvider.Factory
. The whole point of using FragmentFactory
is to be able to do constructor injection. Is there any way to inject the ViewModelProvider.Factory
in a Fragment
constructor using Koin?Slackbot
10/31/2021, 7:01 AMMarcello Galhardo
11/04/2021, 3:19 PMsingle
, factory
, viewModel
) to reduce the new
. I think that is OK because I don’t foresee many new binding definitions to be created in the future. That is how it would look like (see the picture for comparison):
factory(::RecoveryReminderViewModel)
Locally is already working, there is only one points that still concerns me: the namespace / auto complete might be a little polluted (see picture below). What do you think? If you don’t see a problem I think we can move forward and I can do PRs with it next days. Maybe someone else has other opinions here too. 🙂