From d49ae7ec5aa092de981867c1d9e836f1aabc02b1 Mon Sep 17 00:00:00 2001 From: Kevin Boulongne Date: Fri, 1 Nov 2024 15:12:02 +0100 Subject: [PATCH] review: Move files around --- .../FileUiListPreviewParameterProvider.kt | 73 +++++++++++++++++++ .../PreviewParameterProviders.kt | 30 -------- ...TransferUiListPreviewParameterProvider.kt} | 49 +------------ 3 files changed, 77 insertions(+), 75 deletions(-) create mode 100644 app/src/main/java/com/infomaniak/swisstransfer/ui/previewparameter/FileUiListPreviewParameterProvider.kt delete mode 100644 app/src/main/java/com/infomaniak/swisstransfer/ui/previewparameter/PreviewParameterProviders.kt rename app/src/main/java/com/infomaniak/swisstransfer/ui/previewparameter/{ListPreviewData.kt => TransferUiListPreviewParameterProvider.kt} (61%) diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/previewparameter/FileUiListPreviewParameterProvider.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/previewparameter/FileUiListPreviewParameterProvider.kt new file mode 100644 index 000000000..1fea4148e --- /dev/null +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/previewparameter/FileUiListPreviewParameterProvider.kt @@ -0,0 +1,73 @@ +/* + * 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 +import com.infomaniak.multiplatform_swisstransfer.common.interfaces.ui.FileUi +import java.util.UUID + +class FileUiListPreviewParameter : PreviewParameterProvider> { + override val values: Sequence> = sequenceOf(filesPreviewData) +} + +val filesPreviewData = listOf( + FileUi( + // Non-preview file (i.e. pdf, txt, etc.) + fileName = "How to not get fired.pdf", + uid = "How to not get fired.pdf", + fileSize = 10_302_130L, + mimeType = null, + localPath = "", + ), + FileUi( + // Preview file (i.e. png, jpg, etc.) + fileName = "Opening images tutorial.png", + uid = "Opening images tutorial.png", + fileSize = 456_782L, + mimeType = null, + localPath = "https://picsum.photos/200/300", + ), + FileUi( + fileName = "The 5 step guide to turning it off and on again.docx", + uid = "The 5 step guide to turning it off and on again.docx", + fileSize = 89_723_143L, + mimeType = null, + localPath = "", + ), + FileUi( + uid = UUID.randomUUID().toString(), + fileName = "Learning to Copy and Paste: A Complete Guide.docx", + fileSize = 237_866_728L, + mimeType = null, + localPath = null, + ), + FileUi( + uid = UUID.randomUUID().toString(), + fileName = "Introduction to Turning It Off and On Again.pptx", + fileSize = 98_723_143L, + mimeType = null, + localPath = null, + ), + FileUi( + uid = UUID.randomUUID().toString(), + fileName = "The 5-Step Guide to Not Breaking Your Code.txt", + fileSize = 57_689_032L, + mimeType = null, + localPath = null, + ), +) diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/previewparameter/PreviewParameterProviders.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/previewparameter/PreviewParameterProviders.kt deleted file mode 100644 index 938e540c6..000000000 --- a/app/src/main/java/com/infomaniak/swisstransfer/ui/previewparameter/PreviewParameterProviders.kt +++ /dev/null @@ -1,30 +0,0 @@ -/* - * 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 -import com.infomaniak.multiplatform_swisstransfer.common.interfaces.ui.FileUi -import com.infomaniak.multiplatform_swisstransfer.common.interfaces.ui.TransferUi - -class FileUiListPreviewParameter : PreviewParameterProvider> { - override val values: Sequence> = sequenceOf(filesPreviewData) -} - -class TransferUiListPreviewParameter : PreviewParameterProvider> { - override val values: Sequence> = sequenceOf(transfersPreviewData) -} diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/previewparameter/ListPreviewData.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/previewparameter/TransferUiListPreviewParameterProvider.kt similarity index 61% rename from app/src/main/java/com/infomaniak/swisstransfer/ui/previewparameter/ListPreviewData.kt rename to app/src/main/java/com/infomaniak/swisstransfer/ui/previewparameter/TransferUiListPreviewParameterProvider.kt index 0bec966ae..ee586b3c6 100644 --- a/app/src/main/java/com/infomaniak/swisstransfer/ui/previewparameter/ListPreviewData.kt +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/previewparameter/TransferUiListPreviewParameterProvider.kt @@ -17,56 +17,15 @@ */ package com.infomaniak.swisstransfer.ui.previewparameter -import com.infomaniak.multiplatform_swisstransfer.common.interfaces.ui.FileUi +import androidx.compose.ui.tooling.preview.PreviewParameterProvider import com.infomaniak.multiplatform_swisstransfer.common.interfaces.ui.TransferUi import java.util.Calendar import java.util.Date import java.util.UUID -val filesPreviewData = listOf( - FileUi( // Non-preview file (i.e. pdf, txt, etc.) - fileName = "How to not get fired.pdf", - uid = "How to not get fired.pdf", - fileSize = 10_302_130L, - mimeType = null, - localPath = "", - ), - FileUi( // Preview file (i.e. png, jpg, etc.) - fileName = "Opening images tutorial.png", - uid = "Opening images tutorial.png", - fileSize = 456_782L, - mimeType = null, - localPath = "https://picsum.photos/200/300", - ), - FileUi( - fileName = "The 5 step guide to turning it off and on again.docx", - uid = "The 5 step guide to turning it off and on again.docx", - fileSize = 89_723_143L, - mimeType = null, - localPath = "", - ), - FileUi( - uid = UUID.randomUUID().toString(), - fileName = "Learning to Copy and Paste: A Complete Guide.docx", - fileSize = 237_866_728L, - mimeType = null, - localPath = null, - ), - FileUi( - uid = UUID.randomUUID().toString(), - fileName = "Introduction to Turning It Off and On Again.pptx", - fileSize = 98_723_143L, - mimeType = null, - localPath = null, - ), - FileUi( - uid = UUID.randomUUID().toString(), - fileName = "The 5-Step Guide to Not Breaking Your Code.txt", - fileSize = 57_689_032L, - mimeType = null, - localPath = null, - ), -) +class TransferUiListPreviewParameter : PreviewParameterProvider> { + override val values: Sequence> = sequenceOf(transfersPreviewData) +} val transfersPreviewData = listOf( TransferUi(