Merge pull request 'feat(CON-238) : Add webview for cookies policy' (#11) from feat-238 into develop
Reviewed-on: #11 Reviewed-by: Simon Tabaka <s.tabaka@openium.fr>
This commit is contained in:
commit
bf5f7b47b7
@ -24,7 +24,7 @@ internal object ConsentiumUIMockApi : ConsentiumUIApi {
|
||||
MainConsentTextTranslationDTO(
|
||||
id = "UUID",
|
||||
language = "fr",
|
||||
consentPageUrl = "https:consentium.fr",
|
||||
consentPageUrl = "https://www.openium.fr",
|
||||
mainConsentText = "<p>[Nom de l’application] utilise des cookies pour différents objectifs : faire fonctionner l’application, améliorer nos services en mesurant l’efficacité de nos contenus et afficher des publicités susceptibles de vous intéresser.<br></p>\n<p>En cliquant sur “Accepter et fermer”, vous acceptez cette utilisation sur l’application mobile. Vous pouvez également paramétrer vos choix en cliquant sur “Paramétrer mes choix” ou refuser ces cookies en cliquant sur “Continuer sans accepter”. Vous pouvez changer d’avis à tout moment depuis les paramètres de votre compte via l’onglet “Notifications et cookies”</p>\n",
|
||||
durationText = "<p>Nous conservons votre choix pendant 12 mois. Vous pouvez changer d’avis à tout moment depuis les paramètres de votre compte via l’onglet “Notification et cookies” tetetettetettetetstts</p>\n"
|
||||
)
|
||||
|
@ -10,6 +10,7 @@ import fr.openium.consentium_ui.ui.components.ConsentiumUIDetailConsentComponent
|
||||
import fr.openium.consentium_ui.ui.components.ConsentiumUIErrorComponent
|
||||
import fr.openium.consentium_ui.ui.components.ConsentiumUIGeneralConsentComponent
|
||||
import fr.openium.consentium_ui.ui.components.ConsentiumUILoadingComponent
|
||||
import fr.openium.consentium_ui.ui.components.ConsentiumUIWebview
|
||||
import fr.openium.consentium_ui.ui.model.ConsentiumPageUI
|
||||
import fr.openium.consentium_ui.ui.model.DetailConsentUI
|
||||
import fr.openium.consentium_ui.ui.model.LoadingElement
|
||||
@ -53,7 +54,7 @@ internal fun ConsentiumScreen(
|
||||
)
|
||||
}
|
||||
|
||||
ConsentiumPageUI.DETAILS_CONSENT -> {
|
||||
else -> {
|
||||
slideIn(
|
||||
initialOffset = { fullSize -> IntOffset(fullSize.width, 0) }
|
||||
).togetherWith(
|
||||
@ -92,6 +93,12 @@ internal fun ConsentiumScreen(
|
||||
loadingElement = loadingElement
|
||||
)
|
||||
}
|
||||
|
||||
ConsentiumPageUI.COOKIES_POLICY -> {
|
||||
ConsentiumUIWebview(
|
||||
url = state.detailConsentUI.cookiePolicyUrl
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ import fr.openium.consentium_ui.ui.model.PurposeUI
|
||||
internal fun ContentConfigData.toDetailConsentUI(): DetailConsentUI = DetailConsentUI(
|
||||
conservationDurationText = mainTextTranslation.first().durationText,
|
||||
purposes = purposes.sortedBy { it.order }.map { it.toPurposeUI() },
|
||||
cookiePolicyUrl = mainTextTranslation.first().consentPageUrl,
|
||||
)
|
||||
|
||||
internal fun DetailConsentUI.toPurposeChoices(): List<PurposeChoice> = purposes.map {
|
||||
|
@ -1,6 +1,7 @@
|
||||
package fr.openium.consentium_ui.ui.components
|
||||
|
||||
import android.widget.Toast
|
||||
import androidx.activity.compose.BackHandler
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.CompositionLocalProvider
|
||||
import androidx.compose.runtime.LaunchedEffect
|
||||
@ -70,6 +71,22 @@ fun ConsentiumComponent(
|
||||
}
|
||||
}
|
||||
|
||||
BackHandler {
|
||||
when {
|
||||
defaultLandingPage == ConsentiumPageUI.GENERAL_CONSENT && currentPage == ConsentiumPageUI.DETAILS_CONSENT -> {
|
||||
currentPage = ConsentiumPageUI.GENERAL_CONSENT
|
||||
}
|
||||
|
||||
currentPage == ConsentiumPageUI.COOKIES_POLICY -> {
|
||||
currentPage = ConsentiumPageUI.GENERAL_CONSENT
|
||||
}
|
||||
|
||||
else -> {
|
||||
onQuitConsent()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// View
|
||||
CompositionLocalProvider(
|
||||
LocalColors provides colors,
|
||||
@ -112,7 +129,7 @@ fun ConsentiumComponent(
|
||||
}
|
||||
},
|
||||
onClickCookiesPolicies = {
|
||||
// TODO Open cookies policies
|
||||
currentPage = ConsentiumPageUI.COOKIES_POLICY
|
||||
},
|
||||
)
|
||||
}
|
||||
|
@ -0,0 +1,28 @@
|
||||
package fr.openium.consentium_ui.ui.components
|
||||
|
||||
import android.view.ViewGroup
|
||||
import android.webkit.WebView
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.viewinterop.AndroidView
|
||||
|
||||
@Composable
|
||||
internal fun ConsentiumUIWebview(
|
||||
url: String,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
AndroidView(
|
||||
modifier = modifier,
|
||||
factory = {
|
||||
WebView(it).apply {
|
||||
layoutParams = ViewGroup.LayoutParams(
|
||||
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||
ViewGroup.LayoutParams.MATCH_PARENT
|
||||
)
|
||||
}
|
||||
},
|
||||
update = { webView ->
|
||||
webView.loadUrl(url)
|
||||
}
|
||||
)
|
||||
}
|
@ -2,5 +2,6 @@ package fr.openium.consentium_ui.ui.model
|
||||
|
||||
enum class ConsentiumPageUI {
|
||||
GENERAL_CONSENT,
|
||||
DETAILS_CONSENT
|
||||
DETAILS_CONSENT,
|
||||
COOKIES_POLICY,
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
package fr.openium.consentium_ui.ui.model
|
||||
|
||||
internal data class DetailConsentUI(
|
||||
val cookiePolicyUrl: String,
|
||||
val conservationDurationText: String,
|
||||
val purposes: List<PurposeUI>,
|
||||
)
|
Loading…
x
Reference in New Issue
Block a user