diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/components/EmailAddressChip.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/components/EmailAddressChip.kt new file mode 100644 index 000000000..5f0422b2f --- /dev/null +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/components/EmailAddressChip.kt @@ -0,0 +1,44 @@ +/* + * Infomaniak SwissTransfer - Android + * Copyright (C) 2024 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 . + */ +package com.infomaniak.swisstransfer.ui.components + +import androidx.compose.foundation.background +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.padding +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import androidx.compose.ui.draw.clip +import com.infomaniak.swisstransfer.ui.theme.CustomShapes +import com.infomaniak.swisstransfer.ui.theme.Margin +import com.infomaniak.swisstransfer.ui.theme.SwissTransferTheme + +@Composable +fun EmailAddressChip(text: String) { + Box( + modifier = Modifier + .clip(CustomShapes.Rounded) + .background(SwissTransferTheme.colors.emailAddressChipColor) + .padding(horizontal = Margin.Small), + ) { + Text( + color = SwissTransferTheme.colors.onEmailAddressChipColor, + text = text, + ) + } +} diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/navigation/NavigationDestination.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/navigation/NavigationDestination.kt index ff8a8df5c..c012dd957 100644 --- a/app/src/main/java/com/infomaniak/swisstransfer/ui/navigation/NavigationDestination.kt +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/navigation/NavigationDestination.kt @@ -59,7 +59,6 @@ sealed class NewTransferNavigation : NavigationDestination() { data object TransferOptionsDestination : NewTransferNavigation() @Serializable data object ValidateUserEmailDestination : NewTransferNavigation() - @Serializable data object UploadProgressDestination : NewTransferNavigation() @Serializable diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/NewTransferNavHost.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/NewTransferNavHost.kt index 4a1e59b66..62d65f67a 100644 --- a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/NewTransferNavHost.kt +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/NewTransferNavHost.kt @@ -26,6 +26,7 @@ import com.infomaniak.swisstransfer.ui.navigation.NewTransferNavigation.* import com.infomaniak.swisstransfer.ui.screen.newtransfer.importfiles.ImportFilesScreen import com.infomaniak.swisstransfer.ui.screen.newtransfer.importfiles.TransferOptionsScreen import com.infomaniak.swisstransfer.ui.screen.newtransfer.importfiles.ValidateUserEmailScreen +import com.infomaniak.swisstransfer.ui.screen.newtransfer.importfiles.components.TransferType import com.infomaniak.swisstransfer.ui.screen.newtransfer.upload.UploadProgressScreen import com.infomaniak.swisstransfer.ui.screen.newtransfer.upload.UploadSuccessScreen @@ -49,7 +50,9 @@ fun NewTransferNavHost(navController: NavHostController, closeActivity: () -> Un UploadProgressScreen() } composable { - UploadSuccessScreen() + UploadSuccessScreen( + transferType = TransferType.MAIL, // TODO: Use correct TransferType instead of hard-coded value. + ) } } } diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/upload/UploadSuccessEmailScreen.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/upload/UploadSuccessEmailScreen.kt new file mode 100644 index 000000000..4b1a175cf --- /dev/null +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/upload/UploadSuccessEmailScreen.kt @@ -0,0 +1,91 @@ +/* + * Infomaniak SwissTransfer - Android + * Copyright (C) 2024 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 . + */ +package com.infomaniak.swisstransfer.ui.screen.newtransfer.upload + +import androidx.compose.foundation.Image +import androidx.compose.foundation.layout.* +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.res.stringResource +import androidx.compose.ui.text.style.TextAlign +import com.infomaniak.swisstransfer.R +import com.infomaniak.swisstransfer.ui.components.BottomStickyButtonScaffold +import com.infomaniak.swisstransfer.ui.components.BrandTopAppBar +import com.infomaniak.swisstransfer.ui.components.EmailAddressChip +import com.infomaniak.swisstransfer.ui.components.LargeButton +import com.infomaniak.swisstransfer.ui.images.AppImages.AppIllus +import com.infomaniak.swisstransfer.ui.images.illus.uploadSuccessEmail.UploadSuccessEmail +import com.infomaniak.swisstransfer.ui.theme.Dimens +import com.infomaniak.swisstransfer.ui.theme.Margin +import com.infomaniak.swisstransfer.ui.theme.SwissTransferTheme +import com.infomaniak.swisstransfer.ui.utils.PreviewSmallWindow + +@Composable +fun UploadSuccessEmailScreen() { + BottomStickyButtonScaffold( + topBar = { BrandTopAppBar() }, + bottomButton = { + LargeButton( + modifier = it, + titleRes = R.string.buttonFinished, + onClick = { /* TODO */ }, + ) + }, + content = { + Column( + modifier = Modifier.fillMaxSize(), + horizontalAlignment = Alignment.CenterHorizontally, + verticalArrangement = Arrangement.Center, + ) { + Image( + imageVector = AppIllus.UploadSuccessEmail.image(), + contentDescription = null, + ) + Text( + text = stringResource(R.string.uploadSuccessEmailTitle), + style = SwissTransferTheme.typography.h1, + color = SwissTransferTheme.colors.primaryTextColor, + modifier = Modifier.padding(top = Margin.XXLarge, start = Margin.Medium, end = Margin.Medium) + ) + Text( + text = stringResource(R.string.uploadSuccessEmailDescription), + style = SwissTransferTheme.typography.bodyRegular, + textAlign = TextAlign.Center, + color = SwissTransferTheme.colors.secondaryTextColor, + modifier = Modifier + .padding(Margin.Medium) + .widthIn(max = Dimens.DescriptionWidth), + ) + EmailAddressChip("test.test@ik.me") // TODO: Use correct email instead of hard-coded value. + } + }, + ) +} + +@PreviewSmallWindow +@Composable +private fun UploadSuccessEmailScreenPreview() { + SwissTransferTheme { + Surface { + UploadSuccessEmailScreen() + } + } +} diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/upload/UploadSuccessScreen.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/upload/UploadSuccessScreen.kt index a8446ccc0..167df44e0 100644 --- a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/upload/UploadSuccessScreen.kt +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/upload/UploadSuccessScreen.kt @@ -17,10 +17,29 @@ */ package com.infomaniak.swisstransfer.ui.screen.newtransfer.upload -import androidx.compose.material3.Text +import androidx.compose.material3.Surface import androidx.compose.runtime.Composable +import com.infomaniak.swisstransfer.ui.screen.newtransfer.importfiles.components.TransferType +import com.infomaniak.swisstransfer.ui.theme.SwissTransferTheme +import com.infomaniak.swisstransfer.ui.utils.PreviewLargeWindow +import com.infomaniak.swisstransfer.ui.utils.PreviewSmallWindow @Composable -fun UploadSuccessScreen() { - Text("UploadSuccessScreen") +fun UploadSuccessScreen(transferType: TransferType) { + if (transferType == TransferType.MAIL) { + UploadSuccessEmailScreen() + } else { + // UploadSuccessQrScreen(transferType) + } +} + +@PreviewSmallWindow +@PreviewLargeWindow +@Composable +private fun UploadSuccessScreenPreview() { + SwissTransferTheme { + Surface { + UploadSuccessScreen(TransferType.MAIL) + } + } } diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/theme/ColorDark.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/theme/ColorDark.kt index 915997981..f70c4f673 100644 --- a/app/src/main/java/com/infomaniak/swisstransfer/ui/theme/ColorDark.kt +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/theme/ColorDark.kt @@ -84,4 +84,6 @@ val CustomDarkColorScheme = CustomColorScheme( transferTypeQrOnContainer = Color(green_main), transferTypeProximityContainer = Color(specific3), transferTypeProximityOnContainer = Color(specific4), + emailAddressChipColor = Color(green_dark), + onEmailAddressChipColor = Color(green_main), ) diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/theme/ColorLight.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/theme/ColorLight.kt index 0834bb1cd..c1e6cff5c 100644 --- a/app/src/main/java/com/infomaniak/swisstransfer/ui/theme/ColorLight.kt +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/theme/ColorLight.kt @@ -85,4 +85,6 @@ val CustomLightColorScheme = CustomColorScheme( transferTypeQrOnContainer = Color(green_main), transferTypeProximityContainer = Color(specific3), transferTypeProximityOnContainer = Color(specific4), + emailAddressChipColor = Color(green_contrast), + onEmailAddressChipColor = Color(green_dark), ) diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/theme/Theme.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/theme/Theme.kt index 0c0bedb8b..32f745f82 100644 --- a/app/src/main/java/com/infomaniak/swisstransfer/ui/theme/Theme.kt +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/theme/Theme.kt @@ -85,6 +85,8 @@ data class CustomColorScheme( val transferTypeQrOnContainer: Color = Color.Unspecified, val transferTypeProximityContainer: Color = Color.Unspecified, val transferTypeProximityOnContainer: Color = Color.Unspecified, + val emailAddressChipColor: Color = Color.Unspecified, + val onEmailAddressChipColor: Color = Color.Unspecified, ) private val Shapes = Shapes(