Skip to content

Commit

Permalink
feat: Save in cache instead of files
Browse files Browse the repository at this point in the history
  • Loading branch information
NicolasBourdin88 committed Nov 1, 2024
1 parent 9de1fdd commit f003f01
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 2 additions & 3 deletions app/src/main/java/com/infomaniak/mail/ui/MainViewModel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ package com.infomaniak.mail.ui
import android.app.Application
import android.content.Context
import android.net.Uri
import android.util.Log
import androidx.core.content.FileProvider
import androidx.lifecycle.*
import com.infomaniak.lib.core.models.ApiResponse
Expand Down Expand Up @@ -1245,7 +1244,7 @@ class MainViewModel @Inject constructor(
}

private fun getAllFileNameInExportEmlDir(context: Context): List<String> {
val fileDir = File(context.filesDir, context.getString(R.string.EXPOSED_EML_PATH))
val fileDir = File(context.cacheDir, context.getString(R.string.EXPOSED_EML_PATH))

if (!fileDir.exists()) fileDir.mkdirs()

Expand All @@ -1254,7 +1253,7 @@ class MainViewModel @Inject constructor(

private fun saveEmlToFile(context: Context, emlByteArray: ByteArray, fileName: String): Uri? {
val fileNameWithExtension = "${fileName.removeIllegalFileNameCharacter()}.eml"
val fileDir = File(context.filesDir, context.getString(R.string.EXPOSED_EML_PATH))
val fileDir = File(context.cacheDir, context.getString(R.string.EXPOSED_EML_PATH))

if (!fileDir.exists()) fileDir.mkdirs()

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/xml/exposed_files_path.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<files-path
name="uploaded attachments"
path="attachments_upload" />
<files-path
<cache-path
name="eml"
path="eml_export" />
</paths>

0 comments on commit f003f01

Please sign in to comment.