From e85cea1ce1ff9f2d63889755cd7ba9826993fe7c Mon Sep 17 00:00:00 2001 From: Kevin Boulongne Date: Tue, 12 Nov 2024 16:15:46 +0100 Subject: [PATCH] refactor: Extract usage of Emails test data --- .../EmailsPreviewParameterProvider.kt | 44 +++++++++++++++++++ .../upload/UploadSuccessEmailScreen.kt | 19 +------- 2 files changed, 46 insertions(+), 17 deletions(-) create mode 100644 app/src/main/java/com/infomaniak/swisstransfer/ui/previewparameter/EmailsPreviewParameterProvider.kt diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/previewparameter/EmailsPreviewParameterProvider.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/previewparameter/EmailsPreviewParameterProvider.kt new file mode 100644 index 000000000..59d98aee0 --- /dev/null +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/previewparameter/EmailsPreviewParameterProvider.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.previewparameter + +import androidx.compose.ui.tooling.preview.PreviewParameterProvider + +class EmailsPreviewParameter : PreviewParameterProvider> { + override val values: Sequence> = sequenceOf(emailsPreviewData) +} + +val emailsPreviewData = listOf( + "a.b@c.de", + "f.g@h.ij", + "email@example.com", + "firstname.lastname@example.com", + "email@subdomain.example.com", + "firstname+lastname@example.com", + "email@123.123.123.123", + "email@[123.123.123.123]", + "sdiofhcdqsklmjvbnfdkjlsdbnfkdgflghhwfiudmsklwhdxfbvhlsdjkbwnxcjkvdxhjgwhxdjlxkchwbdvxfhbdqshjkdhjd@mail.com", + "\"email\"@example.com", + "1234567890@example.com", + "email@example-one.com", + "_______@example.com", + "email@example.name", + "email@example.museum", + "email@example.co.jp", + "firstname-lastname@example.com", +) 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 index 26563336c..60675341e 100644 --- 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 @@ -30,30 +30,15 @@ import com.infomaniak.swisstransfer.R import com.infomaniak.swisstransfer.ui.components.* import com.infomaniak.swisstransfer.ui.images.AppImages.AppIllus import com.infomaniak.swisstransfer.ui.images.illus.beers.Beers +import com.infomaniak.swisstransfer.ui.previewparameter.emailsPreviewData import com.infomaniak.swisstransfer.ui.screen.newtransfer.importfiles.components.TransferType import com.infomaniak.swisstransfer.ui.theme.Margin import com.infomaniak.swisstransfer.ui.theme.SwissTransferTheme import com.infomaniak.swisstransfer.ui.utils.PreviewAllWindows -// TODO: Use correct emails instead of hard-coded values @Composable fun UploadSuccessEmailScreen( - emails: List = listOf( - "email@example.com", - "firstname.lastname@example.com", - "email@subdomain.example.com", - "firstname+lastname@example.com", - "email@123.123.123.123", - "email@[123.123.123.123]", - "\"email\"@example.com", - "1234567890@example.com", - "email@example-one.com", - "_______@example.com", - "email@example.name", - "email@example.museum", - "email@example.co.jp", - "firstname-lastname@example.com", - ), + emails: List = emailsPreviewData, // TODO: Use real data closeActivity: () -> Unit, ) { BottomStickyButtonScaffold(