carloxavier
07/21/2022, 11:48 AMJonathan Willis
07/22/2022, 5:48 PMJonathan Willis
07/22/2022, 5:48 PM|- No definition found for class:'io.vertx.rxjava3.core.Vertx'. Check your definitions!
org.koin.core.error.NoBeanDefFoundException: |- No definition found for class:'io.vertx.rxjava3.core.Vertx'. Check your definitions!
Jonathan Willis
07/22/2022, 5:49 PM@JvmField
@RegisterExtension
val koinTestExtension = KoinTestExtension.create {
modules(
module {
single {
println("creating vertx instance")
Vertx.vertx()
println("done creating vertx intstance")
}
...
}
Jonathan Willis
07/22/2022, 5:55 PMYasutaka Kawamoto
07/24/2022, 5:16 AMJoe Altidore
07/25/2022, 10:14 AMimplementation("io.insert-koin:koin-core:3.2")
implementation("io.insert-koin:koin-ktor:3.2")
This block is having an error
install(Koin) {
/*logic here**/
}
Unresolved reference: KoinJakub Gwóźdź
07/29/2022, 7:08 AMsingle { … }
in them. Can I somehow ensure that if these singletons implement AutoCloseable, their `.close()`s will be called at stopKoin()
?Stylianos Gakis
07/30/2022, 7:48 PMsingle<MyInterfaceImpl1> { MyInterfaceImpl1() } bind MyInterface::class
I load that module using loadKoinModules
which acts as a functions that populates the global koin registry.
Then on another koin module I’m doing
single<SendHAnalyticsEventUseCase> {
val allInterf = getAll<MyInterface>().distinct()
Foo(allInterf)
}
However I figured that I am not getting those other interfaces on my getAll() and I am guessing this has to do with the order of how this is executed, as after I’ve added some Log.d in there it does fetch my other impls too 🤯
Is there a way to make this order more reliable or some approach where I can avoid this altogether? 🤔janvladimirmostert
07/30/2022, 8:07 PMsingle { Repository(get(named("remote")),get(named("local")))
where is that Repository instance actually stored?
and when I call
val repo : Reposity by inject
where is that instance being pulled from again?
is there any interesting magic happening here or is it literally keeping that instance in something like a hashmap?Zach
08/02/2022, 3:59 PMKoinApplication has not been started
. I followed the process for compose viewmodels in the documentation. Am I missing something?Austin Pederson
08/02/2022, 6:13 PMShervin
08/03/2022, 3:11 PM3.2.0
Is the stable version officially out? I can not see the release tag in github.Pedro Francisco de Sousa Neto
08/05/2022, 6:23 PMorg.koin.core.scope.Scope.throwDefinitionNotFound
in Firebase Crashlytics?
I always need to navigate by crash events page to check each stacktrace to identify if it’s a new broken code or existing one.Vasyl Dizhak
08/07/2022, 8:50 AMfun Application.webModule(koinModules: List<org.koin.core.module.Module> = listOf(applicationModule)) {
install(Koin) {
printLogger(level = <http://Level.INFO|Level.INFO>)
modules(koinModules)
}
val tracksController: TracksControllerInterface by inject()
configureRouting(tracksController)
}
In the tests I create the mock that I inject
private val tracksController = mockk<TracksController>()
private val testModule = module {
single<TracksControllerInterface> { tracksController }
}
@Test
fun `GET tracks returns list of available tracks`() = testApplication {
application {
stopKoin()
webModule(koinModules = listOf(testModule))
}
But I keep getting issue that Koin plugin was already installedbharath
08/10/2022, 6:37 AMviewModel { MainViewModel() }
in koin module and injecting the view model with
val mainViewModel: MainViewModel by viewModel()
val mainViewModel2 = getViewModel<MainViewModel>()
these both ways and setting value in one composable, and injected the same viewmodel in similar way in other composable, but instead of returning the existing instance it always returns new instance of that view model in the composable, can anyone help me with this?bharath
08/10/2022, 6:39 AMowner
& `scope`:
inline fun <_reified_ T : ViewModel> getViewModel(
qualifier: Qualifier? = null,
owner: ViewModelOwner = getComposeViewModelOwner(),
scope: Scope = GlobalContext.get().scopeRegistry.rootScope,
noinline parameters: ParametersDefinition? = null,
)
Where ViewModelOwner can be used to pass a StoreOwner (like navigation):
@Composable
fun getComposeViewModelOwner(): ViewModelOwner {
return ViewModelOwner.from(
LocalViewModelStoreOwner.current!!,
LocalSavedStateRegistryOwner.current
)
}bharath
08/10/2022, 6:39 AMLukasz Kalnik
08/12/2022, 12:42 PMbenkuly
08/31/2022, 6:43 AMLukasz Kalnik
09/02/2022, 12:08 PMRobert Jaros
09/04/2022, 1:05 PMkoin-ktor
works with Ktor server native target?Robert Jaros
09/11/2022, 5:56 AMMarcin Wisniowski
09/12/2022, 6:49 PMcamiloparradev
09/16/2022, 10:33 PM// Module
viewModel { MyViewModel() }
class MyViewModel : ViewModel() {
var feedId: Int by Delegates.notNull()
}
@Composable
fun MyComposable(myViewModel: MyViewModel = getViewModel(), feedId: Int) { // Using myViewModel with a specific feedId }
feeds.forEach {
MyComposable(feedId = it.feedId)
}
So each MyComposable
can have its own viewModel, but what seems to happen to me is that all MyComposable
are sharing the same instance of MyViewModel
. Like getViewModel()
is always providing the same instance. Am I right? Is there a way to provide different instances for each MyComposable
?mbonnin
09/19/2022, 1:59 PM"org.gradle.jvm.version": 11
?Javier
09/20/2022, 8:37 AMclark
09/20/2022, 5:40 PMGlobalContext
(at least on the JVM) is a top level object. Does this have any implications on process death on Android? Do you need to restart Koin after process death? If not, how does it work?jmfayard
09/22/2022, 7:52 AMsrc/main
I register things in Koin with the syntax singleOf(::RegisterUser)
When I run tests I have errors like 'NoSuchMethodError void xxx.RegisterUser.<init>(xxx.FirstClass, xxx.SecondClass)'
The error goes away if I add a blank line somewhere in src/main
therefore invalidating the cache.
Does that sounds familiar?aridder
09/22/2022, 1:28 PMaridder
09/22/2022, 1:28 PMorg.koin.core.error.DefinitionParameterException: No value found for type 'androidx.lifecycle.SavedStateHandle'
val appModule = module {
single { OfflineWorkerUtil }
single { OfflineWorkerUtil.zTRANSPORT_VIS_SRV_Entities }
single { DeliveryRepository(zTRANSPORT_VIS_SRV_Entities = get()) }
single { TransportRepository(zTRANSPORT_VIS_SRV_Entities = get()) }
viewModel { DeliveryViewModel(savedStateHandle = it.get(), deliveryRepository = get()) }
viewModel { params -> DeliveriesViewModel(savedStateHandle = params.get(), deliveryRepository = get()) }
viewModel { ScannerViewModel(savedStateHandle = it.get(), deliveryRepository = get()) }
viewModel { SettingsViewModel() }
viewModel { TransportViewModel(transportRepository = get()) }
}
composable(Screen.Transport.route) { navbackStackEntry ->
DeliveriesScreen(
deliveriesViewModel = getViewModel(),
navigateBack = { navController.navigateUp() },
navigateToDelivery = { transportId, deliveryNumber ->
navController.navigate(
Screen.Delivery.createRoute(
transportId,
deliveryNumber
)
)
}
)
}
John O'Reilly
09/22/2022, 1:31 PMaridder
09/22/2022, 1:32 PM