Do not backup recordings

This commit is contained in:
Juha Heinanen
2025-01-05 00:31:54 +02:00
parent 96620516f3
commit 2042596600
3 changed files with 18 additions and 10 deletions
@@ -1790,16 +1790,12 @@ class MainActivity : AppCompatActivity() {
} }
private fun backup(password: String) { private fun backup(password: String) {
val files = arrayListOf("accounts", "history", "config", "contacts", "messages", val files = arrayListOf("accounts", "config", "contacts", "call_history",
"gzrtp.zid", "cert.pem", "ca_cert", "ca_certs.crt") "messages", "gzrtp.zid", "cert.pem", "ca_cert", "ca_certs.crt")
File(BaresipService.filesPath).walk().forEach { File(BaresipService.filesPath).walk().forEach {
if (it.name.endsWith(".png")) if (it.name.endsWith(".png"))
files.add(it.name) files.add(it.name)
} }
File("${BaresipService.filesPath}/recordings").walk().forEach {
if (it.name.startsWith("dump"))
files.add("recordings/${it.name}")
}
val zipFile = getString(R.string.app_name) + ".zip" val zipFile = getString(R.string.app_name) + ".zip"
val zipFilePath = BaresipService.filesPath + "/$zipFile" val zipFilePath = BaresipService.filesPath + "/$zipFile"
if (!Utils.zip(files, zipFile)) { if (!Utils.zip(files, zipFile)) {
@@ -1853,6 +1849,17 @@ class MainActivity : AppCompatActivity() {
return return
} }
Utils.deleteFile(File(zipFilePath)) Utils.deleteFile(File(zipFilePath))
File("${BaresipService.filesPath}/recordings").walk().forEach {
if (it.name.startsWith("dump"))
Utils.deleteFile(it)
}
CallHistoryNew.restore()
for (h in BaresipService.callHistory)
h.recording = arrayOf("", "")
CallHistoryNew.save()
with(MaterialAlertDialogBuilder(this, R.style.AlertDialogTheme)) { with(MaterialAlertDialogBuilder(this, R.style.AlertDialogTheme)) {
setTitle(getString(R.string.info)) setTitle(getString(R.string.info))
setMessage(getString(R.string.restored)) setMessage(getString(R.string.restored))
+3 -2
View File
@@ -548,8 +548,9 @@
<string name="call_is_secure">Tämä puhelu on turvallinen ja kohde on <string name="call_is_secure">Tämä puhelu on turvallinen ja kohde on
todennettu! Haluatko poistaa todennuksen\?</string> todennettu! Haluatko poistaa todennuksen\?</string>
<string name="unverify">Poista todennus</string> <string name="unverify">Poista todennus</string>
<string name="backed_up">Sovelluksen tiedot talletettiin tiedostoon \'%1$s\'. Android <string name="backed_up">Sovelluksen tiedot (äänityksiä lukuunottamatta)
versiossa 9 tiedosto löytyy Download-kansiosta.</string> talletettiin tiedostoon \'%1$s\'. Android versiossa 9 tiedosto löytyy
Download-kansiosta.</string>
<string name="backup_failed">Sovelluksen tietojen talletus <string name="backup_failed">Sovelluksen tietojen talletus
tiedostoon \'%1$s\' epäonnistui. Android versiossa 9 tarkista tiedostoon \'%1$s\' epäonnistui. Android versiossa 9 tarkista
Asetukset → Sovellukset → baresip → Käyttöluvat → Tallennustila.</string> Asetukset → Sovellukset → baresip → Käyttöluvat → Tallennustila.</string>
+2 -2
View File
@@ -527,8 +527,8 @@
Do you want to unverify the peer\? Do you want to unverify the peer\?
</string> </string>
<string name="unverify">Unverify</string> <string name="unverify">Unverify</string>
<string name="backed_up">Application data has been backed up to file \'%1$s\'. In Android <string name="backed_up">Application data (excluding recordings) backed up
version 9, the file is in Download folder.</string> to file \'%1$s\'. In Android version 9, the file is in Download folder.</string>
<string name="backup_failed">Failed to back up application data to file <string name="backup_failed">Failed to back up application data to file
\'%1$s\'. Check Apps → baresip → Permissions → Storage.</string> \'%1$s\'. Check Apps → baresip → Permissions → Storage.</string>
<string name="restart_request">Restart Request</string> <string name="restart_request">Restart Request</string>