feat(CON-221) : [UI] - Mock trad request #9
@ -66,6 +66,18 @@ android {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
flavorDimensions += "version"
|
||||||
|
productFlavors {
|
||||||
|
create("prod") {
|
||||||
|
dimension = "version"
|
||||||
|
}
|
||||||
|
|
||||||
|
create("demo") {
|
||||||
|
dimension = "version"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
compileOptions {
|
compileOptions {
|
||||||
sourceCompatibility = JavaVersion.VERSION_11
|
sourceCompatibility = JavaVersion.VERSION_11
|
||||||
targetCompatibility = JavaVersion.VERSION_11
|
targetCompatibility = JavaVersion.VERSION_11
|
||||||
@ -98,7 +110,6 @@ dependencies {
|
|||||||
implementation(libs.clarity)
|
implementation(libs.clarity)
|
||||||
implementation(libs.ga4)
|
implementation(libs.ga4)
|
||||||
|
|
||||||
|
|
||||||
// Compose
|
// Compose
|
||||||
implementation(platform(libs.compose.bom))
|
implementation(platform(libs.compose.bom))
|
||||||
implementation(libs.bundles.compose)
|
implementation(libs.bundles.compose)
|
||||||
|
@ -22,6 +22,22 @@ android {
|
|||||||
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
|
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
flavorDimensions += "version"
|
||||||
|
productFlavors {
|
||||||
|
create("prod") {
|
||||||
|
dimension = "version"
|
||||||
|
}
|
||||||
|
|
||||||
|
create("demo") {
|
||||||
|
dimension = "version"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
buildFeatures {
|
||||||
|
buildConfig = true
|
||||||
|
}
|
||||||
|
|
||||||
compileOptions {
|
compileOptions {
|
||||||
sourceCompatibility = JavaVersion.VERSION_11
|
sourceCompatibility = JavaVersion.VERSION_11
|
||||||
targetCompatibility = JavaVersion.VERSION_11
|
targetCompatibility = JavaVersion.VERSION_11
|
||||||
|
@ -8,6 +8,8 @@ import dagger.hilt.InstallIn
|
|||||||
import dagger.hilt.components.SingletonComponent
|
import dagger.hilt.components.SingletonComponent
|
||||||
import fr.openium.consentium.data.di.ConsentiumUrl
|
import fr.openium.consentium.data.di.ConsentiumUrl
|
||||||
import fr.openium.consentium.data.di.OkHttpClientDefault
|
import fr.openium.consentium.data.di.OkHttpClientDefault
|
||||||
|
import fr.openium.consentium_ui.BuildConfig
|
||||||
|
import fr.openium.consentium_ui.api.mock.ConsentiumUIMockApi
|
||||||
import fr.openium.consentium_ui.data.remote.ConsentiumUIApi
|
import fr.openium.consentium_ui.data.remote.ConsentiumUIApi
|
||||||
import kotlinx.serialization.json.Json
|
import kotlinx.serialization.json.Json
|
||||||
import okhttp3.HttpUrl
|
import okhttp3.HttpUrl
|
||||||
@ -32,11 +34,14 @@ internal object NetworkModule {
|
|||||||
fun provideConsentiumUIApi(
|
fun provideConsentiumUIApi(
|
||||||
@ConsentiumUrl url: HttpUrl,
|
@ConsentiumUrl url: HttpUrl,
|
||||||
@OkHttpClientDefault okHttpClient: Lazy<OkHttpClient>,
|
@OkHttpClientDefault okHttpClient: Lazy<OkHttpClient>,
|
||||||
): ConsentiumUIApi =
|
): ConsentiumUIApi = if (BuildConfig.FLAVOR != "demo") {
|
||||||
createRetrofit(
|
createRetrofit(
|
||||||
url,
|
url,
|
||||||
okHttpClient
|
okHttpClient
|
||||||
).create(ConsentiumUIApi::class.java)
|
).create(ConsentiumUIApi::class.java)
|
||||||
|
} else {
|
||||||
|
ConsentiumUIMockApi
|
||||||
|
}
|
||||||
|
|
||||||
private fun createRetrofit(url: HttpUrl, okHttpClient: Lazy<OkHttpClient>): Retrofit =
|
private fun createRetrofit(url: HttpUrl, okHttpClient: Lazy<OkHttpClient>): Retrofit =
|
||||||
Retrofit.Builder()
|
Retrofit.Builder()
|
||||||
|
@ -0,0 +1,25 @@
|
|||||||
|
package fr.openium.consentium_ui.api.mock
|
||||||
|
|
||||||
|
import fr.openium.consentium_ui.data.remote.ConsentiumUIApi
|
||||||
|
import fr.openium.consentium_ui.data.remote.model.GetConsentConfigDTO
|
||||||
|
import retrofit2.Response
|
||||||
|
import java.util.UUID
|
||||||
|
|
||||||
|
internal object ConsentiumUIMockApi : ConsentiumUIApi {
|
||||||
|
|
||||||
|
private val consents = GetConsentConfigDTO(
|
||||||
|
installationId = UUID.randomUUID().toString(),
|
||||||
|
appName = "Consentium",
|
||||||
|
icon = "https://www.example.com/icon.png",
|
||||||
|
primaryColor = "#FF0000",
|
||||||
|
secondaryColor = "#00FF00",
|
||||||
|
textColor = "#0000FF",
|
||||||
|
consentMainTextTranslation = emptyList(),
|
||||||
|
purposes = emptyList(),
|
||||||
|
)
|
||||||
|
|
||||||
|
override suspend fun getConsentConfig(applicationID: String, installationID: String): Response<GetConsentConfigDTO> {
|
||||||
|
return Response.success(consents)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -20,26 +20,29 @@ android {
|
|||||||
buildTypes {
|
buildTypes {
|
||||||
debug {
|
debug {
|
||||||
isMinifyEnabled = false
|
isMinifyEnabled = false
|
||||||
isShrinkResources = false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
release {
|
release {
|
||||||
isMinifyEnabled = true
|
isMinifyEnabled = true
|
||||||
isShrinkResources = true
|
|
||||||
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
|
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
flavorDimensions += "version"
|
||||||
productFlavors {
|
productFlavors {
|
||||||
create("prod") {
|
create("prod") {
|
||||||
dimension = "data"
|
dimension = "version"
|
||||||
}
|
}
|
||||||
|
|
||||||
create("demo") {
|
create("demo") {
|
||||||
dimension = "data"
|
dimension = "version"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
buildFeatures {
|
||||||
|
buildConfig = true
|
||||||
|
}
|
||||||
|
|
||||||
compileOptions {
|
compileOptions {
|
||||||
sourceCompatibility = JavaVersion.VERSION_11
|
sourceCompatibility = JavaVersion.VERSION_11
|
||||||
targetCompatibility = 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.Reusable
|
||||||
import dagger.hilt.InstallIn
|
import dagger.hilt.InstallIn
|
||||||
import dagger.hilt.components.SingletonComponent
|
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 fr.openium.consentium.data.remote.ConsentiumApi
|
||||||
import kotlinx.serialization.json.Json
|
import kotlinx.serialization.json.Json
|
||||||
import okhttp3.Cache
|
import okhttp3.Cache
|
||||||
@ -54,11 +56,14 @@ object NetworkModule {
|
|||||||
internal fun provideConsentiumApi(
|
internal fun provideConsentiumApi(
|
||||||
@ConsentiumUrl url: HttpUrl,
|
@ConsentiumUrl url: HttpUrl,
|
||||||
@OkHttpClientDefault okHttpClient: Lazy<OkHttpClient>,
|
@OkHttpClientDefault okHttpClient: Lazy<OkHttpClient>,
|
||||||
): ConsentiumApi =
|
): ConsentiumApi = if (BuildConfig.FLAVOR != "demo") {
|
||||||
createRetrofit(
|
createRetrofit(
|
||||||
url,
|
url,
|
||||||
okHttpClient
|
okHttpClient
|
||||||
).create(ConsentiumApi::class.java)
|
).create(ConsentiumApi::class.java)
|
||||||
|
} else {
|
||||||
|
ConsentiumMockApi
|
||||||
|
}
|
||||||
|
|
||||||
private fun createRetrofit(url: HttpUrl, okHttpClient: Lazy<OkHttpClient>): Retrofit =
|
private fun createRetrofit(url: HttpUrl, okHttpClient: Lazy<OkHttpClient>): Retrofit =
|
||||||
Retrofit.Builder()
|
Retrofit.Builder()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user