Include also mobile account's call and chat history in backup

This commit is contained in:
Juha Heinanen
2026-06-04 09:37:29 +03:00
parent 7a7ad4f02e
commit a5225db7e3
2 changed files with 9 additions and 4 deletions
@@ -2104,6 +2104,8 @@ class BaresipService: Service() {
Log.d(TAG, "Removing Mobile account (role lost or SIM missing)") Log.d(TAG, "Removing Mobile account (role lost or SIM missing)")
existingMobileUa.remove() existingMobileUa.remove()
Account.saveAccounts() Account.saveAccounts()
CallHistoryNew.save()
Message.save()
updateStatusNotification() updateStatusNotification()
} }
return return
@@ -2132,6 +2134,8 @@ class BaresipService: Service() {
uasStatus.value = UserAgent.statusMap() uasStatus.value = UserAgent.statusMap()
Account.saveAccounts() Account.saveAccounts()
CallHistoryNew.save()
Message.save()
updateStatusNotification() updateStatusNotification()
} }
@@ -165,6 +165,7 @@ import java.io.File
import java.text.SimpleDateFormat import java.text.SimpleDateFormat
import java.util.Date import java.util.Date
import java.util.Locale import java.util.Locale
import kotlin.time.Duration.Companion.milliseconds
private val dialpadButtonEnabled = mutableStateOf(true) private val dialpadButtonEnabled = mutableStateOf(true)
private var pullToRefreshEnabled = mutableStateOf(true) private var pullToRefreshEnabled = mutableStateOf(true)
@@ -396,7 +397,7 @@ private fun MainScreen(
if (isConnected) { if (isConnected) {
if (configuration.orientation == Configuration.ORIENTATION_PORTRAIT) { if (configuration.orientation == Configuration.ORIENTATION_PORTRAIT) {
call.focusDtmf.value = true call.focusDtmf.value = true
delay(300) delay(300.milliseconds)
keyboardController?.show() keyboardController?.show()
} }
else else
@@ -906,7 +907,7 @@ private fun MainContent(navController: NavController, viewModel: ViewModel, cont
LaunchedEffect(isRefreshing) { LaunchedEffect(isRefreshing) {
if (isRefreshing) { if (isRefreshing) {
delay(1000) delay(1000.milliseconds)
isRefreshing = false isRefreshing = false
} }
} }
@@ -1456,7 +1457,7 @@ private fun CallTimer(
val elapsedMillis = now - startTime val elapsedMillis = now - startTime
val seconds = if (elapsedMillis > 0) elapsedMillis / 1000 else 0 val seconds = if (elapsedMillis > 0) elapsedMillis / 1000 else 0
timeText = android.text.format.DateUtils.formatElapsedTime(seconds) timeText = android.text.format.DateUtils.formatElapsedTime(seconds)
delay(1000L) delay(1000L.milliseconds)
} }
} }
@@ -2778,7 +2779,7 @@ private fun acceptTransfer(ctx: Context, viewModel: ViewModel, ua: UserAgent, ca
private fun backup(ctx: Context, password: String) { private fun backup(ctx: Context, password: String) {
val files = arrayListOf("accounts", "config", "contacts", "call_history", val files = arrayListOf("accounts", "config", "contacts", "call_history",
"messages", "uuid", "gzrtp.zid", "cert.pem", "ca_cert", "ca_certs.crt") "messages", "uuid", "gzrtp.zid", "cert.pem", "ca_cert", "ca_certs.crt", "blocked.json")
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)