Update last location content of beacon info state event.

This commit is contained in:
Onuray Sahin 2022-04-06 19:01:25 +03:00
parent 197b542030
commit faa07513ec
2 changed files with 5 additions and 3 deletions

View File

@ -43,8 +43,7 @@ data class LiveLocationBeaconContent(
/**
* Client side tracking of the last location
*/
@Transient
val lastLocationContent: MessageLiveLocationContent? = null
var lastLocationContent: MessageLiveLocationContent? = null
) {
fun getBestBeaconInfo() = beaconInfo ?: unstableBeaconInfo

View File

@ -552,7 +552,6 @@ internal class EventRelationsAggregationProcessor @Inject constructor(
content: MessageLiveLocationContent,
roomId: String,
isLocalEcho: Boolean) {
val beaconInfoEventId = event.getRelationContent()?.eventId ?: return
val locationSenderId = event.senderId ?: return
// We shouldn't process local echos
@ -577,6 +576,10 @@ internal class EventRelationsAggregationProcessor @Inject constructor(
Timber.v("## LIVE LOCATION. Beacon info content is invalid")
return
}
// Update last location info of the beacon state event
beaconInfoContent.lastLocationContent = content
beaconInfoEntity.root?.content = ContentMapper.map(beaconInfoContent.toContent())
}
private fun isBeaconInfoOutdated(beaconInfoContent: LiveLocationBeaconContent,