Refactor LiveLocationShare to include structured LastLocation

This commit is contained in:
ganfra 2026-04-10 14:43:24 +02:00
parent d6999b5334
commit 9ba8798175
3 changed files with 26 additions and 9 deletions

View file

@ -138,7 +138,8 @@ class ShowLocationPresenter(
val membersStateFlow = joinedRoom.membersStateFlow.mapState { it.joinedRoomMembers() }
combine(liveLocationSharesFlow, membersStateFlow) { liveShares, members ->
liveShares.mapNotNull { share ->
val location = Location.fromGeoUri(share.lastGeoUri) ?: return@mapNotNull null
val lastLocation = share.lastLocation ?: return@mapNotNull null
val location = Location.fromGeoUri(lastLocation.geoUri) ?: return@mapNotNull null
val member = members.find { it.userId == share.userId }
val displayName = member?.getBestName() ?: share.userId.value
val avatarUrl = member?.avatarUrl
@ -154,7 +155,7 @@ class ShowLocationPresenter(
formattedTimestamp = "Sharing live location",
location = location,
isLive = true,
assetType = AssetType.SENDER,
assetType = lastLocation.assetType,
)
}.toPersistentList()
}.collect { value = it }