Created
August 11, 2020 08:03
-
-
Save yektasarioglu/7a16594d924e98b8a1117fd42a7d0906 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val appModule = module { | |
// Data Sources | |
single { DiskHealthInstitutionDataSource() } | |
single { RemoteHealthInstitutionDataSource() } | |
// Repositories | |
single { HealthInstitutionRepository(get(), get()) } | |
viewModel { HomeViewModel(get(), get()) } | |
} | |
val networkModule = module { | |
// Data Sources | |
single { RemoteDirectionDataSource(get()) } | |
// Repositories | |
single { DirectionsRepository(get()) } | |
single { | |
OkHttpClient().newBuilder() | |
.addInterceptor(HttpLoggingInterceptor().apply { | |
level = if (BuildConfig.DEBUG) HttpLoggingInterceptor.Level.BODY else HttpLoggingInterceptor.Level.NONE | |
}) | |
.connectTimeout(10000, TimeUnit.MILLISECONDS) | |
.readTimeout(10000, TimeUnit.MILLISECONDS) | |
.build() | |
} | |
// Services | |
single { | |
val retrofit = Retrofit.Builder() | |
.addConverterFactory(GsonConverterFactory.create()) | |
.baseUrl("https://mapapi.cloud.huawei.com/mapApi/") | |
.client(get()) | |
.build() | |
retrofit.create(DirectionsService::class.java) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment