save call and message history dynamically
This commit is contained in:
@@ -451,8 +451,6 @@ class BaresipService: Service() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun stop() {
|
private fun stop() {
|
||||||
CallsActivity.saveHistory()
|
|
||||||
MessagesActivity.saveMessages()
|
|
||||||
MainActivity.uas.clear()
|
MainActivity.uas.clear()
|
||||||
MainActivity.images.clear()
|
MainActivity.images.clear()
|
||||||
MainActivity.history.clear()
|
MainActivity.history.clear()
|
||||||
|
|||||||
@@ -471,6 +471,7 @@ class MainActivity : AppCompatActivity() {
|
|||||||
if (CallHistory.aorHistory(history, aor) > HISTORY_SIZE)
|
if (CallHistory.aorHistory(history, aor) > HISTORY_SIZE)
|
||||||
CallHistory.aorRemoveHistory(history, aor)
|
CallHistory.aorRemoveHistory(history, aor)
|
||||||
history.add(CallHistory(aor, peer_uri, "in", false))
|
history.add(CallHistory(aor, peer_uri, "in", false))
|
||||||
|
CallsActivity.saveHistory()
|
||||||
acc.missedCalls = true
|
acc.missedCalls = true
|
||||||
if (ua == uas[aorSpinner.selectedItemPosition]) {
|
if (ua == uas[aorSpinner.selectedItemPosition]) {
|
||||||
callsButton.setImageResource(R.drawable.calls_missed)
|
callsButton.setImageResource(R.drawable.calls_missed)
|
||||||
@@ -534,7 +535,10 @@ class MainActivity : AppCompatActivity() {
|
|||||||
dtmf.requestFocus()
|
dtmf.requestFocus()
|
||||||
dtmf.addTextChangedListener(call.dtmfWatcher)
|
dtmf.addTextChangedListener(call.dtmfWatcher)
|
||||||
}
|
}
|
||||||
|
if (CallHistory.aorHistory(history, aor) > HISTORY_SIZE)
|
||||||
|
CallHistory.aorRemoveHistory(history, aor)
|
||||||
history.add(CallHistory(aor, call.peerURI, call.dir, true))
|
history.add(CallHistory(aor, call.peerURI, call.dir, true))
|
||||||
|
CallsActivity.saveHistory()
|
||||||
call.hasHistory = true
|
call.hasHistory = true
|
||||||
if (rtTimer != null) {
|
if (rtTimer != null) {
|
||||||
rtTimer!!.cancel()
|
rtTimer!!.cancel()
|
||||||
@@ -547,8 +551,6 @@ class MainActivity : AppCompatActivity() {
|
|||||||
// am.setStreamVolume(AudioManager.STREAM_VOICE_CALL,
|
// am.setStreamVolume(AudioManager.STREAM_VOICE_CALL,
|
||||||
// (am.getStreamMaxVolume(STREAM_VOICE_CALL) / 2) + 1,
|
// (am.getStreamMaxVolume(STREAM_VOICE_CALL) / 2) + 1,
|
||||||
// AudioManager.STREAM_VOICE_CALL)
|
// AudioManager.STREAM_VOICE_CALL)
|
||||||
if (CallHistory.aorHistory(history, aor) > HISTORY_SIZE)
|
|
||||||
CallHistory.aorRemoveHistory(history, aor)
|
|
||||||
}
|
}
|
||||||
"call verify" -> {
|
"call verify" -> {
|
||||||
val callp = params[1]
|
val callp = params[1]
|
||||||
@@ -639,6 +641,7 @@ class MainActivity : AppCompatActivity() {
|
|||||||
if (CallHistory.aorHistory(history, aor) > HISTORY_SIZE)
|
if (CallHistory.aorHistory(history, aor) > HISTORY_SIZE)
|
||||||
CallHistory.aorRemoveHistory(history, aor)
|
CallHistory.aorRemoveHistory(history, aor)
|
||||||
history.add(CallHistory(aor, call.peerURI, call.dir,false))
|
history.add(CallHistory(aor, call.peerURI, call.dir,false))
|
||||||
|
CallsActivity.saveHistory()
|
||||||
if (call.dir == "in") {
|
if (call.dir == "in") {
|
||||||
acc.missedCalls = true
|
acc.missedCalls = true
|
||||||
if (ua == uas[aorSpinner.selectedItemPosition])
|
if (ua == uas[aorSpinner.selectedItemPosition])
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ class MessagesActivity: AppCompatActivity() {
|
|||||||
}
|
}
|
||||||
DialogInterface.BUTTON_NEGATIVE -> {
|
DialogInterface.BUTTON_NEGATIVE -> {
|
||||||
MainActivity.messages.remove(uaMessages[pos])
|
MainActivity.messages.remove(uaMessages[pos])
|
||||||
|
saveMessages()
|
||||||
uaMessages.removeAt(pos)
|
uaMessages.removeAt(pos)
|
||||||
if (uaMessages.size == 0) {
|
if (uaMessages.size == 0) {
|
||||||
val i = Intent()
|
val i = Intent()
|
||||||
@@ -180,6 +181,7 @@ class MessagesActivity: AppCompatActivity() {
|
|||||||
if ((MainActivity.messages[i].aor == aor) &&
|
if ((MainActivity.messages[i].aor == aor) &&
|
||||||
(MainActivity.messages[i].timeStamp == time)) {
|
(MainActivity.messages[i].timeStamp == time)) {
|
||||||
MainActivity.messages[i].new = false
|
MainActivity.messages[i].new = false
|
||||||
|
saveMessages()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -189,6 +191,7 @@ class MessagesActivity: AppCompatActivity() {
|
|||||||
if ((MainActivity.messages[i].aor == aor) &&
|
if ((MainActivity.messages[i].aor == aor) &&
|
||||||
(MainActivity.messages[i].timeStamp == time)) {
|
(MainActivity.messages[i].timeStamp == time)) {
|
||||||
MainActivity.messages.removeAt(i)
|
MainActivity.messages.removeAt(i)
|
||||||
|
saveMessages()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -202,6 +205,7 @@ class MessagesActivity: AppCompatActivity() {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
MainActivity.messages.add(message)
|
MainActivity.messages.add(message)
|
||||||
|
saveMessages()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun saveMessages() {
|
fun saveMessages() {
|
||||||
|
|||||||
Reference in New Issue
Block a user