diff --git a/consentium/build.gradle.kts b/consentium/build.gradle.kts index 2290378..40e3717 100644 --- a/consentium/build.gradle.kts +++ b/consentium/build.gradle.kts @@ -18,11 +18,28 @@ android { } buildTypes { - release { + debug { isMinifyEnabled = false + isShrinkResources = false + } + + release { + isMinifyEnabled = true + isShrinkResources = true proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro") } } + + productFlavors { + create("prod") { + dimension = "data" + } + + create("demo") { + dimension = "data" + } + } + compileOptions { sourceCompatibility = JavaVersion.VERSION_11 targetCompatibility = JavaVersion.VERSION_11 diff --git a/consentium/src/demo/kotlin/fr/openium/consentium/api/ApiModule.kt b/consentium/src/demo/kotlin/fr/openium/consentium/api/ApiModule.kt new file mode 100644 index 0000000..445cfb2 --- /dev/null +++ b/consentium/src/demo/kotlin/fr/openium/consentium/api/ApiModule.kt @@ -0,0 +1,19 @@ +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 + } + +} \ No newline at end of file diff --git a/consentium/src/demo/kotlin/fr/openium/consentium/api/mock/ConsentiumMock.kt b/consentium/src/demo/kotlin/fr/openium/consentium/api/mock/ConsentiumMock.kt new file mode 100644 index 0000000..b935c61 --- /dev/null +++ b/consentium/src/demo/kotlin/fr/openium/consentium/api/mock/ConsentiumMock.kt @@ -0,0 +1,52 @@ +package fr.openium.consentium.api.mock + +import fr.openium.consentium.data.remote.ConsentiumApi +import fr.openium.consentium.data.remote.model.GetConsent +import fr.openium.consentium.data.remote.model.PatchConsent +import kotlinx.coroutines.delay +import retrofit2.Response +import java.util.UUID + +internal object ConsentiumMockApi : ConsentiumApi { + + private val consents = GetConsent.GetConsentPayloadDTO( + installationId = UUID.randomUUID().toString(), + purposes = listOf( + GetConsent.PurposeDTO( + identifier = "purpose-audience", + isRequired = true, + isAccepted = GetConsent.PurposeStatusDTO.ACCEPTED, + vendors = listOf( + GetConsent.VendorDTO( + identifier = "vendor-clarity", + isAccepted = true, + isRequired = true, + ), + GetConsent.VendorDTO( + identifier = "vendor-matomo", + isAccepted = true, + isRequired = false, + ) + ) + ), + GetConsent.PurposeDTO( + identifier = "purpose-required", + isRequired = true, + isAccepted = GetConsent.PurposeStatusDTO.REJECTED, + vendors = null + ), + ), + isValid = true + ) + + override suspend fun getConsents(applicationId: String, installationId: String): Response { + delay(500) + return Response.success(consents) + } + + override suspend fun setConsents(applicationId: String, patchConsent: PatchConsent.PatchConsentPayloadDTO): Response { + delay(500) + return Response.success(Unit) + } + +} \ No newline at end of file