Commit d859e67c authored by Christophe Deschamps's avatar Christophe Deschamps
Browse files

New logic in history events - marked as read only if played

parent adbb86b7
......@@ -109,11 +109,11 @@ object HistoryEventStore {
return historyEvents.get(callId)
}
fun markAllAsRead() {
historyEvents.forEach {
it.value.viewedByUser = true
fun markAsRead(historyEventId: String) {
historyEvents.filter { it.value.id == historyEventId }.forEach { event ->
event.value.viewedByUser = true
persistHistoryEvent(event.value)
}
sync()
}
}
\ No newline at end of file
......@@ -126,6 +126,7 @@ class HistoryFragment : GenericFragment() {
mainactivity.toolbarViewModel.rightButtonVisible.value =
!historyViewModel.history.value!!.isEmpty()
coreContext.notificationsManager.dismissMissedCallNotification()
binding.root.loglist.adapter?.notifyDataSetChanged()
}
......@@ -144,7 +145,6 @@ class HistoryFragment : GenericFragment() {
override fun onPause() {
HistoryEventStore.markAllAsRead()
mainactivity.tabbarViewModel.updateUnreadCount()
super.onPause()
}
......
......@@ -36,6 +36,7 @@ import org.linhome.LinhomeApplication
import org.linhome.R
import org.linhome.databinding.ActivityPlayerBinding
import org.linhome.linphonecore.extensions.historyEvent
import org.linhome.store.HistoryEventStore
import org.linhome.utils.cdlog
import org.linphone.core.Player
import org.linphone.core.tools.Log
......@@ -85,6 +86,7 @@ class PlayerActivity : GenericActivity(allowsLandscapeOnSmartPhones = true) {
if (event.hasVideo) {
setTextureView(binding.root.video, player, seekTo, playing)
}
HistoryEventStore.markAsRead(event.id)
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment