diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/received/ReceivedScreen.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/received/ReceivedScreen.kt index 541b18e6c..1b90d582d 100644 --- a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/received/ReceivedScreen.kt +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/received/ReceivedScreen.kt @@ -21,8 +21,8 @@ import androidx.compose.material3.Surface import androidx.compose.runtime.Composable import androidx.compose.runtime.derivedStateOf import androidx.compose.runtime.getValue -import androidx.compose.ui.tooling.preview.PreviewParameter import androidx.compose.runtime.remember +import androidx.compose.ui.tooling.preview.PreviewParameter import androidx.hilt.navigation.compose.hiltViewModel import androidx.lifecycle.compose.collectAsStateWithLifecycle import com.infomaniak.multiplatform_swisstransfer.common.interfaces.ui.TransferUi 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 c2975bfa2..a393ed765 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 @@ -84,6 +84,7 @@ fun TransferDetailsScreen( setFileCheckStatus = { fileUid, isChecked -> transferDetailsViewModel.checkedFiles[fileUid] = isChecked }, + navigateToFilesDetails = navigateToFilesDetails, ) } } @@ -94,11 +95,10 @@ private fun TransferDetailsScreen( direction: TransferDirection, navigateBack: (() -> Unit)?, getTransfer: () -> TransferUi, - navigateToFilesDetails: ((transferUuid: String, fileUuid: String) -> Unit)? = null, - isFileChecked: (String) -> Boolean, getCheckedFiles: () -> SnapshotStateMap, clearCheckedFiles: () -> Unit, setFileCheckStatus: (String, Boolean) -> Unit, + navigateToFilesDetails: ((transferUuid: String, fileUuid: String) -> Unit)? = null, ) { val context = LocalContext.current @@ -122,13 +122,13 @@ private fun TransferDetailsScreen( Column { FilesList( -getTransfer, -transferRecipients, -isMultiselectOn, -getCheckedFiles, -setFileCheckStatus, + getTransfer, + transferRecipients, + isMultiselectOn, + getCheckedFiles, + setFileCheckStatus, navigateToFilesDetails, -) + ) BottomBar( direction = direction, @@ -190,7 +190,7 @@ private fun ColumnScope.FilesList( setFileCheckStatus(fileUid, isChecked) }, onClick = { fileUuid -> - navigateToFilesDetails?.invoke(transfer.uuid, fileUuid) + navigateToFilesDetails?.invoke(getTransfer().uuid, fileUuid) }, header = { Column { @@ -319,6 +319,7 @@ private fun Preview(@PreviewParameter(TransferUiListPreviewParameter::class) tra getCheckedFiles = { mutableStateMapOf() }, clearCheckedFiles = {}, setFileCheckStatus = { _, _ -> }, + navigateToFilesDetails = { _, _ -> }, ) } } diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/transfers/TransfersViewModel.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/transfers/TransfersViewModel.kt index 8173e123c..5686ebe21 100644 --- a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/transfers/TransfersViewModel.kt +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/transfers/TransfersViewModel.kt @@ -23,9 +23,6 @@ import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope import com.infomaniak.multiplatform_swisstransfer.common.models.TransferDirection import com.infomaniak.multiplatform_swisstransfer.managers.TransferManager -import com.infomaniak.multiplatform_swisstransfer.network.models.transfer.ContainerApi -import com.infomaniak.multiplatform_swisstransfer.network.models.transfer.FileApi -import com.infomaniak.multiplatform_swisstransfer.network.models.transfer.TransferApi import com.infomaniak.sentry.SentryLog import com.infomaniak.swisstransfer.di.IoDispatcher import dagger.hilt.android.lifecycle.HiltViewModel @@ -33,6 +30,7 @@ import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.flow.SharingStarted import kotlinx.coroutines.flow.flowOn import kotlinx.coroutines.flow.stateIn +import kotlinx.coroutines.launch import javax.inject.Inject @HiltViewModel 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 6b5139000..47eb03777 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 @@ -32,7 +32,6 @@ import com.infomaniak.multiplatform_swisstransfer.common.utils.mapToList import com.infomaniak.multiplatform_swisstransfer.data.NewUploadSession import com.infomaniak.multiplatform_swisstransfer.managers.AppSettingsManager import com.infomaniak.multiplatform_swisstransfer.managers.FileManager -import com.infomaniak.multiplatform_swisstransfer.managers.TransferManager import com.infomaniak.multiplatform_swisstransfer.managers.UploadManager import com.infomaniak.sentry.SentryLog import com.infomaniak.swisstransfer.di.IoDispatcher