Refactor LiveLocationShare to include structured LastLocation
This commit is contained in:
parent
d6999b5334
commit
9ba8798175
3 changed files with 26 additions and 9 deletions
|
|
@ -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 }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue