Removed support for old call history

This commit is contained in:
Juha Heinanen
2026-06-26 16:34:55 +03:00
parent 7cc07a2821
commit d439b86fa2
2 changed files with 1 additions and 49 deletions

View File

@ -557,18 +557,7 @@ class BaresipService: Service() {
}
Contact.contactsUpdate()
val history = CallHistory.get()
if (history.isEmpty())
CallHistoryNew.restore()
else
for (old in history) {
val new = CallHistoryNew(old.aor, old.peerUri, old.direction)
new.stopTime = old.stopTime
new.startTime = old.startTime
new.recording = old.recording
new.add()
}
Blocked.restore()
BlockRule.restore()

View File

@ -127,41 +127,4 @@ class CallHistoryNew(val aor: String, val peerUri: String, val direction: String
"${h.stopTime}, ${h.rejected}, ${h.recording}")
}
}
}
class CallHistory(val aor: String, val peerUri: String, val direction: String) : Serializable {
var startTime: GregorianCalendar? = null
var stopTime = GregorianCalendar()
var recording = arrayOf("", "")
companion object {
@Suppress("unused")
private const val serialVersionUID: Long = 2
fun get(): ArrayList<CallHistory> {
val file = File(BaresipService.filesPath, "history")
var result = ArrayList<CallHistory>()
if (file.exists()) {
try {
val fis = FileInputStream(file)
val ois = ObjectInputStream(fis)
@Suppress("UNCHECKED_CAST")
val restoredHistory = ois.readObject() as? List<CallHistory>
if (restoredHistory != null)
result = ArrayList(restoredHistory)
ois.close()
fis.close()
Log.d(TAG, "Got history of ${result.size} calls")
file.delete()
} catch (e: Exception) {
Log.e(TAG, "InputStream exception", e)
}
}
return result
}
}
}