Skip to content

Commit

Permalink
Merge pull request #157 from Infomaniak/fix-remove-old-data
Browse files Browse the repository at this point in the history
fix: Remove old data with db data
  • Loading branch information
sirambd authored Nov 13, 2024
2 parents b451d8b + 40e4715 commit ff90f33
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class ImportFilesViewModel @Inject constructor(
isFirstViewModelCreation = false
// Remove old imported files in case it would've crashed or similar to start with a clean slate. This is required
// for already imported files restoration to not pick up old files in some extreme cases.
importationFilesManager.removeLocalCopyFolder()
removeOldData()
} else {
importationFilesManager.restoreAlreadyImportedFiles()
}
Expand Down Expand Up @@ -129,6 +129,11 @@ class ImportFilesViewModel @Inject constructor(
}
}

private suspend fun removeOldData() {
importationFilesManager.removeLocalCopyFolder()
uploadManager.removeAllUploadSession()
}

private fun generateNewUploadSession(): NewUploadSession {
return NewUploadSession(
duration = "30",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class UploadProgressViewModel @Inject constructor(

viewModelScope.launch(ioDispatcher) {
uploadManager.getLastUpload()?.let {
uploadManager.deleteUploadSession(it.uuid)
uploadManager.removeUploadSession(it.uuid)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ class UploadFileTask(
}

private suspend inline fun throwAndDestroyUpload(uploadUuid: String, throwMessage: String): Nothing {
uploadManager.deleteUploadSession(uploadUuid)
uploadManager.removeUploadSession(uploadUuid)
error(throwMessage)
}

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.1"
swisstransfer = "0.7.1"
swisstransfer = "0.7.2"
workmanager = "2.9.1"

[libraries]
Expand Down

0 comments on commit ff90f33

Please sign in to comment.