31 lines
998 B
Kotlin
Raw Normal View History

2023-07-08 02:17:19 -06:00
package com.isolaatti.posting
2023-02-11 23:41:23 -06:00
2023-02-12 01:31:16 -06:00
import com.isolaatti.connectivity.RetrofitClient
2023-07-15 20:58:57 -06:00
import com.isolaatti.posting.posts.data.remote.FeedsApi
import com.isolaatti.posting.posts.data.remote.PostApi
2023-07-08 02:17:19 -06:00
import com.isolaatti.posting.posts.data.repository.PostsRepositoryImpl
import com.isolaatti.posting.posts.domain.PostsRepository
2023-02-12 01:31:16 -06:00
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.components.SingletonComponent
import retrofit2.create
2023-02-12 01:31:16 -06:00
@Module
@InstallIn(SingletonComponent::class)
2023-02-11 23:41:23 -06:00
class Module {
2023-02-12 01:31:16 -06:00
@Provides
2023-07-15 20:58:57 -06:00
fun providePostsApi(retrofitClient: RetrofitClient): FeedsApi {
return retrofitClient.client.create(FeedsApi::class.java)
2023-02-12 01:31:16 -06:00
}
@Provides
fun providePostApi(retrofitClient: RetrofitClient): PostApi {
return retrofitClient.client.create(PostApi::class.java)
}
@Provides
fun providePostsRepository(feedsApi: FeedsApi, postApi: PostApi): PostsRepository {
return PostsRepositoryImpl(feedsApi, postApi)
2023-02-12 01:31:16 -06:00
}
2023-02-11 23:41:23 -06:00
}