Skip to content

Instantly share code, notes, and snippets.

@ajailani4
Created April 10, 2021 12:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ajailani4/f861634f73009a6b9115ae4d3c8f8f04 to your computer and use it in GitHub Desktop.
Save ajailani4/f861634f73009a6b9115ae4d3c8f8f04 to your computer and use it in GitHub Desktop.
@Module
@InstallIn(SingletonComponent::class)
class ApplicationModule {
@Provides
fun provideBaseUrl() = "https://api-mobilespecs.azharimm.tk/"
@Provides
@Singleton
fun provideRetrofit(BASE_URL: String): Retrofit =
Retrofit.Builder()
.addConverterFactory(MoshiConverterFactory.create())
.baseUrl(BASE_URL)
.build()
@Provides
@Singleton
fun provideApiService(retrofit: Retrofit): ApiService =
retrofit.create(ApiService::class.java)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment