feat(CON-221) : [UI] - Mocl trad request
This commit is contained in:
@ -20,26 +20,29 @@ android {
|
||||
buildTypes {
|
||||
debug {
|
||||
isMinifyEnabled = false
|
||||
isShrinkResources = false
|
||||
}
|
||||
|
||||
release {
|
||||
isMinifyEnabled = true
|
||||
isShrinkResources = true
|
||||
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
|
||||
}
|
||||
}
|
||||
|
||||
flavorDimensions += "version"
|
||||
productFlavors {
|
||||
create("prod") {
|
||||
dimension = "data"
|
||||
dimension = "version"
|
||||
}
|
||||
|
||||
create("demo") {
|
||||
dimension = "data"
|
||||
dimension = "version"
|
||||
}
|
||||
}
|
||||
|
||||
buildFeatures {
|
||||
buildConfig = true
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility = JavaVersion.VERSION_11
|
||||
targetCompatibility = JavaVersion.VERSION_11
|
||||
|
@ -1,19 +0,0 @@
|
||||
package fr.openium.consentium.api
|
||||
|
||||
import dagger.Module
|
||||
import dagger.Provides
|
||||
import dagger.hilt.InstallIn
|
||||
import dagger.hilt.components.SingletonComponent
|
||||
import fr.openium.consentium.data.remote.ConsentiumApi
|
||||
import fr.openium.consentium.api.mock.ConsentiumMockApi
|
||||
|
||||
@Module
|
||||
@InstallIn(SingletonComponent::class)
|
||||
internal class ApiModule {
|
||||
|
||||
@Provides
|
||||
fun provideConsentiumApi(): ConsentiumApi {
|
||||
return ConsentiumMockApi
|
||||
}
|
||||
|
||||
}
|
@ -7,6 +7,8 @@ import dagger.Provides
|
||||
import dagger.Reusable
|
||||
import dagger.hilt.InstallIn
|
||||
import dagger.hilt.components.SingletonComponent
|
||||
import fr.openium.consentium.BuildConfig
|
||||
import fr.openium.consentium.api.mock.ConsentiumMockApi
|
||||
import fr.openium.consentium.data.remote.ConsentiumApi
|
||||
import kotlinx.serialization.json.Json
|
||||
import okhttp3.Cache
|
||||
@ -54,11 +56,14 @@ object NetworkModule {
|
||||
internal fun provideConsentiumApi(
|
||||
@ConsentiumUrl url: HttpUrl,
|
||||
@OkHttpClientDefault okHttpClient: Lazy<OkHttpClient>,
|
||||
): ConsentiumApi =
|
||||
): ConsentiumApi = if (BuildConfig.FLAVOR != "demo") {
|
||||
createRetrofit(
|
||||
url,
|
||||
okHttpClient
|
||||
).create(ConsentiumApi::class.java)
|
||||
} else {
|
||||
ConsentiumMockApi
|
||||
}
|
||||
|
||||
private fun createRetrofit(url: HttpUrl, okHttpClient: Lazy<OkHttpClient>): Retrofit =
|
||||
Retrofit.Builder()
|
||||
|
Reference in New Issue
Block a user