File tree Expand file tree Collapse file tree 5 files changed +13
-7
lines changed
app/src/main/kotlin/com/ninecraft/booket/di
data/impl/src/main/kotlin/com/ninecraft/booket/core/data/impl/di
di/src/main/kotlin/com/ninecraft/booket/core/di
network/src/main/kotlin/com/ninecraft/booket/core/network Expand file tree Collapse file tree 5 files changed +13
-7
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ import android.app.Service
66import android.content.Context
77import com.ninecraft.booket.core.di.DataScope
88import dev.zacsweers.metro.AppScope
9+ import dev.zacsweers.metro.Binds
910import dev.zacsweers.metro.DependencyGraph
1011import dev.zacsweers.metro.Multibinds
1112import dev.zacsweers.metro.Provider
@@ -18,8 +19,11 @@ import kotlin.reflect.KClass
1819)
1920interface AppGraph {
2021
21- @Provides
22- fun provideApplicationContext (application : Application ): Context = application
22+ // @Provides
23+ // fun provideApplicationContext(application: Application): Context = application
24+
25+ @Binds
26+ fun bindContext (application : Application ): Context
2327
2428 @Multibinds(allowEmpty = true )
2529 val activityProviders: Map <KClass <out Activity >, Provider <Activity >>
Original file line number Diff line number Diff line change @@ -31,4 +31,4 @@ interface DataGraph {
3131
3232 @Binds
3333 val DefaultUserRepository .bind: UserRepository
34- }
34+ }
Original file line number Diff line number Diff line change @@ -7,4 +7,4 @@ import kotlin.reflect.KClass
77/* * A [MapKey] annotation for binding Activities in a multibinding map. */
88@MapKey
99@Target(AnnotationTarget .CLASS )
10- annotation class ActivityKey (val value : KClass <out Activity >)
10+ annotation class ActivityKey (val value : KClass <out Activity >)
Original file line number Diff line number Diff line change @@ -6,4 +6,4 @@ import kotlin.reflect.KClass
66
77@MapKey
88@Target(AnnotationTarget .CLASS )
9- annotation class ServiceKey (val value : KClass <out Service >)
9+ annotation class ServiceKey (val value : KClass <out Service >)
Original file line number Diff line number Diff line change @@ -18,7 +18,8 @@ import okhttp3.Route
1818@Inject
1919class TokenAuthenticator (
2020 private val tokenDataSource : TokenDataSource ,
21- private val serviceProvider : Provider <ReedService >,
21+ // private val serviceProvider: Provider<ReedService>,
22+ private val serviceLazy : Lazy <ReedService >,
2223) : Authenticator {
2324 override fun authenticate (route : Route ? , response : Response ): Request ? {
2425 return runBlocking {
@@ -32,7 +33,8 @@ class TokenAuthenticator(
3233 }
3334
3435 val refreshTokenRequest = RefreshTokenRequest (refreshToken)
35- val refreshResponse = serviceProvider().refreshToken(refreshTokenRequest)
36+ // val refreshResponse = serviceProvider().refreshToken(refreshTokenRequest)
37+ val refreshResponse = serviceLazy.value.refreshToken(refreshTokenRequest)
3638
3739 tokenDataSource.apply {
3840 setAccessToken(refreshResponse.accessToken)
You can’t perform that action at this time.
0 commit comments