diff --git a/app/src/main/java/com/example/abe/MainActivityViewModel.kt b/app/src/main/java/com/example/abe/MainActivityViewModel.kt index 632c54d5072e132ea639b69d5aeb28e15a541b63..5f028201ebeef1ba11d0fa1b1c17daf86e90b373 100644 --- a/app/src/main/java/com/example/abe/MainActivityViewModel.kt +++ b/app/src/main/java/com/example/abe/MainActivityViewModel.kt @@ -48,7 +48,7 @@ class MainActivityViewModel(private val transactionRepository: TransactionReposi suspend fun createEmailIntent(context: Context, user: String): Intent { clearExportCacheFiles(context) - val newFile = File(context.externalCacheDir, if (newExcelFormat) "export.xlsx" else "export.xls") + val newFile = File(context.cacheDir, if (newExcelFormat) "export.xlsx" else "export.xls") val contentUri = FileProvider.getUriForFile(context, "com.example.abe.fileprovider", newFile) exportTransactionsToExcel(context.contentResolver, contentUri, user) @@ -66,7 +66,7 @@ class MainActivityViewModel(private val transactionRepository: TransactionReposi } fun clearExportCacheFiles(context: Context) { - context.externalCacheDir?.apply { + context.cacheDir?.apply { val files = listFiles() ?: emptyArray() files.forEach { file -> if (file.name.startsWith("export")) diff --git a/app/src/main/res/xml/filepaths.xml b/app/src/main/res/xml/filepaths.xml index 405a83d4ee28acc51f581b1c950679f7da123423..fe2c7dc9388c4f983dc7125dff5b589bc07a1131 100644 --- a/app/src/main/res/xml/filepaths.xml +++ b/app/src/main/res/xml/filepaths.xml @@ -1,10 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <paths> - <external-cache-path + <cache-path name="exports" path="/" /> - -<!-- <cache-path--> -<!-- name="exports"--> -<!-- path="/" />--> </paths> \ No newline at end of file