Fix file export when no file can open this type and export is chosen
Before the `FileInputStream` got closed before started reading because of the async UseCase
This commit is contained in:
parent
0f05400353
commit
47131abd50
@ -284,16 +284,18 @@ class BrowseFilesPresenter @Inject constructor( //
|
|||||||
private fun copyFile(downloadFiles: List<DownloadFile>) {
|
private fun copyFile(downloadFiles: List<DownloadFile>) {
|
||||||
downloadFiles.forEach { downloadFile ->
|
downloadFiles.forEach { downloadFile ->
|
||||||
try {
|
try {
|
||||||
FileInputStream(fileUtil.fileFor(cloudFileModelMapper.toModel(downloadFile.downloadFile))).use {
|
val source = FileInputStream(fileUtil.fileFor(cloudFileModelMapper.toModel(downloadFile.downloadFile)))
|
||||||
copyDataUseCase //
|
copyDataUseCase //
|
||||||
.withSource(it) //
|
.withSource(source) //
|
||||||
.andTarget(downloadFile.dataSink) //
|
.andTarget(downloadFile.dataSink) //
|
||||||
.run(object : DefaultResultHandler<Void>() {
|
.run(object : DefaultResultHandler<Void>() {
|
||||||
override fun onFinished() {
|
override fun onSuccess(t: Void?) {
|
||||||
view?.showMessage(R.string.screen_file_browser_msg_file_exported)
|
view?.showMessage(R.string.screen_file_browser_msg_file_exported)
|
||||||
}
|
}
|
||||||
})
|
override fun onFinished() {
|
||||||
}
|
source.close()
|
||||||
|
}
|
||||||
|
})
|
||||||
} catch (e: FileNotFoundException) {
|
} catch (e: FileNotFoundException) {
|
||||||
showError(e)
|
showError(e)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user