diff --git a/app/src/main/kotlin/com/tutpro/baresip/BaresipService.kt b/app/src/main/kotlin/com/tutpro/baresip/BaresipService.kt index a16206cb..8851b9d9 100644 --- a/app/src/main/kotlin/com/tutpro/baresip/BaresipService.kt +++ b/app/src/main/kotlin/com/tutpro/baresip/BaresipService.kt @@ -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() - } - + CallHistoryNew.restore() Blocked.restore() BlockRule.restore() diff --git a/app/src/main/kotlin/com/tutpro/baresip/CallHistory.kt b/app/src/main/kotlin/com/tutpro/baresip/CallHistory.kt index 393c943a..82d15f7c 100644 --- a/app/src/main/kotlin/com/tutpro/baresip/CallHistory.kt +++ b/app/src/main/kotlin/com/tutpro/baresip/CallHistory.kt @@ -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 { - val file = File(BaresipService.filesPath, "history") - var result = ArrayList() - if (file.exists()) { - try { - val fis = FileInputStream(file) - val ois = ObjectInputStream(fis) - @Suppress("UNCHECKED_CAST") - val restoredHistory = ois.readObject() as? List - 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 - } - } - -} \ No newline at end of file