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 1d9d5ed
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions app/src/main/java/com/infomaniak/mail/ui/MainViewModel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -1245,7 +1245,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 +1254,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 1d9d5ed

Please sign in to comment.