diff --git a/app/src/main/java/com/infomaniak/swisstransfer/di/SwissTransferInjectionModule.kt b/app/src/main/java/com/infomaniak/swisstransfer/di/SwissTransferInjectionModule.kt index 39a3ae158..cd9ca4fa2 100644 --- a/app/src/main/java/com/infomaniak/swisstransfer/di/SwissTransferInjectionModule.kt +++ b/app/src/main/java/com/infomaniak/swisstransfer/di/SwissTransferInjectionModule.kt @@ -30,7 +30,7 @@ object SwissTransferInjectionModule { @Provides @Singleton - fun providesSwissTransferInjection() = SwissTransferInjection() + fun providesSwissTransferInjection() = SwissTransferInjection(userAgent = "Ktor client") // TODO: Waiting for api support @Provides @Singleton diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/components/transfer/TransferItem.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/components/transfer/TransferItem.kt index 0027192a4..7b081dd4c 100644 --- a/app/src/main/java/com/infomaniak/swisstransfer/ui/components/transfer/TransferItem.kt +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/components/transfer/TransferItem.kt @@ -29,6 +29,7 @@ import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.tooling.preview.PreviewParameter import com.infomaniak.core2.FORMAT_DATE_TITLE import com.infomaniak.core2.format +import com.infomaniak.multiplatform_swisstransfer.common.ext.toDateFromSeconds import com.infomaniak.multiplatform_swisstransfer.common.interfaces.ui.TransferUi import com.infomaniak.swisstransfer.R import com.infomaniak.swisstransfer.ui.components.TextDotText @@ -42,7 +43,6 @@ import com.infomaniak.swisstransfer.ui.theme.SwissTransferTheme import com.infomaniak.swisstransfer.ui.utils.HumanReadableSizeUtils import com.infomaniak.swisstransfer.ui.utils.PreviewLightAndDark import com.infomaniak.swisstransfer.ui.utils.isExpired -import java.util.Date @OptIn(ExperimentalLayoutApi::class) @Composable @@ -52,7 +52,7 @@ fun TransferItem( onClick: () -> Unit, ) { - val createdDate = Date(transfer.createdDateTimestamp).format(FORMAT_DATE_TITLE) + val createdDate = transfer.createdDateTimestamp.toDateFromSeconds().format(FORMAT_DATE_TITLE) val uploadedSize = HumanReadableSizeUtils.getHumanReadableSize(LocalContext.current, transfer.sizeUploaded) val files = transfer.files val (expiryText, expiryColor) = if (transfer.isExpired) { diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/components/transfer/TransfersListWithExpiredBottomSheet.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/components/transfer/TransfersListWithExpiredBottomSheet.kt index 51114a502..65355976a 100644 --- a/app/src/main/java/com/infomaniak/swisstransfer/ui/components/transfer/TransfersListWithExpiredBottomSheet.kt +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/components/transfer/TransfersListWithExpiredBottomSheet.kt @@ -27,6 +27,7 @@ import androidx.compose.runtime.saveable.rememberSaveable import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier import androidx.compose.ui.tooling.preview.PreviewParameter +import com.infomaniak.multiplatform_swisstransfer.common.ext.toDateFromSeconds import com.infomaniak.multiplatform_swisstransfer.common.interfaces.ui.TransferUi import com.infomaniak.multiplatform_swisstransfer.common.models.TransferDirection import com.infomaniak.swisstransfer.ui.previewparameter.TransferUiListPreviewParameter @@ -56,7 +57,7 @@ fun TransfersListWithExpiredBottomSheet( when { transfer.expiresInDays < 0 -> { isExpirySheetVisible = true - expirationDate = Date(transfer.expirationDateTimestamp) + expirationDate = transfer.expirationDateTimestamp.toDateFromSeconds() } transfer.downloadLeft == 0 -> { isExpirySheetVisible = true diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/settings/SettingsDownloadsLimitScreen.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/settings/SettingsDownloadsLimitScreen.kt index bff3b5db4..f1000a7bf 100644 --- a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/settings/SettingsDownloadsLimitScreen.kt +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/settings/SettingsDownloadsLimitScreen.kt @@ -53,7 +53,7 @@ enum class DownloadLimitOption( TWENTY(apiValue = DownloadLimit.TWENTY), ONE(apiValue = DownloadLimit.ONE); - override val title: @Composable () -> String = { apiValue.value } + override val title: @Composable () -> String = { apiValue.value.toString() } companion object { fun DownloadLimit.toTransferOption() = when (this) { diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/settings/SettingsScreen.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/settings/SettingsScreen.kt index 0a2a68384..4145c33f0 100644 --- a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/settings/SettingsScreen.kt +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/settings/SettingsScreen.kt @@ -173,7 +173,7 @@ private fun ValidityPeriod?.getString(): String { } @Composable -private fun DownloadLimit?.getString() = this?.value ?: "" +private fun DownloadLimit?.getString() = this?.value?.toString() ?: "" @Composable private fun EmailLanguage?.getString(): String { diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/transferdetails/TransferDetailsScreen.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/transferdetails/TransferDetailsScreen.kt index 35e937145..ab382c320 100644 --- a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/transferdetails/TransferDetailsScreen.kt +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/transferdetails/TransferDetailsScreen.kt @@ -35,6 +35,7 @@ import androidx.compose.ui.unit.dp import androidx.hilt.navigation.compose.hiltViewModel import com.infomaniak.core2.FORMAT_DATE_FULL import com.infomaniak.core2.format +import com.infomaniak.multiplatform_swisstransfer.common.ext.toDateFromSeconds import com.infomaniak.multiplatform_swisstransfer.common.interfaces.ui.TransferUi import com.infomaniak.multiplatform_swisstransfer.common.models.TransferDirection import com.infomaniak.swisstransfer.R @@ -54,7 +55,6 @@ import com.infomaniak.swisstransfer.ui.theme.Margin import com.infomaniak.swisstransfer.ui.theme.SwissTransferTheme import com.infomaniak.swisstransfer.ui.utils.PreviewAllWindows import com.infomaniak.swisstransfer.ui.utils.shareText -import java.util.Date @Composable fun TransferDetailsScreen( @@ -99,7 +99,7 @@ private fun TransferDetailsScreen( SmallWindowTopAppBarScaffold( smallWindowTopAppBar = { SwissTransferTopAppBar( - title = Date(transfer.createdDateTimestamp).format(FORMAT_DATE_FULL), + title = transfer.createdDateTimestamp.toDateFromSeconds().format(FORMAT_DATE_FULL), navigationMenu = TopAppBarButton.backButton(navigateBack ?: {}), TopAppBarButton.downloadButton { /* TODO */ }, ) diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/ImportFilesViewModel.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/ImportFilesViewModel.kt index c08f62001..aa9ff04a3 100644 --- a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/ImportFilesViewModel.kt +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/ImportFilesViewModel.kt @@ -135,12 +135,11 @@ class ImportFilesViewModel @Inject constructor( private fun generateNewUploadSession(): NewUploadSession { return NewUploadSession( - duration = selectedValidityPeriodOption.value.apiValue.value, + duration = selectedValidityPeriodOption.value.apiValue, authorEmail = "", password = if (selectedPasswordOption.value == PasswordTransferOption.ACTIVATED) transferPassword else NO_PASSWORD, message = "sisi test", - // TODO: Accept enum in kmp instead of parsing toInt() - numberOfDownload = selectedDownloadLimitOption.value.apiValue.value.toInt(), + numberOfDownload = selectedDownloadLimitOption.value.apiValue, language = selectedLanguageOption.value.apiValue, recipientsEmails = emptyList(), files = importationFilesManager.importedFiles.value.mapToList { fileUi -> diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index a6654d283..7620cbae5 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -20,7 +20,7 @@ qrose = "1.0.1" recaptcha = "18.6.1" sentry = "4.12.0" serialization = "1.7.3" -swisstransfer = "0.7.2" +swisstransfer = "0.8.1" workmanager = "2.10.0" [libraries]