Skip to content

Commit

Permalink
docs: Add explanatory comment
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinBoulongne committed Dec 24, 2024
1 parent 6cb5112 commit b743eb1
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,18 @@ class TransferSendManager @Inject constructor(
private val uploadWorkerScheduler: UploadWorker.Scheduler,
) {

// TODO: Merge these two UI states in a single one for the whole flow of logic
private val _sendStatus = MutableStateFlow<SendStatus>(SendStatus.Initial)
val sendStatus = _sendStatus.asStateFlow()

suspend fun sendNewTransfer(newUploadSession: NewUploadSession) {

// When clicking the "Send" button, a new session is created.
// If there is an error before reaching the UploadProgressScreen, we stay in ImportFilesScreen.
// Every time we'll click the "Send" button again, a new session will be created.
// So we'll have multiple UploadSession in Realm. We don't want that. We only want the last session.
// So before creating the new session, we need to remove the previous failed ones.
uploadManager.removeAllUploadSession()

val uploadSession = uploadManager.createAndGetUpload(newUploadSession)
sendTransfer(uploadSession.uuid)
}
Expand Down

0 comments on commit b743eb1

Please sign in to comment.