mirror of
https://github.com/nextcloud/android.git
synced 2024-11-29 10:49:04 +03:00
only make improvement for fileDownloadHelper
Signed-off-by: alperozturk <alper_ozturk@proton.me>
This commit is contained in:
parent
0f827f5bad
commit
564a5fe2c7
1 changed files with 12 additions and 8 deletions
|
@ -58,7 +58,6 @@ class FilesExportWork(
|
||||||
|
|
||||||
private fun exportFiles(fileIDs: LongArray): Int {
|
private fun exportFiles(fileIDs: LongArray): Int {
|
||||||
val fileDownloadHelper = FileDownloadHelper.instance()
|
val fileDownloadHelper = FileDownloadHelper.instance()
|
||||||
val fileExportUtil = FileExportUtils()
|
|
||||||
|
|
||||||
var successfulExports = 0
|
var successfulExports = 0
|
||||||
fileIDs
|
fileIDs
|
||||||
|
@ -73,13 +72,7 @@ class FilesExportWork(
|
||||||
|
|
||||||
if (ocFile.isDown) {
|
if (ocFile.isDown) {
|
||||||
try {
|
try {
|
||||||
fileExportUtil.exportFile(
|
exportFile(ocFile)
|
||||||
ocFile.fileName,
|
|
||||||
ocFile.mimeType,
|
|
||||||
contentResolver,
|
|
||||||
ocFile,
|
|
||||||
null
|
|
||||||
)
|
|
||||||
} catch (e: IllegalStateException) {
|
} catch (e: IllegalStateException) {
|
||||||
Log_OC.e(TAG, "Error exporting file", e)
|
Log_OC.e(TAG, "Error exporting file", e)
|
||||||
showErrorNotification(successfulExports)
|
showErrorNotification(successfulExports)
|
||||||
|
@ -97,6 +90,17 @@ class FilesExportWork(
|
||||||
return successfulExports
|
return successfulExports
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Throws(IllegalStateException::class)
|
||||||
|
private fun exportFile(ocFile: OCFile) {
|
||||||
|
FileExportUtils().exportFile(
|
||||||
|
ocFile.fileName,
|
||||||
|
ocFile.mimeType,
|
||||||
|
contentResolver,
|
||||||
|
ocFile,
|
||||||
|
null
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
private fun showErrorNotification(successfulExports: Int) {
|
private fun showErrorNotification(successfulExports: Int) {
|
||||||
val message = if (successfulExports == 0) {
|
val message = if (successfulExports == 0) {
|
||||||
appContext.resources.getQuantityString(R.plurals.export_failed, successfulExports, successfulExports)
|
appContext.resources.getQuantityString(R.plurals.export_failed, successfulExports, successfulExports)
|
||||||
|
|
Loading…
Reference in a new issue