Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -20,33 +20,40 @@ package com.infomaniak.auth.ui.screen.onboarding
import androidx.annotation.RawRes
import androidx.annotation.StringRes
import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.pager.PagerState
import androidx.compose.foundation.pager.rememberPagerState
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import com.infomaniak.auth.R
import com.infomaniak.auth.ui.images.AppImages.AppIllus
import com.infomaniak.auth.ui.images.illus.blueBlur.BlueBlur
import com.infomaniak.auth.ui.images.illus.shieldPerson.ShieldPerson
import com.infomaniak.auth.ui.theme.AuthenticatorTheme
import com.infomaniak.core.onboarding.OnboardingPage
import com.infomaniak.core.onboarding.OnboardingScaffold
import com.infomaniak.core.onboarding.components.OnboardingComponents.DefaultTitleAndDescription
import com.infomaniak.core.onboarding.components.OnboardingComponents.ThemedDotLottie
import com.infomaniak.core.onboarding.models.OnboardingLottieSource
import com.infomaniak.core.ui.compose.preview.PreviewSmallWindow
import com.infomaniak.core.ui.compose.theme.LocalIsThemeDarkMode
import com.infomaniak.core.ui.compose.theme.ThemedImage

internal enum class Page(
val background: IllustrationResource,
val illustration: IllustrationResource,
@StringRes val titleRes: Int,
@StringRes val descriptionRes: Int,
) {
Login(
background = IllustrationResource.Vector(AppIllus.BlueBlur),
illustration = IllustrationResource.Vector(AppIllus.ShieldPerson),
titleRes = R.string.onBoardingLoginTitle,
descriptionRes = R.string.onBoardingLoginDescription
Expand All @@ -71,7 +78,6 @@ internal fun Page.toOnboardingPage(pagerState: PagerState, index: Int) = Onboard
private fun Page.OnboardingPageIllustration(pagerState: PagerState, index: Int) {
Box {
val isCurrentPageVisible = { pagerState.currentPage == index }
RenderIllustration(background, isCurrentPageVisible)
RenderIllustration(illustration, isCurrentPageVisible)
}
}
Expand All @@ -81,7 +87,13 @@ private fun RenderIllustration(resource: IllustrationResource, isCurrentPageVisi
when (resource) {
is IllustrationResource.Vector -> {
Image(
modifier = Modifier.size(350.dp),
modifier = Modifier
.size(350.dp)
.background(
Brush.radialGradient(
colors = listOf(AuthenticatorTheme.colors.illustrationBackgroundGradient, Color.Transparent),
)
),
imageVector = resource.themedImage.image(),
contentDescription = null,
)
Expand All @@ -104,3 +116,27 @@ internal sealed class IllustrationResource {
val themeIdDark: String? = null,
) : IllustrationResource()
}

@PreviewSmallWindow
@Composable
private fun OnboardingPagePreview() {
val pagerState = rememberPagerState(pageCount = { 1 })
val page = Page.Login.toOnboardingPage(pagerState = pagerState, index = 0)

AuthenticatorTheme {
OnboardingScaffold(
pagerState = pagerState,
onboardingPages = listOf(page),
bottomContent = {
Box(
modifier = Modifier
.height(100.dp)
.fillMaxWidth()
.background(Color.LightGray)
) {
Text("Bottom content")
}
},
)
}
}
7 changes: 5 additions & 2 deletions app/src/main/kotlin/com/infomaniak/auth/ui/theme/Color.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package com.infomaniak.auth.ui.theme

import androidx.compose.ui.graphics.Color

val primaryLight = Color(0xFF525A92)
val primaryLight = Color(0xFF2B39A8)
val onPrimaryLight = Color(0xFFFFFFFF)
val primaryContainerLight = Color(0xFFDFE0FF)
val onPrimaryContainerLight = Color(0xFF3A4279)
Expand Down Expand Up @@ -38,7 +38,7 @@ val surfaceContainerLight = Color(0xFFEFEDF4)
val surfaceContainerHighLight = Color(0xFFE9E7EF)
val surfaceContainerHighestLight = Color(0xFFE4E1E9)

val primaryDark = Color(0xFFBBC3FF)
val primaryDark = Color(0xFFBCC2FF)
val onPrimaryDark = Color(0xFF232C61)
val primaryContainerDark = Color(0xFF3A4279)
val onPrimaryContainerDark = Color(0xFFDFE0FF)
Expand Down Expand Up @@ -73,3 +73,6 @@ val surfaceContainerLowDark = Color(0xFF1B1B21)
val surfaceContainerDark = Color(0xFF1F1F25)
val surfaceContainerHighDark = Color(0xFF29292F)
val surfaceContainerHighestDark = Color(0xFF34343A)

// Custom primitives
val productSecurity = Color(0xFF5869D9)
37 changes: 37 additions & 0 deletions app/src/main/kotlin/com/infomaniak/auth/ui/theme/CustomColor.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* Infomaniak Authenticator - Android
* Copyright (C) 2026 Infomaniak Network SA
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.infomaniak.auth.ui.theme

import androidx.compose.runtime.Immutable
import androidx.compose.ui.graphics.Color

@Immutable
data class CustomColorScheme(
val illustrationBackgroundGradient: Color = Color.Unspecified
)

private val illustrationBackgroundGradientLight = lightScheme.primary.copy(alpha = 0.28f)
private val illustrationBackgroundGradientDark = productSecurity.copy(alpha = 0.6f)

val lightCustomScheme = CustomColorScheme(
illustrationBackgroundGradient = illustrationBackgroundGradientLight
)

val darkCustomScheme = CustomColorScheme(
illustrationBackgroundGradient = illustrationBackgroundGradientDark
)
Loading
Loading