Colton Idle
07/20/2020, 12:53 AMgildor
07/20/2020, 1:51 AMgildor
07/20/2020, 1:52 AMgildor
07/20/2020, 1:54 AMDavid
07/20/2020, 12:47 PM@Singleton
provided dependency or just something owned by android.app.Application
will get you there.
e.g. “request scope” => a function param that you could just leave Dagger out of completely (the whole DI is pattern, not a library and all that) or if you wanted to then inject that in other functions then that’s got a snazzy name, Assisted Inject.
I’ve rarely found myself needing to write @LoggedInScope
made famous by the Uber-Ribs example way back then. It was complicated and confused me.Colton Idle
07/21/2020, 2:08 AMgildor
07/21/2020, 2:11 AMWhat about scoping across multiple activities@Colton Idle You can do this, but problem that it’s not so easy not because of dagger, but because lifecycle of Android Essentially, to have a scope between multiple activites it should be created and managed on Application level So there is no issue to create subcomponent/component on application level for this particular scope, it just become a problem that you cannot use any activity/fragment/view dependencies in such approach, only application level + your scope
everyone wants to just scope things to an activity/VM or fragment/VMIt happens mostly because of 2 reasons 1. Hard to avoid limitation of android lifecycle, and most. natural and practical apporach is follow android components lifecycle 2. It require boilerplate code to create custom scopes (aka components/subcomponents for a scope), so usually amount of scopes limited, because first you need to register this scope and provide a way to access it on level of your activity/fragment/view model Tho, approach with “Logged In User scope” is quite common and it usually subcomponent of application scope
gildor
07/21/2020, 2:12 AMdemystify certain things in HiltWhat kind things? Hilt docs are explain philisophy and structure of it pretty well
gildor
07/21/2020, 2:14 AMit can be used not only with Ribs, also ribs is single-activity approach, so it doesn’t have issues with activities lifecycle But also require quite a lot of boilerplate (which partially solved by code generators to generate those components)made famous by the Uber-Ribs example way back then@LoggedInScope
Colton Idle
07/21/2020, 2:29 AMgildor
07/21/2020, 2:33 AMgildor
07/21/2020, 2:34 AMgildor
07/21/2020, 2:34 AM