Rohil Chodankar
04/16/2020, 7:19 AMgetKoin() : Koin {
return //custom koin instance maintained as a HashMap
}
but now once we have updated to 2.1.5 , we are again facing the issue. Is there a particular change in scoping in the latest release ?arnaud.giuliani
04/16/2020, 7:44 AMarnaud.giuliani
04/16/2020, 7:44 AMRohil Chodankar
04/16/2020, 7:49 AM// Koin set up
object WrapperClass {
private val koinInstanceMap = HashMap<String, Koin>()
fun init() {
koinapplication = koinApplication {
androidContext(context)
modules(modules)
}
val instance =. CustomInstance()
koinapplication.koin.declare(instance)
koinInstanceMap[Id] = koinapplication.koin
}
}
Class CustomInstance : KoinComponent {
fun getKoin() : Koin {
return koinInstanceMap[Id].koin
}
}
Rohil Chodankar
04/16/2020, 7:50 AMkoinInstanceMap
to hold both the koin instanceRohil Chodankar
04/16/2020, 8:05 AMarnaud.giuliani
04/16/2020, 1:13 PMarnaud.giuliani
04/16/2020, 1:13 PMRohil Chodankar
04/16/2020, 1:17 PMinit
function above receives a Configuration object. The consuming application calls init
twice with different configuration object as it needs two SDK instances. But the second configuration object overrides the first one whenever the dependency is providedRohil Chodankar
04/16/2020, 1:18 PMRohil Chodankar
04/16/2020, 1:22 PMfun getKoin() : Koin {
return koinInstanceMap[Id].koin
}
Since i am storing both the KoinApplication
instance, the overriding issue should not have occurred. @arnaud.giulianiarnaud.giuliani
04/16/2020, 2:45 PMarnaud.giuliani
04/16/2020, 2:45 PMRohil Chodankar
04/16/2020, 2:46 PMarnaud.giuliani
04/16/2020, 2:48 PMarnaud.giuliani
04/16/2020, 2:49 PMarnaud.giuliani
04/16/2020, 2:49 PMRohil Chodankar
04/16/2020, 2:51 PMRohil Chodankar
04/16/2020, 2:51 PMarnaud.giuliani
04/16/2020, 3:23 PMRohil Chodankar
04/16/2020, 3:25 PM