Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Core 0.8 #180

Merged
merged 3 commits into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ object SwissTransferInjectionModule {

@Provides
@Singleton
fun providesSwissTransferInjection() = SwissTransferInjection()
fun providesSwissTransferInjection() = SwissTransferInjection(userAgent = "Ktor client") // TODO: Waiting for api support

@Provides
@Singleton
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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(
Expand Down Expand Up @@ -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 */ },
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 ->
Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
Loading