Skip to content

Commit

Permalink
feat: Add UploadSuccessEmail screen
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinBoulongne committed Oct 17, 2024
1 parent c46e47c commit 2cbf89f
Show file tree
Hide file tree
Showing 8 changed files with 167 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -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 <http://www.gnu.org/licenses/>.
*/
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,
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ sealed class NewTransferNavigation : NavigationDestination() {
data object TransferOptionsDestination : NewTransferNavigation()
@Serializable
data object ValidateUserEmailDestination : NewTransferNavigation()

@Serializable
data object UploadProgressDestination : NewTransferNavigation()
@Serializable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -49,7 +50,9 @@ fun NewTransferNavHost(navController: NavHostController, closeActivity: () -> Un
UploadProgressScreen()
}
composable<UploadSuccessDestination> {
UploadSuccessScreen()
UploadSuccessScreen(
transferType = TransferType.MAIL, // TODO: Use correct TransferType instead of hard-coded value.
)
}
}
}
Original file line number Diff line number Diff line change
@@ -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 <http://www.gnu.org/licenses/>.
*/
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("[email protected]") // TODO: Use correct email instead of hard-coded value.
}
},
)
}

@PreviewSmallWindow
@Composable
private fun UploadSuccessEmailScreenPreview() {
SwissTransferTheme {
Surface {
UploadSuccessEmailScreen()
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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),
)
Original file line number Diff line number Diff line change
Expand Up @@ -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),
)
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 2cbf89f

Please sign in to comment.