fix(android): move log zip file outside of log folder (#3677)

Fixes #3330

The when the log zip file is created, it's created as an empty file in
the `logs` directory. The `logs` directory is then zipped, and written
to the zip file. The empty file remains as an artifact in the final zip
file.

This moves the location of the zip file outside of the `logs` directory,
where it will be cleaned up later.
This commit is contained in:
Jason Elie Bou Kheir
2024-02-17 13:19:22 -08:00
committed by GitHub
parent 120b3474ee
commit c476e87eec

View File

@@ -114,7 +114,7 @@ internal class SettingsViewModel
viewModelScope.launch {
val logDir = context.cacheDir.absolutePath + "/logs"
val sourceFolder = File(logDir)
val zipFile = File("$logDir/connlib-logs.zip")
val zipFile = File(getLogZipPath(context))
zipFolder(sourceFolder, zipFile).collect()
@@ -186,13 +186,14 @@ internal class SettingsViewModel
}.flowOn(Dispatchers.IO)
private fun deleteLogZip(context: Context) {
val logDir = context.cacheDir.absolutePath + "/logs"
val zipFile = File("$logDir/connlib-logs.zip")
val zipFile = File(getLogZipPath(context))
if (zipFile.exists()) {
zipFile.delete()
}
}
private fun getLogZipPath(context: Context) = "${context.cacheDir.absolutePath}/connlib-logs.zip"
private fun onFieldUpdated() {
_uiState.value =
_uiState.value.copy(