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
21 changes: 12 additions & 9 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -121,15 +121,18 @@ sentry {
}

dependencies {
implementation(libs.infomaniak.core.auth)
implementation(libs.infomaniak.core.common)
implementation(libs.infomaniak.core.crossapplogin.front)
implementation(libs.infomaniak.core.onboarding)
implementation(libs.infomaniak.core.network)
implementation(libs.infomaniak.core.sentry)
implementation(libs.infomaniak.core.ui.compose.basics)
implementation(libs.infomaniak.core.ui.compose.preview)
implementation(libs.infomaniak.core.ui.compose.theme)
implementation(core.infomaniak.core.auth)
implementation(core.infomaniak.core.common)
implementation(core.infomaniak.core.crossapplogin.front)
implementation(core.infomaniak.core.onboarding)
implementation(core.infomaniak.core.network)
implementation(core.infomaniak.core.sentry)
implementation(core.infomaniak.core.ui.compose.basics)
implementation(core.infomaniak.core.ui.compose.basicbutton)
implementation(core.infomaniak.core.ui.compose.bottomstickybuttonscaffolds)
implementation(core.infomaniak.core.ui.compose.margin)
implementation(core.infomaniak.core.ui.compose.preview)
implementation(core.infomaniak.core.ui.compose.theme)

implementation(core.androidx.core.ktx)
implementation(libs.androidx.navigation3.ui)
Expand Down
133 changes: 133 additions & 0 deletions app/src/main/kotlin/com/infomaniak/auth/ui/components/Button.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
/*
* 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.components

import android.content.res.Configuration
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
import androidx.compose.material3.ButtonColors
import androidx.compose.material3.ButtonDefaults
import androidx.compose.material3.Icon
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.infomaniak.auth.R
import com.infomaniak.auth.ui.theme.AppDimens
import com.infomaniak.auth.ui.theme.AppShapes
import com.infomaniak.auth.ui.theme.AuthenticatorTheme
import com.infomaniak.core.ui.compose.basicbutton.BasicButton
import com.infomaniak.core.ui.compose.basics.Dimens
import com.infomaniak.core.ui.compose.basics.Typography
import com.infomaniak.core.ui.compose.margin.Margin

@Composable
fun LargeButton(
title: String,
modifier: Modifier = Modifier,
style: ButtonStyle = ButtonStyle.Primary,
enabled: () -> Boolean = { true },
showIndeterminateProgress: () -> Boolean = { false },
progress: (() -> Float)? = null,
onClick: () -> Unit,
imageVector: ImageVector? = null,
) {
BasicButton(
onClick = onClick,
modifier = modifier.height(AppDimens.LargeButtonHeight),
shape = AppShapes.LargeButtonShape,
colors = style.colors(),
enabled = enabled,
showIndeterminateProgress = showIndeterminateProgress,
progress = progress,
) {
imageVector?.let {
Icon(modifier = Modifier.size(Dimens.smallIconSize), imageVector = it, contentDescription = null)
Spacer(Modifier.width(Margin.Mini))
}
Text(text = title, style = Typography.bodyMedium)
}
}

enum class ButtonStyle(val colors: @Composable () -> ButtonColors) {
Primary({
ButtonDefaults.buttonColors(
containerColor = AuthenticatorTheme.materialColors.primary,
contentColor = AuthenticatorTheme.materialColors.onPrimary,
)
}),
Secondary({
ButtonDefaults.buttonColors(
containerColor = AuthenticatorTheme.materialColors.secondary,
contentColor = AuthenticatorTheme.materialColors.onSecondary,
)
}),
Tertiary({
ButtonDefaults.buttonColors(
containerColor = Color.Transparent,
contentColor = AuthenticatorTheme.materialColors.primary,
disabledContainerColor = Color.Transparent,
)
}),
}

@Preview(name = "Light", widthDp = 800)
@Preview(name = "Dark", widthDp = 800, uiMode = Configuration.UI_MODE_NIGHT_YES or Configuration.UI_MODE_TYPE_NORMAL)
@Composable
private fun LargeButtonPreview() {
AuthenticatorTheme {
Surface {
Column {
ButtonStyle.entries.forEach {
Row {
LargeButton(
title = stringResource(R.string.appName),
style = it,
onClick = {}
)
Spacer(Modifier.width(Margin.Mini))
LargeButton(
title = stringResource(R.string.appName),
style = it,
progress = { 0.3f },
onClick = {},
)

Spacer(Modifier.width(Margin.Mini))
LargeButton(
modifier = Modifier.width(250.dp),
title = stringResource(R.string.appName),
style = it,
onClick = {}
)
}
Spacer(Modifier.height(Margin.Medium))
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* 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.components

import androidx.compose.foundation.layout.Spacer
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier

/**
* Empty element for SpaceBetween logic to align another element
*/
@Composable
fun EmptyElement() {
Spacer(modifier = Modifier)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/*
* 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.components

import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.material3.Surface
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.unit.dp
import com.infomaniak.auth.ui.images.AppImages
import com.infomaniak.auth.ui.images.illus.shieldPerson.ShieldPerson
import com.infomaniak.auth.ui.theme.AuthenticatorTheme
import com.infomaniak.core.ui.compose.margin.Margin
import com.infomaniak.core.ui.compose.preview.PreviewLightAndDark
import com.infomaniak.core.ui.compose.theme.ThemedImage

@Composable
fun IllustrationWithHalo(
themedImage: ThemedImage,
modifier: Modifier = Modifier
) {
Image(
modifier = modifier
.background(
Brush.radialGradient(
colors = listOf(AuthenticatorTheme.colors.illustrationBackgroundGradient, Color.Transparent),
)
),
imageVector = themedImage.image(),
contentDescription = null,
)
}

@PreviewLightAndDark
@Composable
fun IllustrationWithHaloPreview() {
AuthenticatorTheme {
Surface {
IllustrationWithHalo(
themedImage = AppImages.AppIllus.ShieldPerson,
modifier = Modifier.padding(Margin.Large)
)
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/*
* 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.components

import androidx.compose.material3.CenterAlignedTopAppBar
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.res.stringResource
import com.infomaniak.auth.R
import com.infomaniak.auth.ui.theme.AuthenticatorTheme
import com.infomaniak.core.ui.compose.preview.PreviewLightAndDark

@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun InfomaniakAuthenticatorTopAppBar() {
CenterAlignedTopAppBar(
title = {
Text(
text = stringResource(R.string.appCompleteName),
style = MaterialTheme.typography.headlineSmall
)
}
)
}

@PreviewLightAndDark
@Composable
private fun InfomaniakAuthenticatorTopAppBarPreview() {
AuthenticatorTheme {
Surface {
InfomaniakAuthenticatorTopAppBar()
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/*
* 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.components

import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.widthIn
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import com.infomaniak.auth.ui.theme.AuthenticatorTheme
import com.infomaniak.core.ui.compose.margin.Margin
import com.infomaniak.core.ui.compose.preview.PreviewLightAndDark

@Composable
fun TitleAndDescription(title: String, description: String) {
Column(
modifier = Modifier
.padding(Margin.Large)
.widthIn(max = 300.dp),
verticalArrangement = Arrangement.spacedBy(Margin.Medium),
horizontalAlignment = Alignment.CenterHorizontally,
) {
Text(
textAlign = TextAlign.Center,
text = title,
style = MaterialTheme.typography.titleLarge
)
Text(
textAlign = TextAlign.Center,
text = description,
style = MaterialTheme.typography.bodyLarge
)
}
}

@PreviewLightAndDark
@Composable
fun TitleAndDescriptionPreview() {
AuthenticatorTheme {
Surface {
TitleAndDescription(
title = "Lorem Ipsum",
description = "Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit..."
)
}
}
}
Loading