Major code refactoring

Main goals are:
1. Ability to use mocks in unit tests instead of
having to setup mock web server as if it was an
integration test.
2. Cache Retrofit services in memory
3. Make it easier to read
4. Use OptIn where possible instead of propagating
Experimental* annotations everywhere
This commit is contained in:
Kirill Kamakin
2022-04-02 19:04:44 +05:00
parent 405d983a90
commit 7fc2887dc7
40 changed files with 533 additions and 676 deletions

View File

@@ -0,0 +1,20 @@
package gq.kirmanak.mealient.di
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.components.SingletonComponent
import okhttp3.Interceptor
import javax.inject.Singleton
@Module
@InstallIn(SingletonComponent::class)
object ReleaseModule {
// Release version of the application doesn't have any interceptors but this Set
// is required by Dagger, so an empty Set is provided here
// Use @JvmSuppressWildcards because otherwise dagger can't inject it (https://stackoverflow.com/a/43149382)
@Provides
@Singleton
fun provideInterceptors(): Set<@JvmSuppressWildcards Interceptor> = emptySet()
}